The following issues were found
samples/python/tutorial_code/imgProc/changing_contrast_brightness_image/changing_contrast_brightness_image.py
34 issues
Line: 3
Column: 1
from __future__ import print_function
from __future__ import division
import cv2 as cv
import numpy as np
import argparse
alpha = 1.0
alpha_max = 500
beta = 0
Reported by Pylint.
Line: 16
Column: 5
def basicLinearTransform():
res = cv.convertScaleAbs(img_original, alpha=alpha, beta=beta)
img_corrected = cv.hconcat([img_original, res])
cv.imshow("Brightness and contrast adjustments", img_corrected)
def gammaCorrection():
## [changing-contrast-brightness-gamma-correction]
lookUpTable = np.empty((1,256), np.uint8)
Reported by Pylint.
Line: 28
Column: 5
res = cv.LUT(img_original, lookUpTable)
## [changing-contrast-brightness-gamma-correction]
img_gamma_corrected = cv.hconcat([img_original, res])
cv.imshow("Gamma correction", img_gamma_corrected)
def on_linear_transform_alpha_trackbar(val):
global alpha
alpha = val / 100
Reported by Pylint.
Line: 32
Column: 5
cv.imshow("Gamma correction", img_gamma_corrected)
def on_linear_transform_alpha_trackbar(val):
global alpha
alpha = val / 100
basicLinearTransform()
def on_linear_transform_beta_trackbar(val):
global beta
Reported by Pylint.
Line: 37
Column: 5
basicLinearTransform()
def on_linear_transform_beta_trackbar(val):
global beta
beta = val - 100
basicLinearTransform()
def on_gamma_correction_trackbar(val):
global gamma
Reported by Pylint.
Line: 42
Column: 5
basicLinearTransform()
def on_gamma_correction_trackbar(val):
global gamma
gamma = val / 100
gammaCorrection()
parser = argparse.ArgumentParser(description='Code for Changing the contrast and brightness of an image! tutorial.')
parser.add_argument('--input', help='Path to input image.', default='lena.jpg')
Reported by Pylint.
Line: 1
Column: 1
from __future__ import print_function
from __future__ import division
import cv2 as cv
import numpy as np
import argparse
alpha = 1.0
alpha_max = 500
beta = 0
Reported by Pylint.
Line: 5
Column: 1
from __future__ import division
import cv2 as cv
import numpy as np
import argparse
alpha = 1.0
alpha_max = 500
beta = 0
beta_max = 200
Reported by Pylint.
Line: 7
Column: 1
import numpy as np
import argparse
alpha = 1.0
alpha_max = 500
beta = 0
beta_max = 200
gamma = 1.0
gamma_max = 200
Reported by Pylint.
Line: 8
Column: 1
import argparse
alpha = 1.0
alpha_max = 500
beta = 0
beta_max = 200
gamma = 1.0
gamma_max = 200
Reported by Pylint.
samples/java/tutorial_code/ShapeDescriptors/bounding_rotated_ellipses/GeneralContoursDemo2.java
34 issues
Line: 45
String filename = args.length > 0 ? args[0] : "../data/stuff.jpg";
Mat src = Imgcodecs.imread(filename);
if (src.empty()) {
System.err.println("Cannot read image: " + filename);
System.exit(0);
}
/// Convert image to gray and blur it
Imgproc.cvtColor(src, srcGray, Imgproc.COLOR_BGR2GRAY);
Reported by PMD.
Line: 31
import org.opencv.imgproc.Imgproc;
class GeneralContours2 {
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
Reported by PMD.
Line: 31
import org.opencv.imgproc.Imgproc;
class GeneralContours2 {
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
Reported by PMD.
Line: 32
class GeneralContours2 {
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
Reported by PMD.
Line: 32
class GeneralContours2 {
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
Reported by PMD.
Line: 33
class GeneralContours2 {
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
Reported by PMD.
Line: 33
class GeneralContours2 {
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
Reported by PMD.
Line: 34
private Mat srcGray = new Mat();
private JFrame frame;
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
public GeneralContours2(String[] args) {
Reported by PMD.
Line: 36
private JLabel imgSrcLabel;
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
public GeneralContours2(String[] args) {
//! [setup]
/// Load source image
Reported by PMD.
Line: 37
private JLabel imgContoursLabel;
private static final int MAX_THRESHOLD = 255;
private int threshold = 100;
private Random rng = new Random(12345);
public GeneralContours2(String[] args) {
//! [setup]
/// Load source image
String filename = args.length > 0 ? args[0] : "../data/stuff.jpg";
Reported by PMD.
modules/python/test/tests_common.py
34 issues
Line: 13
Column: 1
import argparse
import numpy as np
import cv2 as cv
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
Reported by Pylint.
Line: 17
Column: 5
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
class NewOpenCVTests(unittest.TestCase):
Reported by Pylint.
Line: 29
Column: 5
# github repository url
repoUrl = 'https://raw.github.com/opencv/opencv/master'
def find_file(self, filename, searchPaths=[], required=True):
searchPaths = searchPaths if searchPaths else [self.repoPath, self.extraTestDataPath]
for path in searchPaths:
if path is not None:
candidate = path + '/' + filename
if os.path.isfile(candidate):
Reported by Pylint.
Line: 57
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
def hashimg(self, im):
""" Compute a hash for an image, useful for image comparisons """
return hashlib.md5(im.tostring()).hexdigest()
if sys.version_info[:2] == (2, 6):
def assertLess(self, a, b, msg=None):
if not a < b:
self.fail('%s not less than %s' % (repr(a), repr(b)))
Reported by Bandit.
Line: 1
Column: 1
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import unittest
import hashlib
import random
Reported by Pylint.
Line: 21
Column: 1
except ImportError:
from urllib import urlopen
class NewOpenCVTests(unittest.TestCase):
# path to local repository folder containing 'samples' folder
repoPath = None
extraTestDataPath = None
# github repository url
Reported by Pylint.
Line: 29
Column: 5
# github repository url
repoUrl = 'https://raw.github.com/opencv/opencv/master'
def find_file(self, filename, searchPaths=[], required=True):
searchPaths = searchPaths if searchPaths else [self.repoPath, self.extraTestDataPath]
for path in searchPaths:
if path is not None:
candidate = path + '/' + filename
if os.path.isfile(candidate):
Reported by Pylint.
Line: 29
Column: 5
# github repository url
repoUrl = 'https://raw.github.com/opencv/opencv/master'
def find_file(self, filename, searchPaths=[], required=True):
searchPaths = searchPaths if searchPaths else [self.repoPath, self.extraTestDataPath]
for path in searchPaths:
if path is not None:
candidate = path + '/' + filename
if os.path.isfile(candidate):
Reported by Pylint.
Line: 41
Column: 5
return None
def get_sample(self, filename, iscolor = None):
if iscolor is None:
iscolor = cv.IMREAD_COLOR
if not filename in self.image_cache:
filepath = self.find_file(filename)
with open(filepath, 'rb') as f:
Reported by Pylint.
Line: 46
Column: 42
iscolor = cv.IMREAD_COLOR
if not filename in self.image_cache:
filepath = self.find_file(filename)
with open(filepath, 'rb') as f:
filedata = f.read()
self.image_cache[filename] = cv.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
return self.image_cache[filename]
def setUp(self):
Reported by Pylint.
platforms/android/build-tests/test_cmake_build.py
34 issues
Line: 4
Column: 1
#!/usr/bin/env python
import unittest
import os, sys, subprocess, argparse, shutil, re
import logging as log
log.basicConfig(format='%(message)s', level=log.DEBUG)
CMAKE_TEMPLATE='''\
Reported by Pylint.
Line: 47
Column: 68
#===================================================================================================
class TestCmakeBuild(unittest.TestCase):
def __init__(self, libset, abi, cmake_vars, opencv_cmake_path, workdir, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.libset = libset
self.abi = abi
self.cmake_vars = cmake_vars
self.opencv_cmake_path = opencv_cmake_path
Reported by Pylint.
Line: 47
Column: 1
#===================================================================================================
class TestCmakeBuild(unittest.TestCase):
def __init__(self, libset, abi, cmake_vars, opencv_cmake_path, workdir, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.libset = libset
self.abi = abi
self.cmake_vars = cmake_vars
self.opencv_cmake_path = opencv_cmake_path
Reported by Pylint.
Line: 61
Column: 9
return "ABI: %s, LIBSET: %s" % (self.abi, self.libset)
def getCMakeToolchain(self):
if True:
toolchain = os.path.join(os.environ['ANDROID_NDK'], 'build', 'cmake', 'android.toolchain.cmake')
if os.path.exists(toolchain):
return toolchain
toolchain = os.path.join(self.opencv_cmake_path, "android.toolchain.cmake")
if os.path.exists(toolchain):
Reported by Pylint.
Line: 104
Column: 9
"-DCMAKE_TOOLCHAIN_FILE=%s" % self.getCMakeToolchain(),
self.srcdir
] + [ "-D{}={}".format(key, value) for key, value in self.cmake_vars.items() ]
log.info("Executing: %s" % cmd)
retcode = subprocess.call(cmd)
self.assertEqual(retcode, 0, "cmake failed")
cmd = ["ninja", "-v"]
log.info("Executing: %s" % cmd)
Reported by Pylint.
Line: 109
Column: 9
self.assertEqual(retcode, 0, "cmake failed")
cmd = ["ninja", "-v"]
log.info("Executing: %s" % cmd)
retcode = subprocess.call(cmd)
self.assertEqual(retcode, 0, "make failed")
def suite(workdir, opencv_cmake_path):
abis = {
Reported by Pylint.
Line: 113
Column: 11
retcode = subprocess.call(cmd)
self.assertEqual(retcode, 0, "make failed")
def suite(workdir, opencv_cmake_path):
abis = {
"armeabi-v7a": { "ANDROID_ABI": "armeabi-v7a", "ANDROID_TOOLCHAIN": "clang", "ANDROID_STL": "c++_shared", 'ANDROID_NATIVE_API_LEVEL': "21" },
"arm64-v8a": { "ANDROID_ABI": "arm64-v8a", "ANDROID_TOOLCHAIN": "clang", "ANDROID_STL": "c++_shared", 'ANDROID_NATIVE_API_LEVEL': "21" },
"x86": { "ANDROID_ABI": "x86", "ANDROID_TOOLCHAIN": "clang", "ANDROID_STL": "c++_shared", 'ANDROID_NATIVE_API_LEVEL': "21" },
"x86_64": { "ANDROID_ABI": "x86_64", "ANDROID_TOOLCHAIN": "clang", "ANDROID_STL": "c++_shared", 'ANDROID_NATIVE_API_LEVEL': "21" },
Reported by Pylint.
Line: 121
Column: 5
"x86_64": { "ANDROID_ABI": "x86_64", "ANDROID_TOOLCHAIN": "clang", "ANDROID_STL": "c++_shared", 'ANDROID_NATIVE_API_LEVEL': "21" },
}
suite = unittest.TestSuite()
for libset in ["", "opencv_java"]:
for abi, cmake_vars in abis.items():
suite.addTest(TestCmakeBuild(libset, abi, cmake_vars, opencv_cmake_path,
os.path.join(workdir, "{}-{}".format(abi, "static" if libset == "" else "shared"))))
return suite
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
import unittest
import os, sys, subprocess, argparse, shutil, re
import logging as log
log.basicConfig(format='%(message)s', level=log.DEBUG)
CMAKE_TEMPLATE='''\
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
#!/usr/bin/env python
import unittest
import os, sys, subprocess, argparse, shutil, re
import logging as log
log.basicConfig(format='%(message)s', level=log.DEBUG)
CMAKE_TEMPLATE='''\
Reported by Bandit.
modules/video/misc/python/test/test_lk_homography.py
33 issues
Line: 14
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
#local modules
from tst_scene_render import TestSceneRender
from tests_common import NewOpenCVTests, isPointInRect
Reported by Pylint.
Line: 17
Column: 1
import cv2 as cv
#local modules
from tst_scene_render import TestSceneRender
from tests_common import NewOpenCVTests, isPointInRect
lk_params = dict( winSize = (19, 19),
maxLevel = 2,
criteria = (cv.TERM_CRITERIA_EPS | cv.TERM_CRITERIA_COUNT, 10, 0.03))
Reported by Pylint.
Line: 18
Column: 1
#local modules
from tst_scene_render import TestSceneRender
from tests_common import NewOpenCVTests, isPointInRect
lk_params = dict( winSize = (19, 19),
maxLevel = 2,
criteria = (cv.TERM_CRITERIA_EPS | cv.TERM_CRITERIA_COUNT, 10, 0.03))
Reported by Pylint.
Line: 13
Column: 1
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
#local modules
from tst_scene_render import TestSceneRender
from tests_common import NewOpenCVTests, isPointInRect
Reported by Pylint.
Line: 29
Column: 1
minDistance = 8,
blockSize = 19 )
def checkedTrace(img0, img1, p0, back_threshold = 1.0):
p1, _st, _err = cv.calcOpticalFlowPyrLK(img0, img1, p0, None, **lk_params)
p0r, _st, _err = cv.calcOpticalFlowPyrLK(img1, img0, p1, None, **lk_params)
d = abs(p0-p0r).reshape(-1, 2).max(-1)
status = d < back_threshold
return p1, status
Reported by Pylint.
Line: 29
Column: 1
minDistance = 8,
blockSize = 19 )
def checkedTrace(img0, img1, p0, back_threshold = 1.0):
p1, _st, _err = cv.calcOpticalFlowPyrLK(img0, img1, p0, None, **lk_params)
p0r, _st, _err = cv.calcOpticalFlowPyrLK(img1, img0, p1, None, **lk_params)
d = abs(p0-p0r).reshape(-1, 2).max(-1)
status = d < back_threshold
return p1, status
Reported by Pylint.
Line: 29
Column: 1
minDistance = 8,
blockSize = 19 )
def checkedTrace(img0, img1, p0, back_threshold = 1.0):
p1, _st, _err = cv.calcOpticalFlowPyrLK(img0, img1, p0, None, **lk_params)
p0r, _st, _err = cv.calcOpticalFlowPyrLK(img1, img0, p1, None, **lk_params)
d = abs(p0-p0r).reshape(-1, 2).max(-1)
status = d < back_threshold
return p1, status
Reported by Pylint.
Line: 30
Column: 5
blockSize = 19 )
def checkedTrace(img0, img1, p0, back_threshold = 1.0):
p1, _st, _err = cv.calcOpticalFlowPyrLK(img0, img1, p0, None, **lk_params)
p0r, _st, _err = cv.calcOpticalFlowPyrLK(img1, img0, p1, None, **lk_params)
d = abs(p0-p0r).reshape(-1, 2).max(-1)
status = d < back_threshold
return p1, status
Reported by Pylint.
Line: 32
Column: 5
def checkedTrace(img0, img1, p0, back_threshold = 1.0):
p1, _st, _err = cv.calcOpticalFlowPyrLK(img0, img1, p0, None, **lk_params)
p0r, _st, _err = cv.calcOpticalFlowPyrLK(img1, img0, p1, None, **lk_params)
d = abs(p0-p0r).reshape(-1, 2).max(-1)
status = d < back_threshold
return p1, status
class lk_homography_test(NewOpenCVTests):
Reported by Pylint.
Line: 36
Column: 1
status = d < back_threshold
return p1, status
class lk_homography_test(NewOpenCVTests):
render = None
framesCounter = 0
frame = frame0 = None
p0 = None
Reported by Pylint.
modules/python/test/test_norm.py
33 issues
Line: 7
Column: 1
from functools import reduce
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
def norm_inf(x, y=None):
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
from itertools import product
from functools import reduce
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
from itertools import product
from functools import reduce
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
Reported by Pylint.
Line: 12
Column: 1
from tests_common import NewOpenCVTests
def norm_inf(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten(), np.inf)
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
Line: 12
Column: 1
from tests_common import NewOpenCVTests
def norm_inf(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten(), np.inf)
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
Line: 12
Column: 1
from tests_common import NewOpenCVTests
def norm_inf(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten(), np.inf)
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
Line: 20
Column: 1
return norm(x) if y is None else norm(x - y.astype(np.float64))
def norm_l1(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten(), 1)
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
Line: 20
Column: 1
return norm(x) if y is None else norm(x - y.astype(np.float64))
def norm_l1(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten(), 1)
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
Line: 20
Column: 1
return norm(x) if y is None else norm(x - y.astype(np.float64))
def norm_l1(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten(), 1)
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
Line: 28
Column: 1
return norm(x) if y is None else norm(x - y.astype(np.float64))
def norm_l2(x, y=None):
def norm(vec):
return np.linalg.norm(vec.flatten())
x = x.astype(np.float64)
return norm(x) if y is None else norm(x - y.astype(np.float64))
Reported by Pylint.
samples/android/15-puzzle/src/org/opencv/samples/puzzle15/Puzzle15Processor.java
33 issues
Line: 18
* This class is a controller for puzzle game.
* It converts the image from Camera into the shuffled image
*/
public class Puzzle15Processor {
private static final int GRID_SIZE = 4;
private static final int GRID_AREA = GRID_SIZE * GRID_SIZE;
private static final int GRID_EMPTY_INDEX = GRID_AREA - 1;
private static final String TAG = "Puzzle15Processor";
Reported by PMD.
Line: 18
* This class is a controller for puzzle game.
* It converts the image from Camera into the shuffled image
*/
public class Puzzle15Processor {
private static final int GRID_SIZE = 4;
private static final int GRID_AREA = GRID_SIZE * GRID_SIZE;
private static final int GRID_EMPTY_INDEX = GRID_AREA - 1;
private static final String TAG = "Puzzle15Processor";
Reported by PMD.
Line: 26
private static final String TAG = "Puzzle15Processor";
private static final Scalar GRID_EMPTY_COLOR = new Scalar(0x33, 0x33, 0x33, 0xFF);
private int[] mIndexes;
private int[] mTextWidths;
private int[] mTextHeights;
private Mat mRgba15;
private Mat[] mCells15;
Reported by PMD.
Line: 27
private static final Scalar GRID_EMPTY_COLOR = new Scalar(0x33, 0x33, 0x33, 0xFF);
private int[] mIndexes;
private int[] mTextWidths;
private int[] mTextHeights;
private Mat mRgba15;
private Mat[] mCells15;
private boolean mShowTileNumbers = true;
Reported by PMD.
Line: 28
private int[] mIndexes;
private int[] mTextWidths;
private int[] mTextHeights;
private Mat mRgba15;
private Mat[] mCells15;
private boolean mShowTileNumbers = true;
Reported by PMD.
Line: 30
private int[] mTextWidths;
private int[] mTextHeights;
private Mat mRgba15;
private Mat[] mCells15;
private boolean mShowTileNumbers = true;
public Puzzle15Processor() {
mTextWidths = new int[GRID_AREA];
Reported by PMD.
Line: 31
private int[] mTextHeights;
private Mat mRgba15;
private Mat[] mCells15;
private boolean mShowTileNumbers = true;
public Puzzle15Processor() {
mTextWidths = new int[GRID_AREA];
mTextHeights = new int[GRID_AREA];
Reported by PMD.
Line: 32
private Mat mRgba15;
private Mat[] mCells15;
private boolean mShowTileNumbers = true;
public Puzzle15Processor() {
mTextWidths = new int[GRID_AREA];
mTextHeights = new int[GRID_AREA];
Reported by PMD.
Line: 102
else {
cells[idx].copyTo(mCells15[i]);
if (mShowTileNumbers) {
Imgproc.putText(mCells15[i], Integer.toString(1 + idx), new Point((cols / GRID_SIZE - mTextWidths[idx]) / 2,
(rows / GRID_SIZE + mTextHeights[idx]) / 2), 3/* CV_FONT_HERSHEY_COMPLEX */, 1, new Scalar(255, 0, 0, 255), 2);
}
}
}
Reported by PMD.
Line: 103
cells[idx].copyTo(mCells15[i]);
if (mShowTileNumbers) {
Imgproc.putText(mCells15[i], Integer.toString(1 + idx), new Point((cols / GRID_SIZE - mTextWidths[idx]) / 2,
(rows / GRID_SIZE + mTextHeights[idx]) / 2), 3/* CV_FONT_HERSHEY_COMPLEX */, 1, new Scalar(255, 0, 0, 255), 2);
}
}
}
for (int i = 0; i < GRID_AREA; i++)
Reported by PMD.
samples/dnn/segmentation.py
32 issues
Line: 1
Column: 1
import cv2 as cv
import argparse
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
Reported by Pylint.
Line: 4
Column: 1
import cv2 as cv
import argparse
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
Reported by Pylint.
Line: 6
Column: 1
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
targets = (cv.dnn.DNN_TARGET_CPU, cv.dnn.DNN_TARGET_OPENCL, cv.dnn.DNN_TARGET_OPENCL_FP16, cv.dnn.DNN_TARGET_MYRIAD, cv.dnn.DNN_TARGET_HDDL,
cv.dnn.DNN_TARGET_VULKAN, cv.dnn.DNN_TARGET_CUDA, cv.dnn.DNN_TARGET_CUDA_FP16)
Reported by Pylint.
Line: 6
Column: 1
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
targets = (cv.dnn.DNN_TARGET_CPU, cv.dnn.DNN_TARGET_OPENCL, cv.dnn.DNN_TARGET_OPENCL_FP16, cv.dnn.DNN_TARGET_MYRIAD, cv.dnn.DNN_TARGET_HDDL,
cv.dnn.DNN_TARGET_VULKAN, cv.dnn.DNN_TARGET_CUDA, cv.dnn.DNN_TARGET_CUDA_FP16)
Reported by Pylint.
Line: 66
Column: 16
colors = [np.array(color.split(' '), np.uint8) for color in f.read().rstrip('\n').split('\n')]
legend = None
def showLegend(classes):
global legend
if not classes is None and legend is None:
blockHeight = 30
assert(len(classes) == len(colors))
Reported by Pylint.
Line: 67
Column: 5
legend = None
def showLegend(classes):
global legend
if not classes is None and legend is None:
blockHeight = 30
assert(len(classes) == len(colors))
legend = np.zeros((blockHeight * len(colors), 200, 3), np.uint8)
Reported by Pylint.
Line: 73
Column: 13
assert(len(classes) == len(colors))
legend = np.zeros((blockHeight * len(colors), 200, 3), np.uint8)
for i in range(len(classes)):
block = legend[i * blockHeight:(i + 1) * blockHeight]
block[:,:] = colors[i]
cv.putText(block, classes[i], (0, blockHeight//2), cv.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255))
cv.namedWindow('Legend', cv.WINDOW_NORMAL)
Reported by Pylint.
Line: 1
Column: 1
import cv2 as cv
import argparse
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
Reported by Pylint.
Line: 2
Column: 1
import cv2 as cv
import argparse
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
Reported by Pylint.
Line: 4
Column: 1
import cv2 as cv
import argparse
import numpy as np
import sys
from common import *
backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_HALIDE, cv.dnn.DNN_BACKEND_INFERENCE_ENGINE, cv.dnn.DNN_BACKEND_OPENCV,
cv.dnn.DNN_BACKEND_VKCOM, cv.dnn.DNN_BACKEND_CUDA)
Reported by Pylint.
modules/core/misc/java/test/RectTest.java
32 issues
Line: 8
import org.opencv.core.Size;
import org.opencv.test.OpenCVTestCase;
public class RectTest extends OpenCVTestCase {
private Rect r;
private Rect rect;
@Override
Reported by PMD.
Line: 10
public class RectTest extends OpenCVTestCase {
private Rect r;
private Rect rect;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 11
public class RectTest extends OpenCVTestCase {
private Rect r;
private Rect rect;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 13
private Rect r;
private Rect rect;
@Override
protected void setUp() throws Exception {
super.setUp();
r = new Rect();
rect = new Rect(0, 0, 10, 10);
Reported by PMD.
Line: 21
rect = new Rect(0, 0, 10, 10);
}
public void testArea() {
double area;
area = rect.area();
assertEquals(100.0, area);
}
Reported by PMD.
Line: 27
assertEquals(100.0, area);
}
public void testBr() {
Point p_br = new Point();
p_br = rect.br();
Point truth = new Point(10, 10);
assertEquals(truth, p_br);
}
Reported by PMD.
Line: 28
}
public void testBr() {
Point p_br = new Point();
p_br = rect.br();
Point truth = new Point(10, 10);
assertEquals(truth, p_br);
}
Reported by PMD.
Line: 34
assertEquals(truth, p_br);
}
public void testClone() {
r = rect.clone();
assertEquals(rect, r);
}
public void testContains() {
Reported by PMD.
Line: 39
assertEquals(rect, r);
}
public void testContains() {
Rect rect = new Rect(0, 0, 10, 10);
Point p_inner = new Point(5, 5);
Point p_outer = new Point(5, 55);
Point p_bl = new Point(0, 0);
Reported by PMD.
Line: 39
assertEquals(rect, r);
}
public void testContains() {
Rect rect = new Rect(0, 0, 10, 10);
Point p_inner = new Point(5, 5);
Point p_outer = new Point(5, 55);
Point p_bl = new Point(0, 0);
Reported by PMD.
samples/python/tracker.py
32 issues
Line: 30
Column: 1
import sys
import numpy as np
import cv2 as cv
import argparse
from video import create_capture, presets
class App(object):
Reported by Pylint.
Line: 104
Column: 27
cv.imshow("tracking", image)
k = cv.waitKey(1)
if k == 32: # SPACE
tracker = self.initializeTracker(image)
if k == 27: # ESC
break
print('Done')
Reported by Pylint.
Line: 29
Column: 1
import sys
import numpy as np
import cv2 as cv
import argparse
from video import create_capture, presets
Reported by Pylint.
Line: 37
Column: 24
class App(object):
def __init__(self, args):
self.args = args
def initializeTracker(self, image, trackerAlgorithm):
while True:
if trackerAlgorithm == 'mil':
Reported by Pylint.
Line: 64
Column: 20
try:
tracker.init(image, bbox)
except Exception as e:
print('Unable to initialize tracker with requested bounding box. Is there any object?')
print(e)
print('Try again ...')
continue
Reported by Pylint.
Line: 8
Column: 1
For usage download models by following links
For GOTURN:
goturn.prototxt and goturn.caffemodel: https://github.com/opencv/opencv_extra/tree/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking
For DaSiamRPN:
network: https://www.dropbox.com/s/rr1lk9355vzolqv/dasiamrpn_model.onnx?dl=0
kernel_r1: https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_kernel_r1.onnx?dl=0
kernel_cls1: https://www.dropbox.com/s/qvmtszx5h339a0w/dasiamrpn_kernel_cls1.onnx?dl=0
Reported by Pylint.
Line: 31
Column: 1
import numpy as np
import cv2 as cv
import argparse
from video import create_capture, presets
class App(object):
Reported by Pylint.
Line: 35
Column: 1
from video import create_capture, presets
class App(object):
def __init__(self, args):
self.args = args
def initializeTracker(self, image, trackerAlgorithm):
Reported by Pylint.
Line: 35
Column: 1
from video import create_capture, presets
class App(object):
def __init__(self, args):
self.args = args
def initializeTracker(self, image, trackerAlgorithm):
Reported by Pylint.
Line: 40
Column: 5
def __init__(self, args):
self.args = args
def initializeTracker(self, image, trackerAlgorithm):
while True:
if trackerAlgorithm == 'mil':
tracker = cv.TrackerMIL_create()
elif trackerAlgorithm == 'goturn':
params = cv.TrackerGOTURN_Params()
Reported by Pylint.