OpenSourcePhysics / tracker

Video analysis and modeling tool built on the Open Source Physics framework
GNU General Public License v3.0
206 stars 52 forks source link

Tracker is not good at tracking a rotating line such as a gauge needle #47

Open BrunoB81HK opened 1 year ago

BrunoB81HK commented 1 year ago

I'm currently trying to track the rotation of a gauge needle. The problem is that I can't put a marker on the needle to have a round marker to track and that makes the tracking of the needle by the autotracker almost impossible. I wonder if a feature that track a rotating line could be implemented in some ways.

dobrown commented 1 year ago

Thanks for the suggestion. We have considered adding rotation to the autotracker but have not implemented it yet. I’ll take another look.

On Mon, Apr 17, 2023 at 5:56 AM Bruno-Pier @.***> wrote:

I'm currently trying to track the rotation of a gauge needle. The problem is that I can't put a marker on the needle to have a round marker to track and that makes the tracking of the needle by the autotracker almost impossible. I wonder if a feature that track a rotating line could be implemented in some ways.

— Reply to this email directly, view it on GitHub https://github.com/OpenSourcePhysics/tracker/issues/47, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXIBFAET7REFDRH52TGN2LXBU4YFANCNFSM6AAAAAAXBEYQTQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

BrunoB81HK commented 1 year ago

Hi @dobrown,

Do you have any news on this issue? Although I'm not familiar with this codebase, I could try and help you implement it.

dobrown commented 1 year ago

Hi Bruno, thanks for offering to help, I can't get to it any time soon. I suggest you start by looking at the org.opensourcephysics.cabrillo.tracker.AutoTracker.findMatchTarget(Rectangle) method at line 1030. The AutoTracker calls the org.opensourcephysics.media.core.TemplateMatcher.getMatchLocation() method at line 1053/55 to find the actual match after first setting the template matcher's template image at line 1042. My thought is that findMatchTarget() would be modified by repeatedly rotating the template image by a small angle and repeating the calls to getMatchLocation(). The fits at different angles would be compared and the best one kept. The trick I think is going to be trying to keep the template pattern clean and undistorted when rotating the template image. Might require that the image be square/circular? Do you have experience with image operations? Doug

BobHanson commented 1 year ago

Doug would you have to specify some rotation axis center? Does sound tricky.

On Fri, May 5, 2023, 4:34 PM Douglas Brown @.***> wrote:

Hi Bruno, thanks for offering to help, I can't get to it any time soon. I suggest you start by looking at the org.opensourcephysics.cabrillo.tracker.AutoTracker.findMatchTarget(Rectangle) method at line 1030. The AutoTracker calls the org.opensourcephysics.media.core.TemplateMatcher.getMatchLocation() method at line 1053/55 to find the actual match after first setting the template matcher's template image at line 1042. My thought is that findMatchTarget() would be modified by repeatedly rotating the template image by a small angle and repeating the calls to getMatchLocation(). The fits at different angles would be compared and the best one kept. The trick I think is going to be trying to keep the template pattern clean and undistorted when rotating the template image. Might require that the image be square/circular? Do you have experience with image operations? Doug

— Reply to this email directly, view it on GitHub https://github.com/OpenSourcePhysics/tracker/issues/47#issuecomment-1536804296, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHNCW5MBFTPAPWKKVA6SATXEVW5XANCNFSM6AAAAAAXBEYQTQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dobrown commented 1 year ago

I suppose if a square template image was used the axis would be at the center. I did mess around with some code to rotate the template a year or 2 ago without much success, so I dropped the idea at the time.

On Sat, May 6, 2023 at 8:56 AM Bob Hanson @.***> wrote:

Doug would you have to specify some rotation axis center? Does sound tricky.

On Fri, May 5, 2023, 4:34 PM Douglas Brown @.***> wrote:

Hi Bruno, thanks for offering to help, I can't get to it any time soon. I suggest you start by looking at the

org.opensourcephysics.cabrillo.tracker.AutoTracker.findMatchTarget(Rectangle) method at line 1030. The AutoTracker calls the org.opensourcephysics.media.core.TemplateMatcher.getMatchLocation() method at line 1053/55 to find the actual match after first setting the template matcher's template image at line 1042. My thought is that findMatchTarget() would be modified by repeatedly rotating the template image by a small angle and repeating the calls to getMatchLocation(). The fits at different angles would be compared and the best one kept. The trick I think is going to be trying to keep the template pattern clean and undistorted when rotating the template image. Might require that the image be square/circular? Do you have experience with image operations? Doug

— Reply to this email directly, view it on GitHub < https://github.com/OpenSourcePhysics/tracker/issues/47#issuecomment-1536804296 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEHNCW5MBFTPAPWKKVA6SATXEVW5XANCNFSM6AAAAAAXBEYQTQ

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/OpenSourcePhysics/tracker/issues/47#issuecomment-1537170407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXIBFGXYJRCTO6X6GWZR23XEZYCHANCNFSM6AAAAAAXBEYQTQ . You are receiving this because you were mentioned.Message ID: @.***>