The following issues were found

samples/winrt/ImageManipulations/MainPage.xaml.h
4 issues
syntax error
Error

Line: 58

              
    protected:
        virtual void LoadState(Platform::Object^ navigationParameter,
            Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
        virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;

    internal:
        property bool AutoSizeInputSectionWhenSnapped
        {

            

Reported by Cppcheck.

syntax error
Error

Line: 58

              
    protected:
        virtual void LoadState(Platform::Object^ navigationParameter,
            Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
        virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;

    internal:
        property bool AutoSizeInputSectionWhenSnapped
        {

            

Reported by Cppcheck.

syntax error
Error

Line: 58

              
    protected:
        virtual void LoadState(Platform::Object^ navigationParameter,
            Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
        virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;

    internal:
        property bool AutoSizeInputSectionWhenSnapped
        {

            

Reported by Cppcheck.

syntax error
Error

Line: 58

              
    protected:
        virtual void LoadState(Platform::Object^ navigationParameter,
            Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
        virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;

    internal:
        property bool AutoSizeInputSectionWhenSnapped
        {

            

Reported by Cppcheck.

samples/python/tutorial_code/ShapeDescriptors/point_polygon_test/pointPolygonTest_demo.py
4 issues
Unable to import 'cv2'
Error

Line: 3 Column: 1

              from __future__ import print_function
from __future__ import division
import cv2 as cv
import numpy as np

# Create an image
r = 100
src = np.zeros((4*r, 4*r), dtype=np.uint8)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import print_function
from __future__ import division
import cv2 as cv
import numpy as np

# Create an image
r = 100
src = np.zeros((4*r, 4*r), dtype=np.uint8)


            

Reported by Pylint.

Module name "pointPolygonTest_demo" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              from __future__ import print_function
from __future__ import division
import cv2 as cv
import numpy as np

# Create an image
r = 100
src = np.zeros((4*r, 4*r), dtype=np.uint8)


            

Reported by Pylint.

Constant name "r" doesn't conform to UPPER_CASE naming style
Error

Line: 7 Column: 1

              import numpy as np

# Create an image
r = 100
src = np.zeros((4*r, 4*r), dtype=np.uint8)

# Create a sequence of points to make a contour
vert = [None]*6
vert[0] = (3*r//2, int(1.34*r))

            

Reported by Pylint.

samples/python/tutorial_code/ImgTrans/HoughCircle/hough_circle.py
4 issues
Unable to import 'cv2'
Error

Line: 2 Column: 1

              import sys
import cv2 as cv
import numpy as np


def main(argv):
    ## [load]
    default_file = 'smarties.png'
    filename = argv[0] if len(argv) > 0 else default_file

            

Reported by Pylint.

Value 'circles' is unsubscriptable
Error

Line: 41 Column: 18

                  ## [draw]
    if circles is not None:
        circles = np.uint16(np.around(circles))
        for i in circles[0, :]:
            center = (i[0], i[1])
            # circle center
            cv.circle(src, center, 1, (0, 100, 100), 3)
            # circle outline
            radius = i[2]

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys
import cv2 as cv
import numpy as np


def main(argv):
    ## [load]
    default_file = 'smarties.png'
    filename = argv[0] if len(argv) > 0 else default_file

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              import numpy as np


def main(argv):
    ## [load]
    default_file = 'smarties.png'
    filename = argv[0] if len(argv) > 0 else default_file

    # Loads an image

            

Reported by Pylint.

samples/python/tutorial_code/imgProc/Pyramids/pyramids.py
4 issues
Unable to import 'cv2'
Error

Line: 2 Column: 1

              import sys
import cv2 as cv


def main(argv):
    print("""
    Zoom In-Out demo
    ------------------
    * [i] -> Zoom [i]n

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys
import cv2 as cv


def main(argv):
    print("""
    Zoom In-Out demo
    ------------------
    * [i] -> Zoom [i]n

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              import cv2 as cv


def main(argv):
    print("""
    Zoom In-Out demo
    ------------------
    * [i] -> Zoom [i]n
    * [o] -> Zoom [o]ut

            

Reported by Pylint.

Unnecessary "elif" after "break"
Error

Line: 33 Column: 9

                      ## [show_image]
        k = cv.waitKey(0)

        if k == 27:
            break
            ## [pyrup]
        elif chr(k) == 'i':
            src = cv.pyrUp(src, dstsize=(2 * cols, 2 * rows))
            print ('** Zoom In: Image x 2')

            

Reported by Pylint.

samples/python/tutorial_code/imgProc/HitMiss/hit_miss.py
4 issues
Unable to import 'cv2'
Error

Line: 1 Column: 1

              import cv2 as cv
import numpy as np

input_image = np.array((
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 255, 255, 255, 0, 0, 0, 255],
    [0, 255, 255, 255, 0, 0, 0, 0],
    [0, 255, 255, 255, 0, 255, 0, 0],
    [0, 0, 255, 0, 0, 0, 0, 0],

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import cv2 as cv
import numpy as np

input_image = np.array((
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 255, 255, 255, 0, 0, 0, 255],
    [0, 255, 255, 255, 0, 0, 0, 0],
    [0, 255, 255, 255, 0, 255, 0, 0],
    [0, 0, 255, 0, 0, 0, 0, 0],

            

Reported by Pylint.

Constant name "rate" doesn't conform to UPPER_CASE naming style
Error

Line: 21 Column: 1

              
output_image = cv.morphologyEx(input_image, cv.MORPH_HITMISS, kernel)

rate = 50
kernel = (kernel + 1) * 127
kernel = np.uint8(kernel)

kernel = cv.resize(kernel, None, fx = rate, fy = rate, interpolation = cv.INTER_NEAREST)
cv.imshow("kernel", kernel)

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 33 Column: 1

              cv.imshow("Original", input_image)
cv.moveWindow("Original", 0, 200)

output_image = cv.resize(output_image, None , fx = rate, fy = rate, interpolation = cv.INTER_NEAREST)
cv.imshow("Hit or Miss", output_image)
cv.moveWindow("Hit or Miss", 500, 200)

cv.waitKey(0)
cv.destroyAllWindows()

            

Reported by Pylint.

platforms/winpack_dldt/2021.3/build.config.py
3 issues
Undefined variable 'os'
Error

Line: 1 Column: 1

              os.environ['CI_BUILD_NUMBER'] = '2021.3.0-opencv_winpack_dldt'

cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'

            

Reported by Pylint.

Undefined variable 'cmake_vars'
Error

Line: 3 Column: 1

              os.environ['CI_BUILD_NUMBER'] = '2021.3.0-opencv_winpack_dldt'

cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              os.environ['CI_BUILD_NUMBER'] = '2021.3.0-opencv_winpack_dldt'

cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'

            

Reported by Pylint.

modules/imgproc/src/pyramids.cpp
3 issues
syntax error
Error

Line: 484

                      v_rshr_pack_store<8>(dst + x, t0);
        x += v_uint16::nlanes;
    }
    typedef int CV_DECL_ALIGNED(1) unaligned_int;
    for ( ; x <= width - v_int32x4::nlanes; x += v_int32x4::nlanes)
    {
        v_int32x4 r0, r1, r2, r3, r4, t0;
        r0 = v_load(row0 + x);
        r1 = v_load(row1 + x);

            

Reported by Cppcheck.

Possible null pointer dereference: func
Error

Line: 1302 CWE codes: 476

                  else
        CV_Error( CV_StsUnsupportedFormat, "" );

    func( src, dst, borderType );
}


#if defined(HAVE_IPP)
namespace cv

            

Reported by Cppcheck.

Possible null pointer dereference: func
Error

Line: 1405 CWE codes: 476

                  else
        CV_Error( CV_StsUnsupportedFormat, "" );

    func( src, dst, borderType );
}


#ifdef HAVE_IPP
namespace cv

            

Reported by Cppcheck.

modules/python/package/cv2/load_config_py2.py
3 issues
Undefined variable 'execfile'
Error

Line: 6 Column: 9

              
if sys.version_info[:2] < (3, 0):
    def exec_file_wrapper(fpath, g_vars, l_vars):
        execfile(fpath, g_vars, l_vars)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # flake8: noqa
import sys

if sys.version_info[:2] < (3, 0):
    def exec_file_wrapper(fpath, g_vars, l_vars):
        execfile(fpath, g_vars, l_vars)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              import sys

if sys.version_info[:2] < (3, 0):
    def exec_file_wrapper(fpath, g_vars, l_vars):
        execfile(fpath, g_vars, l_vars)

            

Reported by Pylint.

platforms/android/service/engine/src/org/opencv/engine/MarketConnector.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 11

              public class MarketConnector {
    protected static final String OpenCVPackageNamePreffix = "org.opencv.lib";
    private static final String TAG = "OpenCVEngine/MarketConnector";
    protected Context mContext;

    public MarketConnector(Context context) {
        mContext = context;
    }


            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 25

                          Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            mContext.startActivity(intent);
        } catch (Exception e) {
            Log.e(TAG, "Installation failed");
            result = false;
        }
        return result;
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'result' (lines '19'-'27').
Error

Line: 19

              
    public boolean InstallAppFromMarket(String AppID) {
        Log.d(TAG, "Installing app: " + AppID);
        boolean result = true;
        try {
            Uri uri = Uri.parse("market://details?id=" + AppID);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            mContext.startActivity(intent);

            

Reported by PMD.

samples/android/face-detection/src/org/opencv/samples/facedetect/DetectionBasedTracker.java
3 issues
The field initializer for 'mNativeObj' is never used (overwritten on line 9)
Design

Line: 33

                      mNativeObj = 0;
    }

    private long mNativeObj = 0;

    private static native long nativeCreateObject(String cascadeName, int minFaceSize);
    private static native void nativeDestroyObject(long thiz);
    private static native void nativeStart(long thiz);
    private static native void nativeStop(long thiz);

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 33

                      mNativeObj = 0;
    }

    private long mNativeObj = 0;

    private static native long nativeCreateObject(String cascadeName, int minFaceSize);
    private static native void nativeDestroyObject(long thiz);
    private static native void nativeStart(long thiz);
    private static native void nativeStop(long thiz);

            

Reported by PMD.

Avoid using redundant field initializer for 'mNativeObj'
Performance

Line: 33

                      mNativeObj = 0;
    }

    private long mNativeObj = 0;

    private static native long nativeCreateObject(String cascadeName, int minFaceSize);
    private static native void nativeDestroyObject(long thiz);
    private static native void nativeStart(long thiz);
    private static native void nativeStop(long thiz);

            

Reported by PMD.