Ask Your Question

Revision history [back]

Find first non-black pixel

I have a very simple input image: it's fully black and has a tiny bright red dot somewehere in it. The colors are "pure", meaning the blacks are (0,0,0), the red dot is at full 255 red intensity.

Now I would like to find the coordinate of the red dot. I thought this would be rather simple, since all I need is the position of the first non-black pixel in my image. That would be good enough for my application.

But I have searched quite a while and could not find a simple and fast solution to do this with OpenCV.

PS: I know that OpenCV has a blob detection, but that seems waaay to powerful (and expensive) for this simple task.