APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Switching the time column post and replies

Return to the Switching the time column thread
Login to post to this thread

Correcting the rolling shutter effect with adjusted time values
Axel Mellinger
2 Posts

Is there a way to use a different column as time stamp, and base the calculation of angle and angular velocity on that column? And could Tracker calculate derivatives of a quantity with non-uniform time steps?

Background: In one of our intro physics lab experiments, students are recording a video clip of a rotating disk. Tracing a point on the disk, they calculate angle vs. time and angular velocity vs. time. The webcam introduces a strong rolling shutter effect, which makes the (uncorrected) angular velocity appear to oscillate. However, this can be compensated by adjusting the time stamp of each video frame according to

t_corr = t - t_line * y

where t_line is the readout time for one line in the webcam image, and y is the vertical pixel coordinate. See here for how efficient this correction works: http://galaxy.phy.cmich.edu/~axel/PHY17x/Rolling_Shutter_Correction.mp4

At the moment, we use Logger Pro for the video analysis, which has, however, been discontinued, and we are looking into Tracker as a possible replacement. Is there any way this rolling shutter correction could be done within Tracker? Any suggestions would be highly appreciated!

Axel


Replies to Correcting the rolling shutter effect with adjusted time values

Re: Correcting the rolling shutter effect with adjusted time values -
Douglas Brown Avatar
Douglas Brown
453 Posts

Hi Axel, what a great way to get usable data from a rolling shutter camera!

Unfortunately the derivative algorithms in Tracker require positions at equal time intervals. But "Derivative" is a Java interface so if you or your students are Java coders you might be able to implement a new Derivative class that will do what you want. Let me know if you want more info on that. How, in Logger Pro, do you find the non-constant-timestep derivatives?

BTW it is certainly possible to define your data variable t_corr in Tracker. Look at the Data Builder for that. It just isn't possible, currently, to get the derivatives. Hope this is useful. Doug

Is there a way to use a different column as time stamp, and base the calculation of angle and angular velocity on that column? And could Tracker calculate derivatives of a quantity with non-uniform time steps?

Background: In one of our intro physics lab experiments, students are recording a video clip of a rotating disk. Tracing a point on the disk, they calculate angle vs. time and angular velocity vs. time. The webcam introduces a strong rolling shutter effect, which makes the (uncorrected) angular velocity appear to oscillate. However, this can be compensated by adjusting the time stamp of each video frame according to

t_corr = t - t_line * y

where t_line is the readout time for one line in the webcam image, and y is the vertical pixel coordinate. See here for how efficient this correction works: target="_blank">http://galaxy.phy.cmich.edu/~axel/PHY17x/Rolling_Shutter_Correction.mp4 >

At the moment, we use Logger Pro for the video analysis, which has, however, been discontinued, and we are looking into Tracker as a possible replacement. Is there any way this rolling shutter correction could be done within Tracker? Any suggestions would be highly appreciated!

Axel



Re: Correcting the rolling shutter effect with adjusted time values -
Axel Mellinger
2 Posts

Thanks, Doug!  

Yes, we use this experiment to teach the students about sensor artifacts. In Logger Pro, students create a calculated column and use the built-in "derivative()" function, which handles the non-uniform time steps just fine.

Unfortunately I am not a Java coder, but I may be able enlist some help for our Computer Science department. If you could give me some info on implementing a Derivative class, that would be great.

Another option may be to post-process the data using other software. Our University Physics lab already has a Python coding component, so the students could import their data into a Python script and calculate the derivative there. However, for our College Physics lab (which does not have the coding component) I'd have to find a different solution.

Best regards,

Axel



Re: Correcting the rolling shutter effect with adjusted time values -
Douglas Brown Avatar
Douglas Brown
453 Posts

Hi Axel, this could be a great project for a computer science student. The Tracker code is all open source on GitHub at https://github.com/OpenSourcePhysics/tracker.  

The org.opensourcephysics.cabrillo.tracker.Derivative interface has a single method: public Object[] evaluate(Object[] data);

The org.opensourcephysics.cabrillo.tracker.FirstDerivative class is a Derivative implementation that Tracker uses to find velocities. The input data Object[] currently includes function parameters and arrays of x- and y-values but it would be easy to add an array of times as well. The returned Object[] contains arrays with the derivative values.  Doug



Re: Correcting the rolling shutter effect with adjusted time values -
Fernando Ferro
15 Posts

Maybe it would be a good idea to add a column with the PTS of each frame. I can help with the command line in ffmpeg that would produce that column of values.



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book