Image adjustments (brightness, contrast, etc)
Video stream image adjustments
When the frame grabber is enabled, the brightness, contrast, hue and saturation of the video stream can be adjusted with:
These properties affect the whole video stream, therefore the captured frames and the recorded streams are affected too.
On the other hand, each of these image processing operations requires CPU when the corresponding property is "in use" (when its value is <> 0).
Grayscale and inverted colors
When the frame grabber is enabled:
- enable VideoProcessing_GrayScale to convert the video stream to grayscale,
- enable VideoProcessing_InvertColors to invert the colors.
Image adjustments and the OnFrameBitmap event
By default (OverlayAfterTransform = false), the brightness, contrast, hue, saturation, grayscale and inverted colors adjustments are applied after the OnFrameBitmap event: the bitmap received by the event is the frame before these adjustments, while the frame passed downstream (video window, recording) is adjusted.
To receive the adjusted frame in OnFrameBitmap, e.g. when the application displays this bitmap itself (WPF Image control, etc.), enable OverlayAfterTransform before starting the preview:
VideoGrabber.FrameGrabber = TFrameGrabber.fg_PreviewStream;
VideoGrabber.OverlayAfterTransform = true;
VideoGrabber.OnFrameBitmap += VideoGrabber_OnFrameBitmap;
VideoGrabber.StartPreview();
// then, at any time:
VideoGrabber.VideoProcessing_Brightness = 40;
VideoGrabber.VideoProcessing_Contrast = 20;
VideoGrabber.VideoProcessing_GrayScale = true;
With OverlayAfterTransform = true, the text and image overlays are drawn after the adjustments and keep their colors (e.g. they are not converted to grayscale). See Overlays before or after transforms.
Pixellization
To pixellize the video frames, assign to VideoProcessing_Pixellization a value greater than 1.
VMR9 display image adjustments
Unlike the video stream image adjustments above, which require CPU, the VMR9 video renderer can adjust the brightness, contrast, hue and saturation at the graphics card level.
This processing affects only the display, not the captured frames or the recorded streams.
The corresponding functions are:
- GetVMR9ImageAdjustmentBounds: returns the bounds of a setting (e.g. the brightness), useful e.g. to set up a trackbar,
- IsVMR9ImageAdjustmentAvailable: returns true if a setting (e.g. the brightness) is available,
- SetVMR9ImageAdjustmentValue: sets the value of a setting (e.g. the brightness).