-1

Are there functions within OpenCV that will 'track' a gradually changing curve without following sharply divergent crossing lines? Ex: If one were attempting to track individual outlines of two crossed boomerangs, is there an easy way to follow the curved line 'through' the intersection where the two boomerangs cross?

This would require some kind of inertial component that would continue a 'virtual' line when the curve was interrupted by the other crossed boomerang, and then find the continuation of the original line on the opposite side.

This seems simple, but it sounds so complicated when trying to explain it. :-) It does seem like a scenario that would occur often (attempting to trace an occluded object). Perhaps part of a third party library or specialized project?

StringTheory
  • 117
  • 3
  • 8
  • This question is impossible to answer because it doesn't give enough details. Please draw some example and try to rephrase it instead of expecting people to read your mind. – Max Walczak Oct 25 '17 at 11:45
  • Read my mind? It didn't occur to me that some may not know what I meant by "two crossed boomerangs." I thought that would be a good visual. Here are some pics, as you requested: http://geckos.ceo.wa.edu.au/geckos/img/cliparts/tools/Crossed-Boomerangs.gif OR http://www.nma.gov.au/__data/assets/image/0007/475558/yalma-cross-boomerang-685w.jpg – StringTheory Oct 25 '17 at 23:28
  • BTW, "Boomerang" was just a convenient image for any object with gradually changing contours. The junction when the two boomerangs (or whatever) cross will have sharp angles. The objective is to follow the smooth contour as if it is a Bezier curve, which would hopefully provide separate contours for the two boomerangs (or bananas, cucumbers, whatever). Another image, in case it's helpful: https://thumb1.shutterstock.com/display_pic_with_logo/1274287/136742228/stock-vector-bananas-136742228.jpg :-) – StringTheory Oct 25 '17 at 23:40
  • @MaxWalczak: Weren't you going to reply after requested examples were posted? Is this still not clear? (At least I got a downvote...nice) – StringTheory Oct 27 '17 at 05:29
  • There is no such functionality in OpenCV out of the box. It's a really non-trivial problem. You know those objects overlap not because you track inertial component of the contours but because you know those are bananas. Even if you had a way to track the contours and predict their trajectory, you are still left with the question when should the tracking terminate and for how large objects should it work. I think you should ask a general question about the algorithm and not about implementation on computer-vision stackexchange. – Max Walczak Oct 27 '17 at 12:01

1 Answers1

0

I believe I have found an approach to this. OpenCV's approxPolyDP finds polygons to approximate the contour. It is relatively easy to track angles between the polygon's sides (as opposed to finding continuous tangents to curves). When an 'internal' angle is found where the two objects meet, it should be possible to match with a corresponding internal angle on the opposite side.

Ex: When two bananas/boomerangs/whatever overlap, the outline will form a sort of cross, with four points and four 'internal angles' (> 180 degrees). It should be possible to match the coordinates of the four internal angles. If their corresponding lines (last known trajectory before overlap) are close enough to parallel, then that indicates overlapping objects rather than one more complex shape.

approxPolyDP simplifies this to geometry and trig. This should be a much easier solution than what I had previously envisioned with continuous bezier curves and inertia. I should have thought of this earlier.

StringTheory
  • 117
  • 3
  • 8
  • So...no one had an answer for the original question. I solved the problem and posted the solution. Then received two spiteful downvotes for it. This place is truly amazing sometimes. There should really be some mechanism in place to discourage this type of thing. – StringTheory Nov 15 '17 at 13:08