The following issues were found
apps/traincascade/old_ml.hpp
11 issues
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
Line: 513
CvParamGrid degreeGrid = CvSVM::get_default_grid(CvSVM::DEGREE),
bool balanced=false);
CV_WRAP virtual float predict( const cv::Mat& sample, bool returnDFVal=false ) const;
CV_WRAP_AS(predict_all) virtual void predict( cv::InputArray samples, cv::OutputArray results ) const;
CV_WRAP virtual int get_support_vector_count() const;
virtual const float* get_support_vector(int i) const;
virtual CvSVMParams get_params() const { return params; }
CV_WRAP virtual void clear();
Reported by Cppcheck.
samples/android/tutorial-4-opencl/src/org/opencv/samples/tutorial4/MyGLSurfaceView.java
11 issues
Line: 19
public class MyGLSurfaceView extends CameraGLSurfaceView implements CameraGLSurfaceView.CameraTextureListener {
static final String LOGTAG = "MyGLSurfaceView";
protected int procMode = NativePart.PROCESSING_MODE_NO_PROCESSING;
static final String[] procModeName = new String[] {"No Processing", "CPU", "OpenCL Direct", "OpenCL via OpenCV"};
protected int frameCounter;
protected long lastNanoTime;
TextView mFpsText = null;
Reported by PMD.
Line: 21
static final String LOGTAG = "MyGLSurfaceView";
protected int procMode = NativePart.PROCESSING_MODE_NO_PROCESSING;
static final String[] procModeName = new String[] {"No Processing", "CPU", "OpenCL Direct", "OpenCL via OpenCV"};
protected int frameCounter;
protected long lastNanoTime;
TextView mFpsText = null;
public MyGLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
Reported by PMD.
Line: 22
protected int procMode = NativePart.PROCESSING_MODE_NO_PROCESSING;
static final String[] procModeName = new String[] {"No Processing", "CPU", "OpenCL Direct", "OpenCL via OpenCV"};
protected int frameCounter;
protected long lastNanoTime;
TextView mFpsText = null;
public MyGLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
}
Reported by PMD.
Line: 23
static final String[] procModeName = new String[] {"No Processing", "CPU", "OpenCL Direct", "OpenCL via OpenCV"};
protected int frameCounter;
protected long lastNanoTime;
TextView mFpsText = null;
public MyGLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
}
Reported by PMD.
Line: 23
static final String[] procModeName = new String[] {"No Processing", "CPU", "OpenCL Direct", "OpenCL via OpenCV"};
protected int frameCounter;
protected long lastNanoTime;
TextView mFpsText = null;
public MyGLSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
}
Reported by PMD.
Line: 37
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
super.surfaceCreated(holder);
//NativePart.initCL();
}
@Override
Reported by PMD.
Line: 43
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
//NativePart.closeCL();
super.surfaceDestroyed(holder);
}
public void setProcessingMode(int newMode) {
Reported by PMD.
Line: 56
((Activity) getContext()).runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getContext(), "Selected mode: " + procModeName[procMode], Toast.LENGTH_LONG).show();
}
});
}
@Override
Reported by PMD.
Line: 65
public void onCameraViewStarted(int width, int height) {
((Activity) getContext()).runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getContext(), "onCameraViewStarted", Toast.LENGTH_SHORT).show();
}
});
NativePart.initCL();
frameCounter = 0;
lastNanoTime = System.nanoTime();
Reported by PMD.
Line: 77
public void onCameraViewStopped() {
((Activity) getContext()).runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getContext(), "onCameraViewStopped", Toast.LENGTH_SHORT).show();
}
});
}
@Override
Reported by PMD.
samples/android/15-puzzle/src/org/opencv/samples/puzzle15/Puzzle15Activity.java
11 issues
Line: 27
private static final String TAG = "Puzzle15::Activity";
private CameraBridgeViewBase mOpenCvCameraView;
private Puzzle15Processor mPuzzle15;
private MenuItem mItemHideNumbers;
private MenuItem mItemStartNewGame;
Reported by PMD.
Line: 28
private static final String TAG = "Puzzle15::Activity";
private CameraBridgeViewBase mOpenCvCameraView;
private Puzzle15Processor mPuzzle15;
private MenuItem mItemHideNumbers;
private MenuItem mItemStartNewGame;
private int mGameWidth;
Reported by PMD.
Line: 29
private CameraBridgeViewBase mOpenCvCameraView;
private Puzzle15Processor mPuzzle15;
private MenuItem mItemHideNumbers;
private MenuItem mItemStartNewGame;
private int mGameWidth;
private int mGameHeight;
Reported by PMD.
Line: 30
private CameraBridgeViewBase mOpenCvCameraView;
private Puzzle15Processor mPuzzle15;
private MenuItem mItemHideNumbers;
private MenuItem mItemStartNewGame;
private int mGameWidth;
private int mGameHeight;
Reported by PMD.
Line: 33
private MenuItem mItemStartNewGame;
private int mGameWidth;
private int mGameHeight;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
Reported by PMD.
Line: 34
private int mGameWidth;
private int mGameHeight;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
Reported by PMD.
Line: 36
private int mGameWidth;
private int mGameHeight;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
Reported by PMD.
Line: 36
private int mGameWidth;
private int mGameHeight;
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
Reported by PMD.
Line: 40
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
Log.i(TAG, "OpenCV loaded successfully");
/* Now enable camera view to start receiving frames */
Reported by PMD.
Line: 60
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Log.d(TAG, "Creating and setting view");
mOpenCvCameraView = (CameraBridgeViewBase) new JavaCameraView(this, -1);
setContentView(mOpenCvCameraView);
mOpenCvCameraView.setVisibility(CameraBridgeViewBase.VISIBLE);
Reported by PMD.
modules/imgcodecs/misc/java/test/ImgcodecsTest.java
11 issues
Line: 11
public class ImgcodecsTest extends OpenCVTestCase {
public void testImdecode() {
fail("Not yet implemented");
}
public void testImencodeStringMatListOfByte() {
MatOfByte buff = new MatOfByte();
Reported by PMD.
Line: 15
fail("Not yet implemented");
}
public void testImencodeStringMatListOfByte() {
MatOfByte buff = new MatOfByte();
assertEquals(0, buff.total());
assertTrue( Imgcodecs.imencode(".jpg", gray127, buff) );
assertFalse(0 == buff.total());
}
Reported by PMD.
Line: 15
fail("Not yet implemented");
}
public void testImencodeStringMatListOfByte() {
MatOfByte buff = new MatOfByte();
assertEquals(0, buff.total());
assertTrue( Imgcodecs.imencode(".jpg", gray127, buff) );
assertFalse(0 == buff.total());
}
Reported by PMD.
Line: 22
assertFalse(0 == buff.total());
}
public void testImencodeStringMatListOfByteListOfInteger() {
MatOfInt params40 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
MatOfInt params90 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 90);
/* or
MatOfInt params = new MatOfInt();
params.fromArray(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
Reported by PMD.
Line: 22
assertFalse(0 == buff.total());
}
public void testImencodeStringMatListOfByteListOfInteger() {
MatOfInt params40 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
MatOfInt params90 = new MatOfInt(Imgcodecs.IMWRITE_JPEG_QUALITY, 90);
/* or
MatOfInt params = new MatOfInt();
params.fromArray(Imgcodecs.IMWRITE_JPEG_QUALITY, 40);
Reported by PMD.
Line: 39
assertTrue(buff40.total() < buff90.total());
}
public void testImreadString() {
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH);
assertFalse(dst.empty());
assertEquals(3, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
Reported by PMD.
Line: 39
assertTrue(buff40.total() < buff90.total());
}
public void testImreadString() {
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH);
assertFalse(dst.empty());
assertEquals(3, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
Reported by PMD.
Line: 47
assertTrue(512 == dst.rows());
}
public void testImreadStringInt() {
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH, 0);
assertFalse(dst.empty());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
Reported by PMD.
Line: 47
assertTrue(512 == dst.rows());
}
public void testImreadStringInt() {
dst = Imgcodecs.imread(OpenCVTestRunner.LENA_PATH, 0);
assertFalse(dst.empty());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
Reported by PMD.
Line: 55
assertTrue(512 == dst.rows());
}
public void testImwriteStringMat() {
fail("Not yet implemented");
}
public void testImwriteStringMatListOfInteger() {
fail("Not yet implemented");
Reported by PMD.
modules/core/misc/java/src/java/core+Rect2d.java
11 issues
Line: 31
}
public Rect2d(double[] vals) {
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
x = vals.length > 0 ? (double) vals[0] : 0;
Reported by PMD.
Line: 48
}
}
public Rect2d clone() {
return new Rect2d(x, y, width, height);
}
public Point tl() {
return new Point(x, y);
Reported by PMD.
Line: 6
//javadoc:Rect2d_
public class Rect2d {
public double x, y, width, height;
public Rect2d(double x, double y, double width, double height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 6
//javadoc:Rect2d_
public class Rect2d {
public double x, y, width, height;
public Rect2d(double x, double y, double width, double height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 6
//javadoc:Rect2d_
public class Rect2d {
public double x, y, width, height;
public Rect2d(double x, double y, double width, double height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 6
//javadoc:Rect2d_
public class Rect2d {
public double x, y, width, height;
public Rect2d(double x, double y, double width, double height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 48
}
}
public Rect2d clone() {
return new Rect2d(x, y, width, height);
}
public Point tl() {
return new Point(x, y);
Reported by PMD.
Line: 48
}
}
public Rect2d clone() {
return new Rect2d(x, y, width, height);
}
public Point tl() {
return new Point(x, y);
Reported by PMD.
Line: 6
//javadoc:Rect2d_
public class Rect2d {
public double x, y, width, height;
public Rect2d(double x, double y, double width, double height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 30
this((double) p.x, (double) p.y, (double) s.width, (double) s.height);
}
public Rect2d(double[] vals) {
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
Reported by PMD.
modules/core/misc/java/src/java/core+Rect.java
11 issues
Line: 31
}
public Rect(double[] vals) {
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
x = vals.length > 0 ? (int) vals[0] : 0;
Reported by PMD.
Line: 48
}
}
public Rect clone() {
return new Rect(x, y, width, height);
}
public Point tl() {
return new Point(x, y);
Reported by PMD.
Line: 6
//javadoc:Rect_
public class Rect {
public int x, y, width, height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 6
//javadoc:Rect_
public class Rect {
public int x, y, width, height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 6
//javadoc:Rect_
public class Rect {
public int x, y, width, height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 6
//javadoc:Rect_
public class Rect {
public int x, y, width, height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 48
}
}
public Rect clone() {
return new Rect(x, y, width, height);
}
public Point tl() {
return new Point(x, y);
Reported by PMD.
Line: 48
}
}
public Rect clone() {
return new Rect(x, y, width, height);
}
public Point tl() {
return new Point(x, y);
Reported by PMD.
Line: 6
//javadoc:Rect_
public class Rect {
public int x, y, width, height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
Reported by PMD.
Line: 30
this((int) p.x, (int) p.y, (int) s.width, (int) s.height);
}
public Rect(double[] vals) {
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
Reported by PMD.
samples/python/tutorial_code/ImgTrans/MakeBorder/copy_make_border.py
11 issues
Line: 7
Column: 1
"""
import sys
from random import randint
import cv2 as cv
def main(argv):
## [variables]
# First we declare the variables we are going to use
Reported by Pylint.
Line: 10
Column: 1
import cv2 as cv
def main(argv):
## [variables]
# First we declare the variables we are going to use
borderType = cv.BORDER_CONSTANT
window_name = "copyMakeBorder Demo"
## [variables]
Reported by Pylint.
Line: 13
Column: 5
def main(argv):
## [variables]
# First we declare the variables we are going to use
borderType = cv.BORDER_CONSTANT
window_name = "copyMakeBorder Demo"
## [variables]
## [load]
imageName = argv[0] if len(argv) > 0 else 'lena.jpg'
Reported by Pylint.
Line: 17
Column: 5
window_name = "copyMakeBorder Demo"
## [variables]
## [load]
imageName = argv[0] if len(argv) > 0 else 'lena.jpg'
# Loads an image
src = cv.imread(cv.samples.findFile(imageName), cv.IMREAD_COLOR)
# Check if image is loaded fine
Reported by Pylint.
Line: 47
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
## [init_arguments]
while 1:
## [update_value]
value = [randint(0, 255), randint(0, 255), randint(0, 255)]
## [update_value]
## [copymakeborder]
dst = cv.copyMakeBorder(src, top, bottom, left, right, borderType, None, value)
## [copymakeborder]
## [display]
Reported by Bandit.
Line: 47
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
## [init_arguments]
while 1:
## [update_value]
value = [randint(0, 255), randint(0, 255), randint(0, 255)]
## [update_value]
## [copymakeborder]
dst = cv.copyMakeBorder(src, top, bottom, left, right, borderType, None, value)
## [copymakeborder]
## [display]
Reported by Bandit.
Line: 47
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random
## [init_arguments]
while 1:
## [update_value]
value = [randint(0, 255), randint(0, 255), randint(0, 255)]
## [update_value]
## [copymakeborder]
dst = cv.copyMakeBorder(src, top, bottom, left, right, borderType, None, value)
## [copymakeborder]
## [display]
Reported by Bandit.
Line: 56
Column: 9
cv.imshow(window_name, dst)
## [display]
## [check_keypress]
c = cv.waitKey(500)
if c == 27:
break
elif c == 99: # 99 = ord('c')
borderType = cv.BORDER_CONSTANT
Reported by Pylint.
Line: 58
Column: 9
## [check_keypress]
c = cv.waitKey(500)
if c == 27:
break
elif c == 99: # 99 = ord('c')
borderType = cv.BORDER_CONSTANT
elif c == 114: # 114 = ord('r')
borderType = cv.BORDER_REPLICATE
Reported by Pylint.
Line: 61
Column: 13
if c == 27:
break
elif c == 99: # 99 = ord('c')
borderType = cv.BORDER_CONSTANT
elif c == 114: # 114 = ord('r')
borderType = cv.BORDER_REPLICATE
## [check_keypress]
return 0
Reported by Pylint.
samples/python/gabor_threads.py
11 issues
Line: 21
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
from multiprocessing.pool import ThreadPool
def build_filters():
Reported by Pylint.
Line: 57
Column: 5
try:
img_fn = sys.argv[1]
except:
img_fn = 'baboon.jpg'
img = cv.imread(cv.samples.findFile(img_fn))
if img is None:
print('Failed to load image file:', img_fn)
Reported by Pylint.
Line: 8
Column: 1
=========
Sample demonstrates:
- use of multiple Gabor filter convolutions to get Fractalius-like image effect (http://www.redfieldplugins.com/filterFractalius.htm)
- use of python threading to accelerate the computation
Usage
-----
gabor_threads.py [image filename]
Reported by Pylint.
Line: 23
Column: 1
import numpy as np
import cv2 as cv
from multiprocessing.pool import ThreadPool
def build_filters():
filters = []
ksize = 31
Reported by Pylint.
Line: 26
Column: 1
from multiprocessing.pool import ThreadPool
def build_filters():
filters = []
ksize = 31
for theta in np.arange(0, np.pi, np.pi / 16):
kern = cv.getGaborKernel((ksize, ksize), 4.0, theta, 10.0, 0.5, 0, ktype=cv.CV_32F)
kern /= 1.5*kern.sum()
Reported by Pylint.
Line: 35
Column: 1
filters.append(kern)
return filters
def process(img, filters):
accum = np.zeros_like(img)
for kern in filters:
fimg = cv.filter2D(img, cv.CV_8UC3, kern)
np.maximum(accum, fimg, accum)
return accum
Reported by Pylint.
Line: 42
Column: 1
np.maximum(accum, fimg, accum)
return accum
def process_threaded(img, filters, threadn = 8):
accum = np.zeros_like(img)
def f(kern):
return cv.filter2D(img, cv.CV_8UC3, kern)
pool = ThreadPool(processes=threadn)
for fimg in pool.imap_unordered(f, filters):
Reported by Pylint.
Line: 44
Column: 5
def process_threaded(img, filters, threadn = 8):
accum = np.zeros_like(img)
def f(kern):
return cv.filter2D(img, cv.CV_8UC3, kern)
pool = ThreadPool(processes=threadn)
for fimg in pool.imap_unordered(f, filters):
np.maximum(accum, fimg, accum)
return accum
Reported by Pylint.
Line: 51
Column: 1
np.maximum(accum, fimg, accum)
return accum
def main():
import sys
from common import Timer
try:
img_fn = sys.argv[1]
Reported by Pylint.
Line: 52
Column: 5
return accum
def main():
import sys
from common import Timer
try:
img_fn = sys.argv[1]
except:
Reported by Pylint.
modules/python/test/test.py
11 issues
Line: 14
Column: 1
sys.dont_write_bytecode = True # Don't generate .pyc files / __pycache__ directories
import os
import unittest
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
Reported by Pylint.
Line: 18
Column: 5
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
from tests_common import NewOpenCVTests
Reported by Pylint.
Line: 27
Column: 31
basedir = os.path.abspath(os.path.dirname(__file__))
def load_tests(loader, tests, pattern):
cwd = os.getcwd()
config_file = 'opencv_python_tests.cfg'
locations = [cwd, basedir]
if os.path.exists(config_file):
with open(config_file, 'r') as f:
Reported by Pylint.
Line: 13
Column: 1
import sys
sys.dont_write_bytecode = True # Don't generate .pyc files / __pycache__ directories
import os
import unittest
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
Reported by Pylint.
Line: 14
Column: 1
sys.dont_write_bytecode = True # Don't generate .pyc files / __pycache__ directories
import os
import unittest
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
Reported by Pylint.
Line: 22
Column: 1
except ImportError:
from urllib import urlopen
from tests_common import NewOpenCVTests
basedir = os.path.abspath(os.path.dirname(__file__))
def load_tests(loader, tests, pattern):
Reported by Pylint.
Line: 27
Column: 1
basedir = os.path.abspath(os.path.dirname(__file__))
def load_tests(loader, tests, pattern):
cwd = os.getcwd()
config_file = 'opencv_python_tests.cfg'
locations = [cwd, basedir]
if os.path.exists(config_file):
with open(config_file, 'r') as f:
Reported by Pylint.
Line: 32
Column: 40
config_file = 'opencv_python_tests.cfg'
locations = [cwd, basedir]
if os.path.exists(config_file):
with open(config_file, 'r') as f:
locations += [str(s).strip() for s in f.readlines()]
else:
print('WARNING: OpenCV tests config file ({}) is missing, running subset of tests'.format(config_file))
tests_pattern = os.environ.get('OPENCV_PYTEST_FILTER', 'test_*') + '.py'
Reported by Pylint.
Line: 35
Column: 1
with open(config_file, 'r') as f:
locations += [str(s).strip() for s in f.readlines()]
else:
print('WARNING: OpenCV tests config file ({}) is missing, running subset of tests'.format(config_file))
tests_pattern = os.environ.get('OPENCV_PYTEST_FILTER', 'test_*') + '.py'
if tests_pattern != 'test_*.py':
print('Tests filter: {}'.format(tests_pattern))
Reported by Pylint.
Line: 42
Column: 9
print('Tests filter: {}'.format(tests_pattern))
processed = set()
for l in locations:
if not os.path.isabs(l):
l = os.path.normpath(os.path.join(cwd, l))
if l in processed:
continue
processed.add(l)
Reported by Pylint.
modules/objdetect/misc/python/test/test_qrcode_detect.py
11 issues
Line: 9
Column: 1
'''
import os
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
class qrcode_detector_test(NewOpenCVTests):
Reported by Pylint.
Line: 11
Column: 1
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
class qrcode_detector_test(NewOpenCVTests):
def test_detect(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
Reported by Pylint.
Line: 8
Column: 1
===============================================================================
'''
import os
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
class qrcode_detector_test(NewOpenCVTests):
Reported by Pylint.
Line: 27
Column: 25
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
retval, points, straight_qrcode = detector.detectAndDecode(img)
self.assertEqual(retval, "https://opencv.org/")
self.assertEqual(points.shape, (1, 4, 2))
def test_detect_multi(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/multiple/6_qrcodes.png'))
Reported by Pylint.
Line: 43
Column: 39
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/multiple/6_qrcodes.png'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
retval, decoded_data, points, straight_qrcode = detector.detectAndDecodeMulti(img)
self.assertTrue(retval)
self.assertEqual(len(decoded_data), 6)
self.assertEqual(decoded_data[0], "TWO STEPS FORWARD")
self.assertEqual(decoded_data[1], "EXTRA")
self.assertEqual(decoded_data[2], "SKIP")
Reported by Pylint.
Line: 13
Column: 1
from tests_common import NewOpenCVTests
class qrcode_detector_test(NewOpenCVTests):
def test_detect(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
Reported by Pylint.
Line: 13
Column: 1
from tests_common import NewOpenCVTests
class qrcode_detector_test(NewOpenCVTests):
def test_detect(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
Reported by Pylint.
Line: 15
Column: 5
class qrcode_detector_test(NewOpenCVTests):
def test_detect(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
retval, points = detector.detect(img)
self.assertTrue(retval)
Reported by Pylint.
Line: 23
Column: 5
self.assertTrue(retval)
self.assertEqual(points.shape, (1, 4, 2))
def test_detect_and_decode(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
retval, points, straight_qrcode = detector.detectAndDecode(img)
self.assertEqual(retval, "https://opencv.org/")
Reported by Pylint.
Line: 31
Column: 5
self.assertEqual(retval, "https://opencv.org/")
self.assertEqual(points.shape, (1, 4, 2))
def test_detect_multi(self):
img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/multiple/6_qrcodes.png'))
self.assertFalse(img is None)
detector = cv.QRCodeDetector()
retval, points = detector.detectMulti(img)
self.assertTrue(retval)
Reported by Pylint.