This example shows how to determine whether video frames are in focus by using the ratio of the high spatial frequency content to the low spatial frequency content within a region of interest (ROI). When this ratio is high, the video is in focus. When this ratio is low, the video is out of focus.
The following figure shows the Video Focus Assessment model:
This example shows a video sequence that is moving in and out of focus. The model uses the Draw Shapes block to highlight an ROI on the video frames and the Insert Text block to indicate whether or not the video is in focus.
The Relative Focus window displays a plot of the ratio of the high spatial frequency content to the low spatial frequency content within the ROI. This ratio is an indication of the relative focus adjustment of the video camera. When this ratio is high, the video is in focus. When this ratio is low, the video is out of focus. Although it is possible to judge the relative focus of a camera with respect to the video using 2-D filters, the approach used in this example enables you to see the relationship between the high spatial frequency content of the video and its focus.
The FFT Data window shows the 2-D FFT data within the ROI.
Windows-only example models might contain compressed multimedia files or To Video Display blocks, both of which are only supported on Windows platforms. The To Video Display block supports code generation, and its performance is optimized for Windows.