Shifting frames horizontally and vertically

From edgertronic high speed video camera
Jump to navigation Jump to search

A beta release supports setting a horizontal and vertical offset. The feature will be merged into mainline edgertronic software once we improve the usability challenges.

We have made the beta release available, follow the software update steps to try out the feature. The beta release passes all the automated tested, but we did not run the full suite of manual tests yet. Let us know what you think. You can always update the camera software back to the latest released code.

The implementation may change as we receive suggestions on how to improve the horizontal and vertical offset feature.


Imagine an edgertronic camera mounted on a pole or in some rafters where it takes a man-lift to adjust where the camera is pointing. If the camera isn't pointing at exactly the correct location, a larger video frame will need to be captured, potentially reducing the maximum available capture frame rate and increasing the amount of time it takes to encode and save a captured video. Being able to shift the frame horizontally and vertically allows you to digitally pan and tilt the camera without physically touching your edgertronic camera. This works when the horizontal and/or vertical resolution settings are less than the maximum supported by the camera.

For example, for the edgertronic camera model SC1, the maximum horizontal resolution is 1280 pixels, so the horizontal offset at 720p (1280 x 720) is always 0 and can not be changed. The SC1 vertical resolution is 1024, so at 720p there are unused rows of pixels above and below the centered image. The number of used rows above is 152 (1024 - 720 divided by 2) and below is also 152 since the capture region is centered in the sensor. Therefore, the vertical offset range for 720p on an SC1 is -152 to 152.

What is important - frame rate or field of view

In a conventional, fixed frame rate, camera - shifting a smaller frame around the full field of view is straight forward. You could imagine a user interface where you see the full field of view and you simply draw a rectangle for the portion of interest. With a high speed camera, changing the number of pixels captured can effect your capture frame rate. Because of this "third dimension" of interaction, setting the frame rate, horizontal and vertical resolutions, and the horizontal and vertical offsets is more challenging.

The user interface is setup with the assumption that your settings are close, and you just want to "nudge" the camera a bit to move the field of view. The settings you change are the horizontal and vertical offsets, which are in units of pixels, supporting positive or negative offset values, and the values are used to nudge the field of view from the normally centered position on the camera's full resolution image.

Web user interface

Figure 1: Settings modal

The web UI settings modal, shown in figure 1, includes Horizontal Offset and Vertical Offset fields to allow you to enter the requested value with the right hand column showing that actual offset that will be used. You need to exit the settings modal by clicking outside the settings box in order to see how the field of view changes based on your offset values.

Horizontal offset moves from left to right as you increase the value. Vertical increases moves from top to bottom as you increase the value. Or, stated another way, a negative horizontal offset moves the field of view to the left, while a positive value moves it to the right. Similarly, a negative vertical offset moves the field of view up, while a positive value move it down.

Figure 2 shows and example SC1 full 1280 x 1024 resolution field of view, with the field of view for figures 3, 4, and 5 outlined in pink, yellow and cyan rectangles. Figures 3, 4, and 5 all have a resolution of 640 x 512 with different offsets. Figure 3 has offsets (0, 0) picking the center from the full field of view. Figure 4 has offsets (-216, -220), effectively nudging the field of view up and to the left. Figure 5 has offset (120, -100) nudging the field of view down and to the left.

Click on any of the images for an enlarged view.

Figure 2: Full field of view
Figure 3: 640 x 512 with offsets (0, 0)
Figure 4: 640 x 512 with offsets (-216, -220)
Figure 5: 640 x 512 with offsets (120, -100)

Implementation details

To get the maximum possible video capture frame rate, many ingenious design ideas are incorporated into the camera. Some of these design choices effect horizontal and vertical offset capabilities.

SC1 24 pixels 2 pixels

As a general rule, to nudge the field of view, you must change the H/V offset values by at least the factor show in the table above. For example, on an SC1 increasing or decreasing the horizontal offset value by 10 will likely have no effect. You much change the current horizontal offset value by at least 24. Stated another way, useful horizontal offset values are ... -48, -24, 0, 24, 48, ...

CAMAPI support

During the request/allowed negotiation using the CAMAPI configure_camera() method, include the dictionary entries requested_horizontal_offset and requested_vertical_offset. The response will indicate the actual offset values to use. You need to invoke the CAMAPI run() method passing the same request dictionary for the allowed offset values to be activated. Once activated, the web UI live view window will show you the actual field of view being captured by the camera.

Frame shifting and sub-sampling

When sub-sampling is enabled, the horizontal and vertical offset values are ignored. You can either have frame shifting or sub-sampling enabled, but not both at the same time.