can anyone help me to find out the top 1% (or say top 100 pixels)brightest pixels with their locations of a gray image in opencv. because cvMinMaxLoc() gives only brightest pixel location. Any help is greatly appreciated.
@Mark:thresholding doesnt help,you need to find out brightest pixels and their location.
ajith
2010-09-06 04:40:57
How doesn't it help? Threshold it first to boost their intensity to max, and then use your cvMinMaxLoc to find where they are.
Mark
2010-09-06 06:49:26
cvMinMaxLoc gives only one brightest pixel's location,hw can i find out other loc with same intensity?
ajith
2010-09-06 07:02:42
Oh.. my bad. I thought you meant that it gave all the pixels with the (same) brightest intensity. I don't know... what format are you hoping to get back? A list of x,y coordinates? Why not just use a binary threshold as I suggested, and then loop over the image however you please? Actually, if you're going to loop it, you can do the thresholding yourself at the same time.
Mark
2010-09-06 07:06:04
yeah...finding (x,y)coordinates of all those brightest pixels...kind of sorting but with the locations...
ajith
2010-09-06 07:17:12
i'm pretty sure I just looped it in my project.
Mark
2010-09-06 07:25:19
k..can you send me that part? [email protected]
ajith
2010-09-06 07:32:37
do you really want me to send you a for loop? seriously? `for(int y=0;y<height;++y){for(int x=0; x<width;++x){if(image[x][y]>threshold){do_something_with_coords(x,y);}}}`
Mark
2010-09-06 07:47:16
ha ha...:)i thought yo using some fn like minmaxLoc...anyway will see,ty
ajith
2010-09-06 08:02:04
+1
A:
this is a simple yet unneficient/stupid way to do it:
for i=1:100
get brightest pixel using cvMinMaxLoc
store location
set it to a value of zero
end
if you don't mind about efficiency this should work.
you should also check cvInRangeS to find other pixels of similar values defining low and high thresholds.
dnul
2010-09-06 18:28:54