Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Detecting objects with a certain surface area

$
0
0
Hi guys, I'd like to detect small but undefined shapes with a certain value of surface area, say 25 pixels worth. Now, I tried coding by calculating an array of pixels with adjacency but it seems pretty tedious and demanding for the debugging. Let's say I want to detect an image with at least 3 x 1 green pixels (where I have performed threshold the image to a binary black & green form): for (int i = 0; i < Image.rows; i++){ if (Image.at(i , 200)[1] == 255){ if (Image.at(i+1 , 200)[1] == 255){ if (Image.at(i+2 , 200)[1] == 255){ putText(Image, "Detected", Point(20, 20), FONT_HERSHEY_PLAIN, 1, Scalar::all(255), 2, 8); } } } } Now, this seemed to work but occasionally it'll crash due to the memory. I suppose there are workarounds to this? How do I do this? Thanks bros.

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>