Skip to content

Cropping Movies

Allen Lee edited this page Jun 27, 2018 · 7 revisions

Background

APT faces two problems as relates to movie cropping.

The first problem is that a user may acquire movies with different image sizes/resolutions. This may be relatively uncommon for a given scientific experiment, but it has already occurred during development and testing. One can also imagine applications where videos from diverse sources are incorporated into a single project.

CPR tracking can accept image stacks with varying sizes, with the implicit assumption that the target is positioned/sized similarly (in relative sense) within all all images. Other trackers however, including Deep trackers, may require all images to be the same size.

The second problem is that for some trackers, tracking performance can be degraded in scenarios where target positioning varies widely across movies. This can occur even if all the movies have the same image size.

Note that these issues arise only for projects without body-centered tracking (trx). When trx are available, videos are currently cropped to a fixed size around the given trajectories.

Movie Cropping in APT

APT's Cropping functionality addresses these problems by letting the user specify a rectangular ROI for every movie. For a single-view project, all ROIs must have the same size, ie (width,height); however they may be located anywhere that fits within the movie frame. Different movies need not have the same raw image size. Trackers only see the cropped movies, with suitably adjusted labels.

In multiview projects, ROI sizes are allowed to vary across views, ie each view may have a uniquely-sized ROI. Within a given view however, all ROIs must again have the same size.

Crop Mode

To specify movie crops in APT, enter "Crop Mode" by selecting File>Crop Mode. A blue indicator will come on, and different buttons will appear in the main UI. If no crops have been specified in the project, press the "Set/Adjust Crop Size" button. This will initialize default crops for all movies in the project.

Click-drag to adjust the size and location of the rectangular crop region. You may browse or navigate movie frames via the play buttons, frame editbox, frame slider, or arrow keys in the usual way. If you are happy with the crop size, press "Done Adjusting" to lock the crop size. This only locks the crop sizes; you may still adjust the crop positions.

Important points to remember:

  1. If a project has crops specified, then every movie (and every view, in a multiview project) has a crop rectangle. To navigate movies, use the MovieManager as usual, and set/check that the crops are as desired for every movie.
  2. All crops must have the same size, but not necessarily the same location. If you set/adjust the crop size in one movie, then the crops in all other movies are resized accordingly. In multiview projects, this fixed crop size is per-view.

When you are done adjusting your crops, click File>Crop Mode again to leave crop mode. APT will display only the cropped movies.

Note that if your project has GT movies, they will also have crops, with sizes that match the other/regular movies. To set/adjust the crops for GT movies, navigate to them using the MovieManager as usual.

For a fun sanity check on your crops, run the following:

lObj.cropMontage

Tracking with Crops

Whenever cropping information is specified in a project, Training and Tracking operate only on cropped images. The raw images are never seen by tracking modules. The results should be exactly as if the raw movies had been cropped before adding them to APT.

Future

  • Ability to re-use existing crops across multiple movies, either within a project or for tracking new movies.
Clone this wiki locally