1

I know the title does not make much sense but here is the situation I'm working on a computer vision algorithm and i end up with something like

enter image description here

working with the algorithm is way too expensive and no matter how big the threshold i add there is always noise (that less concentrated lime green).

All I need is to end up with that concentrated pixels and at this point I really need clever idea to save processing.

No I don't really need code, just idea would get me going.

Martin Thorsen Ranang
  • 2,394
  • 1
  • 28
  • 43
user3761832
  • 563
  • 2
  • 7
  • 18
  • What is 'concentrated' or 'dense'? Pixels have Colors and Colors have a brightness, a hue and a saturation. And posibly an alpha value (opacity).. So what do you want to change in your image?? See [here](http://stackoverflow.com/questions/28792723/adding-or-subtracting-color-from-an-image-in-a-picturebox-using-c-sharp/28799612#28799612) for an example of a fast filter..! – TaW Apr 05 '15 at 18:29

3 Answers3

1

I think usual approach there is to pick random green pixel and start walking around, counting how many green pixels create continuous area. If number of pixels, that you can get to, is less than %\theta%, then this pixel and all its neighbors are 'noise' and should be discarded.

Maybe easier way might work as well: you can apply Gaussian filter first in order to smooth greed pixels down and then use threshold to delete pixels below %\theta%. Point is that, if you pick up correct sigma for your gaussian filter kernel, single pixels will be diluted down, but groups of pixels will have higher intensity. Please comment, if this is confusing.

  • i like the first idea and had something similar in mind but with 100k green pixels that is still messy, i would want to go with something more like calculating greenpixels/allpixels and get density per x^2 pixels and compare it to a threshold but ill accept this answer if nothing better came up :) – user3761832 Apr 05 '15 at 12:24
  • 100k pixels?.. bonus is that you can parallelize solving it with iterations like this. whats the total size of binary green pixels image? Can you fit multiple copies in memory? – aaaaa says reinstate Monica Apr 05 '15 at 12:28
  • 1280x800 and a 100k is just an average, it could be even 400k and yup i use parallel libraries whenever possible and no :\ – user3761832 Apr 05 '15 at 12:32
  • 1280x800 is "just" 128 Kbytes of memory for single binary (black/green) image. If you create a copy for each of even 24 cores in RAM it still gonna be 3 megabytes total. of course, depends on actual circumstances – aaaaa says reinstate Monica Apr 05 '15 at 12:53
1

After preforming the threshold, you can perform blob analysis (AKA connected component analysis, labeling, see here), which will give you a list of connected regions. After that, you can filter out the smaller ones, using their area, dimensions of enclosing rectangle etc.

Blob analysis/ connected component analysis/ labeling is implemented by many computer vision libraries, though it's not too hard to write it alone if performance is not a critical issue.

Ophir Gvirtzer
  • 604
  • 4
  • 8
1

Seems like you need a noise reduction algorithm. I'd start with something like a Median Filter.

vzaguskin
  • 310
  • 1
  • 9