As per the title, can you suggest a way to identify if the object to the right of the picture below is above/below the line marked with the blue arrows. Unfortunately I can’t post them as two separate pictures because new users are limited to one embedded media per post.
There are two separate problems. One is detecting the curved line, which I’m 90% there on and the other is working out if an object is above/below the detected line.
No, sorry. Because of the rules of the forum I can’t post two embedded media in the same post so I had to merge the two side by side in one picture. Essentially the object to be tracked will always be above/below the line I pointed out and no extrapolation of said line is needed.
Essentially, the camera starts with a static background from which I extract my line. As the objects start to come into view, I isolate them and need to determine if, at any point when they are in view, they move above the line.
Because I’ve been deep in this for quite a few hours, my brain foolishly assumed everyone has the same overview of the problem that I do. Hope everything is clear now? In any case, here are the two pictures separately:
Great, thanks! One more question. When you said in the other thread about the correct tools for a certain problem, that got me thinking on how I recognize the outline of the moving objects. That part is done again with a blow torch and a hammer:
Convert each frame to grayscale
Apply an absDiff() on two consecutive frames.
Apply a Cloe morphological transformation on the diff
Binary threshold to a value which seems to give out decent results
Apply a blur transformation
It’s not ideal, but it works. Main problem is getting a “tail” on the position of the object in the current frame and the fact that the outline is not always consistent - depending on the color of the object.
Here’s a few pictures of the objects being tracked. Getting the outline right (especially at the bottom of the object) is critical. Obj1, obj2
I would however recommend something from the bgsegm module. same principle (differences), but it builds a “model” (picture) of the background rather than using the previous frame.
you might need morphology operations and/or blur to clean that up too.
Thanks. Very good resources. Have switched over to KNN and works well. One thing I can’t seem to do is get a decent filter to fill in the object properly and get rid of the noise.