Click here to Skip to main content
11,928,587 members (55,392 online)
Rate this:
Please Sign up or sign in to vote.
I want a c# algorithm to detect red small objects( blobs) in a background with 2 other colors( i.e blue and white) so i want to circle these red objects..

i know about Aforge.NET library but it's not useful in my case because I can't add the references in Windows Phone 7 solution ( it's not compatible with its run-time)

Posted 1-May-11 18:25pm
Edited 1-May-11 18:52pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Without extra library?! Well, AForce.NET is using .NET only, so, here is the plan:

  1. Try to solve the problem all by yourself;
  2. When you get enough experience and still face problems, build AForge.NET library and try to understand how it works; may be it will help you;
  3. Go back to item 1; repeat those items until success;
  4. If you feel you're not making further progress but your problem is not yet solved, ask a question at CodeProject, this time more concrete.

A hint: get red channel only and try to perform Blob Detection, see:[^]

RaviRanjankr 1-May-11 23:39pm
Nice response SA, My 5 :)
rodi1 1-May-11 23:46pm
Thats what happens when we need things urgently and writing quick questions.. Now , you can revise the question :)

SAKryukov 1-May-11 23:58pm
Urgently? Hm. That could be quite a big part of project. Didn't you know about that? Read the reference to see what's involved; it pretty much explains the algorithms and provides further references. Knowing proper keywords, you can try to find code samples...
rodi1 2-May-11 0:05am
I'm a newbie in image processing and this reference is helping me knowing the keywords for searching so thank you :)

The problem is that I'm only finding code samples with aforge.Net and this won't help in my case.. Do have any code sample links?

Thank you for your support :)
SAKryukov 2-May-11 0:18am
No, I don't know any samples. I've used very expensive copy-protected commercial library just a bit and have an idea on how big some tasks are. I don't want to discourage you (because you might have enough talent and be am effective and hard worker), but the problem is exactly not for beginners.
rodi1 2-May-11 0:28am
Oh yes I'm a beginner and a passionate student developing some cool ideas.. yes it's a hard task for me but I really need it for my project. As you are expert in the field , I have a microscopic image with cells and the bacteria are colored with red and the background is blue so I want the application to circle these red bacterias automatically.. Do you have any other solution that fits my case?

Thank you a lot!
SAKryukov 2-May-11 0:46am
You're welcome.

I cannot see a simpler solution. Major simplification was going to red channel only (just in your case), so it reduces the problem to a simper gray-scale problem. You can also contrast the picture before recognition, it can help. I'm not such an expert; I directed a team working for just few months on the problem using recognition; and we had just one real expert in this field.

I must say, your task is pretty interesting but relatively simple in recognition part.
You still can use some library but only a part of the source code, to make it clean from unused code which is not supported by your version of CLI (is it Compact Framework?).

If you find my answer useful, will you formally accept it (green button)?

rodi1 2-May-11 1:07am
Thanks again :) yes you deserve the green button -;)

My CLI is a compact framework yes ... I will try to do play out with contrasting. Now, I used some sort of contrast, these red particles became fluorescent which is good.. Now , the challenge is how to place a circle and recognize them.. I can't import any references like & Emgu :( ..
SAKryukov 2-May-11 1:16am
Thank you.
Well, most difficult part is still on your plate to work at... :-)
rodi1 2-May-11 1:25am
You are welcome :)

I used these for playing with contrasts and I can get amazing results by just using color, contrast , and gamma -;) I'm almost getting the red particles shining whereas the blue/white background is vanishing .I think I will automate the values according to my case ..

I can forget about circling with this solution..

Ain't it a good solution now?

SAKryukov 2-May-11 1:27am
Looks like a great article but I cannot see that the blobs are recognized.
SAKryukov 2-May-11 0:37am
Thank you, Ravi.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

SAKryukov 1-May-11 23:41pm
Just for a record: 1) due to OP claim that she/he knows about AForge.NET, first link is redundant; 2) second article does not have a relevant chapter which would help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 1 May 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100