Skip to content

Cropping and zooming

Cropping It is possible to easily define an area of the video source that will be cropped.

Trackbar bounds

When trackbars are used to move the cropped area over the video window, the maximum position for these trackbars are returned by the Cropping_XMax and Cropping_YMax properties. The best location to update the trackbar bounds is from the OnResizeVideo event. E.g.:

procedure TForm1.VideoGrabberResizeVideo(Sender: TObject; SourceWidth, SourceHeight: Integer); begin TrackBarX.Min:= 0; TrackBarX.Position:= VideoGrabber.Cropping_X; TrackBarX.Max:= VideoGrabber.Cropping_XMax;

TrackBarY.Min:= 0; TrackBarY.Position:= VideoGrabber.Cropping_Y; TrackBarY.Max:= VideoGrabber.Cropping_YMax; end; Zooming It is possible to zoom a cropped area as follows:

Note: if the zooming area is near an edge of the video frame, when changing Cropping_Zoom, the video image will "move" to the opposite direction.

To prevent this problem, enable the Cropping_Outbounds property. This will keep the zooming location fixed against the edges, however in counterpart a black border will appear when Cropping_X and Cropping_Y are near the edges.