From 08271e5591770e0c1efaaff839db6da03401593b Mon Sep 17 00:00:00 2001 From: Igor Murzov Date: Tue, 10 Nov 2020 15:36:13 +0300 Subject: [PATCH] Fix code snippets inclusion into video tutorials Code snippets need a section marked with ### above to render properly --- .../background_subtraction/background_subtraction.markdown | 3 +-- .../video-input-psnr-ssim/video_input_psnr_ssim.markdown | 13 ++++++------- doc/tutorials/videoio/video-write/video_write.markdown | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/doc/tutorials/video/background_subtraction/background_subtraction.markdown b/doc/tutorials/video/background_subtraction/background_subtraction.markdown index 91dbd02..267acc6 100644 --- a/doc/tutorials/video/background_subtraction/background_subtraction.markdown +++ b/doc/tutorials/video/background_subtraction/background_subtraction.markdown @@ -32,8 +32,7 @@ In this tutorial you will learn how to: -# Create and update the background model by using @ref cv::BackgroundSubtractor class; -# Get and show the foreground mask by using @ref cv::imshow ; -Code ----- +### Code In the following you can find the source code. We will let the user choose to process either a video file or a sequence of images. diff --git a/doc/tutorials/videoio/video-input-psnr-ssim/video_input_psnr_ssim.markdown b/doc/tutorials/videoio/video-input-psnr-ssim/video_input_psnr_ssim.markdown index 2cd0382..08cc596 100644 --- a/doc/tutorials/videoio/video-input-psnr-ssim/video_input_psnr_ssim.markdown +++ b/doc/tutorials/videoio/video-input-psnr-ssim/video_input_psnr_ssim.markdown @@ -126,8 +126,7 @@ captRefrnc.set(CAP_PROP_POS_FRAMES, 10); // go to the 10th frame of the video For properties you can read and change look into the documentation of the @ref cv::VideoCapture::get and @ref cv::VideoCapture::set functions. -Image similarity - PSNR and SSIM --------------------------------- +### Image similarity - PSNR and SSIM We want to check just how imperceptible our video converting operation went, therefore we need a system to check frame by frame the similarity or differences. The most common algorithm used for @@ -145,15 +144,15 @@ Here the \f$MAX_I\f$ is the maximum valid value for a pixel. In case of the simp per pixel per channel this is 255. When two images are the same the MSE will give zero, resulting in an invalid divide by zero operation in the PSNR formula. In this case the PSNR is undefined and as we'll need to handle this case separately. The transition to a logarithmic scale is made because the -pixel values have a very wide dynamic range. All this translated to OpenCV and a C++ function looks +pixel values have a very wide dynamic range. All this translated to OpenCV and a function looks like: @add_toggle_cpp -@include cpp/tutorial_code/videoio/video-input-psnr-ssim/video-input-psnr-ssim.cpp get-psnr +@snippet cpp/tutorial_code/videoio/video-input-psnr-ssim/video-input-psnr-ssim.cpp get-psnr @end_toggle @add_toggle_python -@include samples/python/tutorial_code/videoio/video-input-psnr-ssim.py get-psnr +@snippet samples/python/tutorial_code/videoio/video-input-psnr-ssim.py get-psnr @end_toggle Typically result values are anywhere between 30 and 50 for video compression, where higher is @@ -172,11 +171,11 @@ implementation below. Transactions on Image Processing, vol. 13, no. 4, pp. 600-612, Apr. 2004." article. @add_toggle_cpp -@include cpp/tutorial_code/videoio/video-input-psnr-ssim/video-input-psnr-ssim.cpp get-mssim +@snippet samples/cpp/tutorial_code/videoio/video-input-psnr-ssim/video-input-psnr-ssim.cpp get-mssim @end_toggle @add_toggle_python -@include samples/python/tutorial_code/videoio/video-input-psnr-ssim.py get-mssim +@snippet samples/python/tutorial_code/videoio/video-input-psnr-ssim.py get-mssim @end_toggle This will return a similarity index for each channel of the image. This value is between zero and diff --git a/doc/tutorials/videoio/video-write/video_write.markdown b/doc/tutorials/videoio/video-write/video_write.markdown index feafc44..b811075 100644 --- a/doc/tutorials/videoio/video-write/video_write.markdown +++ b/doc/tutorials/videoio/video-write/video_write.markdown @@ -63,7 +63,7 @@ specialized video writing libraries such as *FFMpeg* or codecs as *HuffYUV*, *Co an alternative, create the video track with OpenCV and expand it with sound tracks or convert it to other formats by using video manipulation programs such as *VirtualDub* or *AviSynth*. -The *VideoWriter* class +The VideoWriter class ----------------------- The content written here builds on the assumption you -- 2.7.4