<< return to Vizycam.com

User Tools

Site Tools


wiki:motionscope_app

This is an old revision of the document!


MotionScope

We wrote MotionScope after asking our physics teacher friends what tools they would like to have available to teach and/or study the concepts of projectile motion – concepts such as velocity, acceleration, momentum, and energy. MotionScope uses Vizy’s camera to capture the motion of moving objects. It can accurately determine the position of each object in each frame by using image processing. It can then measure the velocity and acceleration of each object across each frame. This information is presented to the user via interactive graphs within their web browser.

image_663.jpg

Quickstart

To run MotionScope, click on Apps/Examples in the top-right menu and scroll over to MotionScope in Apps, then click on Run.

Choose a well-lit setting for your Vizy and point your Vizy level such that it is looking straight ahead, neither up nor down. Find an ordinary object like a ball, but anything you can easily toss is good.

Camera setup

In general, you want to set the camera at a high framerate and low shutter speed to minimize motion blur, which can make it difficult for Vizy to accurately determine the position of your object(s) in each frame. But there is a problem with lowering the shutter speed: it can create dark, under-exposed images. You can counter this by increasing the brightness slider and/or using an environment that’s well-lit.

image_666.jpg

Here's our recommended camera setup that minimizes motion blur:

  • Choose 768x432x10bpp mode. This will provide the widest possible field-of-view.
  • Turn off auto shutter by clicking on Auto-shutter.
  • Choose a framerate of 50 fps.
  • Adjust Shutter-speed to the lowest value possible while avoiding under-exposure (dark images).
  • Increase Brightness to brighten the image if necessary. Avoid setting the brightness to more than 95%, which may introduce too much image noise.

Capturing footage

First, we need to capture footage of the motion we want to analyze. Click on the Capture tab.

image_687.jpg

Press Record and toss the object in front of Vizy. Press Stop. Now examine the footage that you just took by pressing Play. You can pause the playback and look at individual frames by either grabbing the time slider or clicking on the prev/next frame buttons. For example, a blurry frame will look similar to this:

image_690.jpg

Here’s a decent frame. It has some motion blur, but not too much:

image_667.jpg

If your frame is blurry, go to the Camera tab and reduce the shutter-speed and increase the brightness if needed. Given the amount of light in the environment, it may not be possible to reduce the motion blur to acceptable levels while also maintaining image brightness. If this is the case you can either:

  • Move the object farther away from Vizy’s lens. This will reduce the “image speed” (number of pixels traversed per second) of the object. For example, doubling the distance from Vizy will halve the image speed.
  • Introduce more lighting into the environment. This will always improve motion blur by allowing you to reduce the shutter-speed.

Processing

Now that you have footage without excessive motion blur, click on the Process tab. Vizy should automatically start processing the frames in an effort to find your object in each frame.

image_671.jpg

After it’s done, Vizy will automatically switch to the Analyze tab so you can see the motion of your object rendered in all its glory.

Analyzing

In the Analyze tab, there are several adjustments, controls, and graphs.

image_675.jpg

Show

Let’s start by playing with the Show control. You can select whether you want to show just the objects or the objects with points, lines, and arrows. The points, lines, and arrows are drawn on top of the video.

image_674.jpg

Time

Oftentimes the beginning and end of the footage contain data that are inaccurate or unwanted. In our example, as the ball comes into the frame on the left, the data points are somewhat inaccurate because the ball is cropped by the edge of the frame.

image_676.jpg

By adjusting the Time slider on the left we can remove these data points:

image_677.jpg

Similarly, the end of our footage has the ball rolling back into frame. We can remove these data points by adjusting the Time slider on the right:

image_678.jpg

Spacing

You can choose the spacing of the samples by adjusting the Spacing slider. By increasing the spacing, the velocity and acceleration measurements are averaged over longer periods of time, and measurement noise can be reduced.

image_679.jpg

Graph selection

You can also choose the graphs you wish to view by selecting the selector above each graph pair. Position, velocity, and acceleration graphs for x and y are chosen by default. Direction and magnitude graphs are available for velocity and acceleration.

image_680.jpg

Hovering

With your mouse pointer, hover over the data points either on the video or the graphs. You will see markers that will show you the same data points in the video and graphs. This is useful if you, for example, wanted to get the velocity and acceleration of a particular point.

image_681.jpg

Units and calibration

Vizy will present its results in pixel units. If you want the data that Vizy presents to be in different, more useful units such as meters, you will need to give Vizy a hint by telling it how many pixels there are in a meter.

Choose Meters in the Distance units selector. Then click on the Calibrate button that appears.

image_691.jpg

Using the mouse pointer, click and drag a line that equals 1 meter.

image_685.jpg

In our example, the tile on the floor provides markings that we can use to help draw a line that's 1 meter in length. Note, we should draw a line that's in the same plane of motion as our object(s). After drawing the calibration line, MotionScope will then present its data in meters, meters/second, etc. Alternatively, you can choose different calibration distances other than 1 meter. You could choose 2 meters or 0.31 meters by changing the value in the text box. Or you could choose different units (centimeters, feet) by selecting in Distance units.

Saving/loading

You can save your project to SD card so you don’t lose your data. Future versions of MotionScope will allow you to name the project and manage the project files.

Motion extraction

MotionScope is able to extract motion by using the simple technique of frame differencing. That is, MotionScope creates a background image and then subtracts this image from all frames in the sequence. It then performs thresholding on the frame differences. If the difference exceeds a threshold, it’s assumed that there was motion in that part of the frame.

Adjusting the motion threshold

In the Process tab, if you click on the + button, the Motion threshold slider is revealed. You can seek to any part of the video with the time slider, and it will show you which parts of the image will be considered to be in motion. You can adjust the Motion threshold slider to find a good threshold that captures the motion you want to capture.

image_686.jpg

Changing the motion extracting algorithm

For advanced users who don’t mind doing some Python programming, you can customize MotionScope’s motion extracting algorithm to fit your needs better. For example, If you wanted to track the motion of a trebuchet you'd likely want to use visual clues other than motion (e.g. hue, structure) to extract the motion of the payload (only) as it's gaining speed and being flung. Check out simplemotion.py in the source directory (/home/pi/vizy/apps/motionscope).

Motion parallel to the image plane

MotionScope works best with any motion that’s parallel to the image plane. Motion that’s coming toward or moving away from Vizy will not be fully captured. That is, imagine Vizy looking at a wall straight-on. Any motion that’s moving parallel to the wall will be captured. This wall is shown as the “plane of motion” below:

image_662.jpg

For example, motion directed 45 degrees with respect to the wall won't be fully captured. About 70% of the motion will be captured, 30% will be lost. (Cosine of 45 degrees is 0.7071 or ~70%.) Similarly, almost all motion directed 90 degrees with respect to the wall will be lost.

wiki/motionscope_app.1645113729.txt.gz · Last modified: 2022/02/17 10:02 by vizycam