nareshmlx/opencv-pr huggingface dataset:
**File:** platforms/scripts/ABI_compat_generator.py
**Change Type:** modified
**Context:** PR #1386: Some improvements in ABI compatibility checker config generator. - JNI check became optional; Pathes to SDK, NDK and Java API level can be d...

**Code Changes:**
```diff
@@ -47,7 +47,7 @@ def GetClasses(root, prefix):
 
 
 def GetJavaHHeaders():
-    print('\nGenerating JNI headers for Java API ...')
+    print('Generating JNI headers for Java API ...')
 
     javahHeaders = os.path.join(managerDir, 'javah_generated_headers')
     if os.path.exists(javahHeaders):
@@ -70,7 +70,7 @@ def GetJavaHHeaders():
```

Review comment:
No comment on the defaults?
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1276

**Code Changes:**
```diff
                 break;
             }
 
-            if (read_frame_v4l2 (capture))
-                break;
+            int readresult = read_frame_v412(capture);
+            if (readresult == 2){
+                return 0;
+            }
+            if (readresult){
+                return 1;
```

Review comment:
Are you sure? `read_frame_v412` vs `read_frame_v4l2` (via **L**etter).
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1276

**Code Changes:**
```diff
                 break;
             }
 
-            if (read_frame_v4l2 (capture))
-                break;
+            int readresult = read_frame_v412(capture);
+            if (readresult == 2){
+                return 0;
+            }
+            if (readresult){
+                return 1;
```

Review comment:
This code was copied from the bug report. Did I copy a mistake?
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1276

**Code Changes:**
```diff
                 break;
             }
 
-            if (read_frame_v4l2 (capture))
-                break;
+            int readresult = read_frame_v412(capture);
+            if (readresult == 2){
+                return 0;
+            }
+            if (readresult){
+                return 1;
```

Review comment:
This breaks compilation in some configurations, so needs to be fixed.
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1285

**Code Changes:**
```diff
+            if (readresult){
+                return 1;
+            }
         }
     }
 }
@@ -1354,7 +1359,10 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
      {
         // skip first frame. it is often bad -- this is unnotied in traditional apps,
         //  but could be fatal if bad jpeg is enabled
-        mainloop_v4l2(capture);
```

Review comment:
Function should return a default value to avoid "control reaches end of non-void function [-Wreturn-type]" warning
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1276

**Code Changes:**
```diff
                 break;
             }
 
-            if (read_frame_v4l2 (capture))
-                break;
+            int readresult = read_frame_v412(capture);
+            if (readresult == 2){
+                return 0;
+            }
+            if (readresult){
+                return 1;
```

Review comment:
So basically I need to replace the 1 by the small L letter? Will do so in a fix when I got the time. Working on some deadlines for the moment...
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1285

**Code Changes:**
```diff
+            if (readresult){
+                return 1;
+            }
         }
     }
 }
@@ -1354,7 +1359,10 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
      {
         // skip first frame. it is often bad -- this is unnotied in traditional apps,
         //  but could be fatal if bad jpeg is enabled
-        mainloop_v4l2(capture);
```

Review comment:
But you will always get into an if condition right? Could you elaborate more on this?
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1285

**Code Changes:**
```diff
+            if (readresult){
+                return 1;
+            }
         }
     }
 }
@@ -1354,7 +1359,10 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
      {
         // skip first frame. it is often bad -- this is unnotied in traditional apps,
         //  but could be fatal if bad jpeg is enabled
-        mainloop_v4l2(capture);
```

Review comment:
what if `readresult == 0`?
**File:** modules/highgui/src/cap_v4l.cpp
**Change Type:** modified
**Context:** PR #1376: Bugfix 3186: unplugging webcam fix - Fixed the problem suggested in bug 3186 http://code.opencv.org/issues/3186
**Review Line:** 1285

**Code Changes:**
```diff
+            if (readresult){
+                return 1;
+            }
         }
     }
 }
@@ -1354,7 +1359,10 @@ static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) {
      {
         // skip first frame. it is often bad -- this is unnotied in traditional apps,
         //  but could be fatal if bad jpeg is enabled
-        mainloop_v4l2(capture);
```

Review comment:
Actually good point :) Since this was just an attempt to remove some patch from the long list of patches. Any suggestion about which default value should be returned?
**File:** modules/core/src/glob.cpp
**Change Type:** modified
**Context:** PR #1385: Globbing accuracy test fail on Windows RT fixed.

**Code Changes:**
```diff
@@ -91,6 +91,7 @@ namespace
         if(dir->handle == INVALID_HANDLE_VALUE)
         {
             /*closedir will do all cleanup*/
+            delete dir;
             return 0;
         }
         return dir;
@@ -140,6 +141,7 @@ static bool isDir(const cv::String& path, DIR* dir)
 {
```

Review comment:
I don't think `INVALID_FILE_ATTRIBUTES` is possible with `GetFileAttributesEx` (and I don't see anywhere else it may come from).
**File:** modules/core/src/glob.cpp
**Change Type:** modified
**Context:** PR #1385: Globbing accuracy test fail on Windows RT fixed.

**Code Changes:**
```diff
@@ -91,6 +91,7 @@ namespace
         if(dir->handle == INVALID_HANDLE_VALUE)
         {
             /*closedir will do all cleanup*/
+            delete dir;
             return 0;
         }
         return dir;
@@ -140,6 +141,7 @@ static bool isDir(const cv::String& path, DIR* dir)
 {
```

Review comment:
I'd prefer if you used `TRUE` here.
**File:** 3rdparty/libtiff/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1359: LibTIFF Win32 API back-end disabled for Windows RT.
**Review Line:** 85

**Code Changes:**
```diff
 
-if(UNIX)
+if(WIN32 AND NOT HAVE_WINRT)
+  list(APPEND lib_srcs tif_win32.c)
+else()
   list(APPEND lib_srcs tif_unix.c)
 endif()
-
-if(WIN32)
-  list(APPEND lib_srcs tif_win32.c)
-endif(WIN32)
```

Review comment:
I have to say, it's a little weird that the Unix version works for Windows too. But oh well.
**File:** platforms/scripts/cmake_winrt.cmd
**Change Type:** modified
**Context:** PR #1359: LibTIFF Win32 API back-end disabled for Windows RT.
**Review Line:** 9

**Code Changes:**
```diff
@@ -6,4 +6,4 @@ set msvc_path=C:\Program Files\Microsoft Visual Studio 11.0
 call "%msvc_path%\Common7\Tools\VsDevCmd.bat"
 call "%msvc_path%\VC\bin\x86_arm\vcvarsx86_arm.bat"
 
-cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_TIFF=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake  %* ..\..
+cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake  %* ..\..
```

Review comment:
Didn't you just make it so that it can be enabled?
**File:** platforms/scripts/cmake_winrt.cmd
**Change Type:** modified
**Context:** PR #1359: LibTIFF Win32 API back-end disabled for Windows RT.
**Review Line:** 9

**Code Changes:**
```diff
@@ -6,4 +6,4 @@ set msvc_path=C:\Program Files\Microsoft Visual Studio 11.0
 call "%msvc_path%\Common7\Tools\VsDevCmd.bat"
 call "%msvc_path%\VC\bin\x86_arm\vcvarsx86_arm.bat"
 
-cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_TIFF=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake  %* ..\..
+cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake  %* ..\..
```

Review comment:
LibTIFF became enabled by default as for other platforms.
**File:** 3rdparty/libtiff/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1359: LibTIFF Win32 API back-end disabled for Windows RT.
**Review Line:** 85

**Code Changes:**
```diff
 
-if(UNIX)
+if(WIN32 AND NOT HAVE_WINRT)
+  list(APPEND lib_srcs tif_win32.c)
+else()
   list(APPEND lib_srcs tif_unix.c)
 endif()
-
-if(WIN32)
-  list(APPEND lib_srcs tif_win32.c)
-endif(WIN32)
```

Review comment:
tif_unix.c is not good name for a file. It is just implementation for common case that uses standard C functions.
**File:** platforms/scripts/cmake_winrt.cmd
**Change Type:** modified
**Context:** PR #1359: LibTIFF Win32 API back-end disabled for Windows RT.
**Review Line:** 9

**Code Changes:**
```diff
@@ -6,4 +6,4 @@ set msvc_path=C:\Program Files\Microsoft Visual Studio 11.0
 call "%msvc_path%\Common7\Tools\VsDevCmd.bat"
 call "%msvc_path%\VC\bin\x86_arm\vcvarsx86_arm.bat"
 
-cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_TIFF=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake  %* ..\..
+cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake  %* ..\..
```

Review comment:
Oh. Apparently I'm color-blind. Disregard my comment, then.
**File:** samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java
**Change Type:** modified
**Context:** PR #1343: Bug #3238 Android sample image manipulations blinks in non-preview modes fixed.

**Code Changes:**
```diff
@@ -48,28 +48,19 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
     private CameraBridgeViewBase mOpenCvCameraView;
 
     private Size                 mSize0;
-    private Size                 mSizeRgba;
-    private Size                 mSizeRgbaInner;
 
-    private Mat                  mRgba;
-    private Mat                  mGray;
     private Mat                  mIntermediateMat;
```

Review comment:
Why did you remove the `m` here?
**File:** samples/android/image-manipulations/src/org/opencv/samples/imagemanipulations/ImageManipulationsActivity.java
**Change Type:** modified
**Context:** PR #1343: Bug #3238 Android sample image manipulations blinks in non-preview modes fixed.

**Code Changes:**
```diff
@@ -48,28 +48,19 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
     private CameraBridgeViewBase mOpenCvCameraView;
 
     private Size                 mSize0;
-    private Size                 mSizeRgba;
-    private Size                 mSizeRgbaInner;
 
-    private Mat                  mRgba;
-    private Mat                  mGray;
     private Mat                  mIntermediateMat;
```

Review comment:
It looks like a mistake. I'll fix it.
**File:** platforms/android/service/engine/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1338: New Tegra detector with Android 4.3 support for OpenCV Manager added.

**Code Changes:**
```diff
@@ -26,19 +26,32 @@ endif()
 
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/platforms/android/service/engine/.build/${ANDROID_MANIFEST_FILE}"  @ONLY)
 
-link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
+link_directories(
+  "${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib"
+  "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib"
+  "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
+
```

Review comment:
I think it would be better to have something like "if `TEGRA_DETECTOR`, but API level is less then necessary, then print error". It would be less surprising.
**File:** platforms/android/service/engine/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1338: New Tegra detector with Android 4.3 support for OpenCV Manager added.

**Code Changes:**
```diff
@@ -26,19 +26,32 @@ endif()
 
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/platforms/android/service/engine/.build/${ANDROID_MANIFEST_FILE}"  @ONLY)
 
-link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
+link_directories(
+  "${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib"
+  "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib"
+  "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
+
```

Review comment:
What's this for? You're passing the path to the detector in the `TEGRA_DETECTOR` variable, right?
**File:** doc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -67,9 +67,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
   set(OPENCV_DOC_DEPS conf.py ${OPENCV_FILES_REF} ${OPENCV_FILES_REF_PICT}
            ${OPENCV_FILES_UG} ${OPENCV_FILES_TUT} ${OPENCV_FILES_TUT_PICT})
 
+  set(BUILD_PLANTUML "")
+  if(PLANTUML)
+    set(BUILD_PLANTUML "-tplantuml")
+  endif()
+
   if(PDFLATEX_COMPILER)
```

Review comment:
If I do not have plantum and its extension for sphinks, I could not build documentation at all. I think it is not good idea. It must work in the same way as with Tex. Docs build is ok, but no Tex - no formulas.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -840,6 +840,7 @@ if(BUILD_DOCS)
   endif()
   status("    Sphinx:"              HAVE_SPHINX              THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
   status("    PdfLaTeX compiler:"   PDFLATEX_COMPILER        THEN "${PDFLATEX_COMPILER}" ELSE NO)
+  status("    PlantUML:"            PLANTUML                 THEN "${PLANTUML}" ELSE NO)
 endif()
 
 # ========================== samples and tests ==========================
```

Review comment:
Could you align these lines with the ones above? You also have extra spaces inside the quotes.
**File:** doc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -67,9 +67,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
   set(OPENCV_DOC_DEPS conf.py ${OPENCV_FILES_REF} ${OPENCV_FILES_REF_PICT}
            ${OPENCV_FILES_UG} ${OPENCV_FILES_TUT} ${OPENCV_FILES_TUT_PICT})
 
+  set(BUILD_PLANTUML "")
+  if(PLANTUML)
+    set(BUILD_PLANTUML "-tplantuml")
+  endif()
+
   if(PDFLATEX_COMPILER)
```

Review comment:
I don't think you ever cache this variable.
**File:** doc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -67,9 +67,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
   set(OPENCV_DOC_DEPS conf.py ${OPENCV_FILES_REF} ${OPENCV_FILES_REF_PICT}
            ${OPENCV_FILES_UG} ${OPENCV_FILES_TUT} ${OPENCV_FILES_TUT_PICT})
 
+  set(BUILD_PLANTUML "")
+  if(PLANTUML)
+    set(BUILD_PLANTUML "-tplantuml")
+  endif()
+
   if(PDFLATEX_COMPILER)
```

Review comment:
This should be in cmake/OpenCVDetectPython.cmake within the `if(BUILD_DOCS)` block.
**File:** doc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -67,9 +67,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
   set(OPENCV_DOC_DEPS conf.py ${OPENCV_FILES_REF} ${OPENCV_FILES_REF_PICT}
            ${OPENCV_FILES_UG} ${OPENCV_FILES_TUT} ${OPENCV_FILES_TUT_PICT})
 
+  set(BUILD_PLANTUML "")
+  if(PLANTUML)
+    set(BUILD_PLANTUML "-tplantuml")
+  endif()
+
   if(PDFLATEX_COMPILER)
```

Review comment:
The `tag_` prefix is redundant, the -t option can't specify anything other than tags.
**File:** doc/conf.py
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -28,6 +28,16 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv', 'sphinx.ext.doctest']
+
+have_plantuml_ext = False
+if tags.has('plantuml'):
+  try:
+    import sphinxcontrib.plantuml
+    extensions.append("sphinxcontrib.plantuml")
```

Review comment:
`ImportError`.
**File:** doc/conf.py
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -28,6 +28,16 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv', 'sphinx.ext.doctest']
+
+have_plantuml_ext = False
+if tags.has('plantuml'):
+  try:
+    import sphinxcontrib.plantuml
+    extensions.append("sphinxcontrib.plantuml")
```

Review comment:
It would be better if the message also said what the consequences of this are.
**File:** doc/conf.py
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -28,6 +28,16 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv', 'sphinx.ext.doctest']
+
+have_plantuml_ext = False
+if tags.has('plantuml'):
+  try:
+    import sphinxcontrib.plantuml
+    extensions.append("sphinxcontrib.plantuml")
```

Review comment:
Redundant semicolon.
**File:** doc/conf.py
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -28,6 +28,16 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv', 'sphinx.ext.doctest']
+
+have_plantuml_ext = False
+if tags.has('plantuml'):
+  try:
+    import sphinxcontrib.plantuml
+    extensions.append("sphinxcontrib.plantuml")
```

Review comment:
The first condition is redundant. And please don't compare with `False`, you have `not`.
**File:** doc/conf.py
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -28,6 +28,16 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv', 'sphinx.ext.doctest']
+
+have_plantuml_ext = False
+if tags.has('plantuml'):
+  try:
+    import sphinxcontrib.plantuml
+    extensions.append("sphinxcontrib.plantuml")
```

Review comment:
You cloud also use imp.find_module instead of import directly
**File:** doc/conf.py
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -28,6 +28,16 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'ocv', 'sphinx.ext.doctest']
+
+have_plantuml_ext = False
+if tags.has('plantuml'):
+  try:
+    import sphinxcontrib.plantuml
+    extensions.append("sphinxcontrib.plantuml")
```

Review comment:
It is not possible use imp.find_module because sphinxcontrib is not a python package (it hasn't **init**)
**File:** doc/CMakeLists.txt
**Change Type:** modified
**Context:** PR #1330: Plantuml - Documentation here: https://pypi.python.org/pypi/sphinxcontrib-plantuml In order to use plantuml extension, it is needed to modif...

**Code Changes:**
```diff
@@ -67,9 +67,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
   set(OPENCV_DOC_DEPS conf.py ${OPENCV_FILES_REF} ${OPENCV_FILES_REF_PICT}
            ${OPENCV_FILES_UG} ${OPENCV_FILES_TUT} ${OPENCV_FILES_TUT_PICT})
 
+  set(BUILD_PLANTUML "")
+  if(PLANTUML)
+    set(BUILD_PLANTUML "-tplantuml")
+  endif()
+
   if(PDFLATEX_COMPILER)
```

Review comment:
Please, move this into cmake/OpenCVDetectPython.cmake, alongside the search for `sphinx-build`. Also, do you really have to uncache the variable? I mean, it's specifically cached so that you don't have to repeat the search every time you rerun CMake.