krontech / pychronos

Python bindings for the Chronos High Speed Camera
GNU General Public License v3.0
3 stars 2 forks source link

Can't set full-frame video to 2x zoom with video's configure method. #50

Closed DDR0 closed 5 years ago

DDR0 commented 5 years ago

Let's say we want to zoom in on the video a bit. The following call would fail with "Invalid display resolution and offset".

api.video.call('configure', {
    'xoff': -400,
    'yoff': -200,
    'hres':1600,
    'vres': 880,
})

This is a problem, and therefore a bug, because we need to be able to zoom in to video to focus for the Chronos 2.1.

oskirby commented 5 years ago

This would not be the correct way to apply video scaling, these parameters to the 'configure' method are used for setting up the output display region on the LCD where video is to be displayed.

To apply a zoom to the video stream, you need to crop the incoming video so that a smaller input resolution gets scaled up to the size available in the output display region. This would be done using the crop and start parameters to the 'livedisplay' method.

oskirby commented 5 years ago

Considering that the input video resolution is tracked dynamically, it's difficult for the GUI to really know at any time exactly how to crop the video to achieve a desired zoom effect. This is somewhat complicated by also needing to know the output resolution to ensure that pixels remain square after scaling.

Perhaps a better design is to replace the cropping parameters with a 'videoZoom' property that performs a digital zoom to the video by doing "whatever cropping is appropriate" and to remove the cropping features from cam-pipeline. However, a simple scalar 'zoom' would also limit the ability of the GUI to request zooming into a specific region of interest (ie: zoom into something other than the centre).

oskirby commented 5 years ago

I'm going to close this issue since improved functionality should now be available using the videoZoom property.