I have several sets of images with a typical image being:

enter image description here

and from each image, I would like to extract the top and bottom curves of the object, shown in red here:

enter image description here

What are some possible tools I could use to solve this problem?

Some things I've looked in to:

Edge detection

As seen in the pictures, there are more edges in the image than just the two edges I'm interested in. I've implemented some naive edge detection in Python with scipy, however, this approach returns a lot of edges I don't want and the data is noisy. If I were able to clean up the data, is there a way to automatically select the edges I'm interested in (the red lines in the picture above) from the whole set of edges?

Background Subtraction

The image sets are actually taken from a video of the object moving over time. Using background subtraction, I'm able to create images like this:

enter image description here

But since the object is fixed on the upper-left end, there is little movement and this approach doesn't provide enough data in that region to create a complete line. Additionally, some sets have very little movement anywhere in the image so this approach wouldn't register the object in these cases.

Possibility of using computer vision: An approach that I haven't looked into is implementing some form of computer vision. I see examples of object detection where a bounding box for an object is created. However, I would like to extract specific curves.

Any feedback or help pointing me in the right direction would be greatly appreciated, thanks.

  • $\begingroup$ How about using any greenboxing algorithm? $\endgroup$ Commented Jul 3, 2019 at 0:47
  • $\begingroup$ Could you show few hots of the video stream? What can you guarantee about the image? $\endgroup$
    – Royi
    Commented Mar 29, 2020 at 23:31
  • $\begingroup$ If you can assume the orientation of the object you may use dsp.stackexchange.com/questions/88303. $\endgroup$
    – Royi
    Commented Jun 30, 2023 at 7:56

1 Answer 1


You might find my, or the other answers, from here helpful.

After advice about detecting focus quality of objects in a photo detected using YoloV3

I would have put this in a comment, but I can't include a pic there.

Perhaps you could come up with a better verbal description of how to define the edges of interest.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.