The thing is that I've wanted to show the elements that interest me.
Let me explain, I have applied a threshold
to only see completely white elements. (Having previously applied a gray filter)
_,threshold_frame = cv2.threshold(gray,254,255,cv2.THRESH_BINARY)
From here I draw the outline of all the elements that are seen by the function cv2.findContours()
_, contours,_ = cv2.findContours(threshold_frame, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
I am now drawing ALL the outlines by cv2.drawContours()
, but NO I want that. What options are usually used in these cases to narrow your search and that only those desired elements come out?
I know that the function cv2.drawContours()
has the third argument to pass the index of the outline we want to draw, and I imagine the shots must go around here, but I really do not know what value my object has.
Another option that has occurred to me and that I am now using is to delimit elements with a greater or lesser area at a certain value. But this is very sloppy and also is not infallible.
DATA (I think it's interesting)
I work with two luminous objects which never appear at the same time, or there is one or there is another. One is spherical but the other has an irregular shape. When applying the threshold I only see these through the camera, but also the bulbs or sunlight if there is a window. Precisely what I want to rule out are light bulbs and sunlight.
Health and thanks!