The following issues were found
samples/java/tutorial_code/ImgProc/BasicGeometricDrawing/BasicGeometricDrawing.java
23 issues
Line: 67
HighGui.moveWindow( rook_window, W, 200 );
HighGui.waitKey( 0 );
System.exit(0);
}
/// Function Declaration
/**
Reported by PMD.
Line: 180
//! [my_line]
}
public class BasicGeometricDrawing {
public static void main(String[] args) {
// Load the native library.
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new GeometricDrawingRun().run();
}
Reported by PMD.
Line: 1
import org.opencv.core.*;
import org.opencv.core.Point;
import org.opencv.highgui.HighGui;
import org.opencv.imgproc.Imgproc;
import java.util.*;
import java.util.List;
class GeometricDrawingRun{
Reported by PMD.
Line: 123
int shift = 0;
/** Create some points */
Point[] rook_points = new Point[20];
rook_points[0] = new Point( W/4, 7*W/8 );
rook_points[1] = new Point( 3*W/4, 7*W/8 );
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
Reported by PMD.
Line: 124
/** Create some points */
Point[] rook_points = new Point[20];
rook_points[0] = new Point( W/4, 7*W/8 );
rook_points[1] = new Point( 3*W/4, 7*W/8 );
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
rook_points[5] = new Point( 3*W/4, 3*W/8 );
Reported by PMD.
Line: 125
/** Create some points */
Point[] rook_points = new Point[20];
rook_points[0] = new Point( W/4, 7*W/8 );
rook_points[1] = new Point( 3*W/4, 7*W/8 );
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
rook_points[5] = new Point( 3*W/4, 3*W/8 );
rook_points[6] = new Point( 3*W/4, W/8 );
Reported by PMD.
Line: 126
Point[] rook_points = new Point[20];
rook_points[0] = new Point( W/4, 7*W/8 );
rook_points[1] = new Point( 3*W/4, 7*W/8 );
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
rook_points[5] = new Point( 3*W/4, 3*W/8 );
rook_points[6] = new Point( 3*W/4, W/8 );
rook_points[7] = new Point( 26*W/40, W/8 );
Reported by PMD.
Line: 127
rook_points[0] = new Point( W/4, 7*W/8 );
rook_points[1] = new Point( 3*W/4, 7*W/8 );
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
rook_points[5] = new Point( 3*W/4, 3*W/8 );
rook_points[6] = new Point( 3*W/4, W/8 );
rook_points[7] = new Point( 26*W/40, W/8 );
rook_points[8] = new Point( 26*W/40, W/4 );
Reported by PMD.
Line: 128
rook_points[1] = new Point( 3*W/4, 7*W/8 );
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
rook_points[5] = new Point( 3*W/4, 3*W/8 );
rook_points[6] = new Point( 3*W/4, W/8 );
rook_points[7] = new Point( 26*W/40, W/8 );
rook_points[8] = new Point( 26*W/40, W/4 );
rook_points[9] = new Point( 22*W/40, W/4 );
Reported by PMD.
Line: 129
rook_points[2] = new Point( 3*W/4, 13*W/16 );
rook_points[3] = new Point( 11*W/16, 13*W/16 );
rook_points[4] = new Point( 19*W/32, 3*W/8 );
rook_points[5] = new Point( 3*W/4, 3*W/8 );
rook_points[6] = new Point( 3*W/4, W/8 );
rook_points[7] = new Point( 26*W/40, W/8 );
rook_points[8] = new Point( 26*W/40, W/4 );
rook_points[9] = new Point( 22*W/40, W/4 );
rook_points[10] = new Point( 22*W/40, W/8 );
Reported by PMD.
samples/python/gaussian_mix.py
23 issues
Line: 12
Column: 1
xrange = range
import numpy as np
import cv2 as cv
from numpy import random
def make_gaussians(cluster_n, img_size):
points = []
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
# Python 2/3 compatibility
from __future__ import print_function
import sys
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
Reported by Pylint.
Line: 9
Column: 5
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
import numpy as np
import cv2 as cv
from numpy import random
Reported by Pylint.
Line: 11
Column: 1
if PY3:
xrange = range
import numpy as np
import cv2 as cv
from numpy import random
def make_gaussians(cluster_n, img_size):
Reported by Pylint.
Line: 12
Column: 1
xrange = range
import numpy as np
import cv2 as cv
from numpy import random
def make_gaussians(cluster_n, img_size):
points = []
Reported by Pylint.
Line: 14
Column: 1
import numpy as np
import cv2 as cv
from numpy import random
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
for _i in xrange(cluster_n):
Reported by Pylint.
Line: 16
Column: 1
from numpy import random
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
for _i in xrange(cluster_n):
mean = (0.1 + 0.8*random.rand(2)) * img_size
a = (random.rand(2, 2)-0.5)*img_size*0.1
Reported by Pylint.
Line: 21
Column: 9
ref_distrs = []
for _i in xrange(cluster_n):
mean = (0.1 + 0.8*random.rand(2)) * img_size
a = (random.rand(2, 2)-0.5)*img_size*0.1
cov = np.dot(a.T, a) + img_size*0.05*np.eye(2)
n = 100 + random.randint(900)
pts = random.multivariate_normal(mean, cov, n)
points.append( pts )
ref_distrs.append( (mean, cov) )
Reported by Pylint.
Line: 23
Column: 9
mean = (0.1 + 0.8*random.rand(2)) * img_size
a = (random.rand(2, 2)-0.5)*img_size*0.1
cov = np.dot(a.T, a) + img_size*0.05*np.eye(2)
n = 100 + random.randint(900)
pts = random.multivariate_normal(mean, cov, n)
points.append( pts )
ref_distrs.append( (mean, cov) )
points = np.float32( np.vstack(points) )
return points, ref_distrs
Reported by Pylint.
Line: 30
Column: 1
points = np.float32( np.vstack(points) )
return points, ref_distrs
def draw_gaussain(img, mean, cov, color):
x, y = mean
w, u, _vt = cv.SVDecomp(cov)
ang = np.arctan2(u[1, 0], u[0, 0])*(180/np.pi)
s1, s2 = np.sqrt(w)*3.0
cv.ellipse(img, (int(x), int(y)), (int(s1), int(s2)), ang, 0, 360, color, 1, cv.LINE_AA)
Reported by Pylint.
modules/core/misc/java/test/ScalarTest.java
23 issues
Line: 6
import org.opencv.core.Scalar;
import org.opencv.test.OpenCVTestCase;
public class ScalarTest extends OpenCVTestCase {
private Scalar dstScalar;
private Scalar s1;
private Scalar s2;
Reported by PMD.
Line: 8
public class ScalarTest extends OpenCVTestCase {
private Scalar dstScalar;
private Scalar s1;
private Scalar s2;
@Override
protected void setUp() throws Exception {
Reported by PMD.
Line: 9
public class ScalarTest extends OpenCVTestCase {
private Scalar dstScalar;
private Scalar s1;
private Scalar s2;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 10
private Scalar dstScalar;
private Scalar s1;
private Scalar s2;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 12
private Scalar s1;
private Scalar s2;
@Override
protected void setUp() throws Exception {
super.setUp();
s1 = new Scalar(1.0);
s2 = Scalar.all(1.0);
Reported by PMD.
Line: 18
s1 = new Scalar(1.0);
s2 = Scalar.all(1.0);
dstScalar = null;
}
public void testAll() {
dstScalar = Scalar.all(2.0);
Scalar truth = new Scalar(2.0, 2.0, 2.0, 2.0);
Reported by PMD.
Line: 21
dstScalar = null;
}
public void testAll() {
dstScalar = Scalar.all(2.0);
Scalar truth = new Scalar(2.0, 2.0, 2.0, 2.0);
assertEquals(truth, dstScalar);
}
Reported by PMD.
Line: 27
assertEquals(truth, dstScalar);
}
public void testClone() {
dstScalar = s2.clone();
assertEquals(s2, dstScalar);
}
public void testConj() {
Reported by PMD.
Line: 32
assertEquals(s2, dstScalar);
}
public void testConj() {
dstScalar = s2.conj();
Scalar truth = new Scalar(1, -1, -1, -1);
assertEquals(truth, dstScalar);
}
Reported by PMD.
Line: 38
assertEquals(truth, dstScalar);
}
public void testEqualsObject() {
dstScalar = s2.clone();
assertTrue(s2.equals(dstScalar));
assertFalse(s2.equals(s1));
}
Reported by PMD.
samples/java/tutorial_code/objectDetection/cascade_classifier/ObjectDetectionDemo.java
23 issues
Line: 58
CascadeClassifier eyesCascade = new CascadeClassifier();
if (!faceCascade.load(filenameFaceCascade)) {
System.err.println("--(!)Error loading face cascade: " + filenameFaceCascade);
System.exit(0);
}
if (!eyesCascade.load(filenameEyesCascade)) {
System.err.println("--(!)Error loading eyes cascade: " + filenameEyesCascade);
System.exit(0);
Reported by PMD.
Line: 62
System.exit(0);
}
if (!eyesCascade.load(filenameEyesCascade)) {
System.err.println("--(!)Error loading eyes cascade: " + filenameEyesCascade);
System.exit(0);
}
VideoCapture capture = new VideoCapture(cameraDevice);
if (!capture.isOpened()) {
Reported by PMD.
Line: 68
VideoCapture capture = new VideoCapture(cameraDevice);
if (!capture.isOpened()) {
System.err.println("--(!)Error opening video capture");
System.exit(0);
}
Mat frame = new Mat();
while (capture.read(frame)) {
Reported by PMD.
Line: 75
Mat frame = new Mat();
while (capture.read(frame)) {
if (frame.empty()) {
System.err.println("--(!) No captured frame -- Break!");
break;
}
//-- 3. Apply the classifier to the frame
detectAndDisplay(frame, faceCascade, eyesCascade);
Reported by PMD.
Line: 15
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.videoio.VideoCapture;
class ObjectDetection {
public void detectAndDisplay(Mat frame, CascadeClassifier faceCascade, CascadeClassifier eyesCascade) {
Mat frameGray = new Mat();
Imgproc.cvtColor(frame, frameGray, Imgproc.COLOR_BGR2GRAY);
Imgproc.equalizeHist(frameGray, frameGray);
Reported by PMD.
Line: 15
import org.opencv.objdetect.CascadeClassifier;
import org.opencv.videoio.VideoCapture;
class ObjectDetection {
public void detectAndDisplay(Mat frame, CascadeClassifier faceCascade, CascadeClassifier eyesCascade) {
Mat frameGray = new Mat();
Imgproc.cvtColor(frame, frameGray, Imgproc.COLOR_BGR2GRAY);
Imgproc.equalizeHist(frameGray, frameGray);
Reported by PMD.
Line: 27
List<Rect> listOfFaces = faces.toList();
for (Rect face : listOfFaces) {
Point center = new Point(face.x + face.width / 2, face.y + face.height / 2);
Imgproc.ellipse(frame, center, new Size(face.width / 2, face.height / 2), 0, 0, 360,
new Scalar(255, 0, 255));
Mat faceROI = frameGray.submat(face);
Reported by PMD.
Line: 28
List<Rect> listOfFaces = faces.toList();
for (Rect face : listOfFaces) {
Point center = new Point(face.x + face.width / 2, face.y + face.height / 2);
Imgproc.ellipse(frame, center, new Size(face.width / 2, face.height / 2), 0, 0, 360,
new Scalar(255, 0, 255));
Mat faceROI = frameGray.submat(face);
// -- In each face, detect eyes
Reported by PMD.
Line: 29
for (Rect face : listOfFaces) {
Point center = new Point(face.x + face.width / 2, face.y + face.height / 2);
Imgproc.ellipse(frame, center, new Size(face.width / 2, face.height / 2), 0, 0, 360,
new Scalar(255, 0, 255));
Mat faceROI = frameGray.submat(face);
// -- In each face, detect eyes
MatOfRect eyes = new MatOfRect();
Reported by PMD.
Line: 34
Mat faceROI = frameGray.submat(face);
// -- In each face, detect eyes
MatOfRect eyes = new MatOfRect();
eyesCascade.detectMultiScale(faceROI, eyes);
List<Rect> listOfEyes = eyes.toList();
for (Rect eye : listOfEyes) {
Point eyeCenter = new Point(face.x + eye.x + eye.width / 2, face.y + eye.y + eye.height / 2);
Reported by PMD.
samples/python/drawing.py
23 issues
Line: 13
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
# Drawing Lines
def lines():
for i in range(NUMBER*2):
pt1, pt2 = [], []
Reported by Pylint.
Line: 3
Column: 1
#!/usr/bin/env python
'''
This program demonstrates OpenCV drawing and text output functions by drawing different shapes and text strings
Usage :
python3 drawing.py
Press any button to exit
'''
# Python 2/3 compatibility
Reported by Pylint.
Line: 16
Column: 1
import cv2 as cv
# Drawing Lines
def lines():
for i in range(NUMBER*2):
pt1, pt2 = [], []
pt1.append(np.random.randint(x1, x2))
pt1.append(np.random.randint(y1, y2))
pt2.append(np.random.randint(x1, x2))
Reported by Pylint.
Line: 26
Column: 1
color = "%06x" % np.random.randint(0, 0xFFFFFF)
color = tuple(int(color[i:i+2], 16) for i in (0, 2 ,4))
arrowed = np.random.randint(0, 6)
if (arrowed<3):
cv.line(image, tuple(pt1), tuple(pt2), color, np.random.randint(1, 10), lineType)
else:
cv.arrowedLine(image, tuple(pt1), tuple(pt2), color, np.random.randint(1, 10), lineType)
cv.imshow(wndname, image)
if cv.waitKey(DELAY)>=0:
Reported by Pylint.
Line: 35
Column: 1
return
# Drawing Rectangle
def rectangle():
for i in range(NUMBER*2):
pt1, pt2 = [], []
pt1.append(np.random.randint(x1, x2))
pt1.append(np.random.randint(y1, y2))
pt2.append(np.random.randint(x1, x2))
Reported by Pylint.
Line: 48
Column: 1
marker = np.random.randint(0, 10)
marker_size = np.random.randint(30, 80)
if (marker > 5):
cv.rectangle(image, tuple(pt1), tuple(pt2), color, max(thickness, -1), lineType)
else:
cv.drawMarker(image, tuple(pt1), color, marker, marker_size)
cv.imshow(wndname, image)
if cv.waitKey(DELAY)>=0:
Reported by Pylint.
Line: 57
Column: 1
return
# Drawing ellipse
def ellipse():
for i in range(NUMBER*2):
center = []
center.append(np.random.randint(x1, x2))
center.append(np.random.randint(x1, x2))
axes = []
Reported by Pylint.
Line: 69
Column: 1
color = "%06x" % np.random.randint(0, 0xFFFFFF)
color = tuple(int(color[i:i+2], 16) for i in (0, 2 ,4))
thickness = np.random.randint(-1, 9)
cv.ellipse(image, tuple(center), tuple(axes), angle, angle-100, angle + 200, color, thickness, lineType)
cv.imshow(wndname, image)
if cv.waitKey(DELAY)>=0:
return
# Drawing Polygonal Curves
Reported by Pylint.
Line: 75
Column: 1
return
# Drawing Polygonal Curves
def polygonal():
for i in range(NUMBER):
pt = [(0, 0)]*6
pt = np.resize(pt, (2, 3, 2))
pt[0][0][0] = np.random.randint(x1, x2)
pt[0][0][1] = np.random.randint(y1, y2)
Reported by Pylint.
Line: 77
Column: 9
# Drawing Polygonal Curves
def polygonal():
for i in range(NUMBER):
pt = [(0, 0)]*6
pt = np.resize(pt, (2, 3, 2))
pt[0][0][0] = np.random.randint(x1, x2)
pt[0][0][1] = np.random.randint(y1, y2)
pt[0][1][0] = np.random.randint(x1, x2)
pt[0][1][1] = np.random.randint(y1, y2)
Reported by Pylint.
modules/dnn/misc/java/test/DnnTensorFlowTest.java
23 issues
Line: 58
String envTestDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
if(envTestDataPath == null) throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
File testDataPath = new File(envTestDataPath);
File f = new File(testDataPath, "dnn/grace_hopper_227.png");
sourceImageFile = f.toString();
Reported by PMD.
Line: 64
File f = new File(testDataPath, "dnn/grace_hopper_227.png");
sourceImageFile = f.toString();
if(!f.exists()) throw new Exception("Test image is missing: " + sourceImageFile);
net = Dnn.readNetFromTensorflow(modelFileName);
}
public void testGetLayerTypes() {
Reported by PMD.
Line: 135
byte[] modelBuffer = new byte[ (int)modelFile.length() ];
try {
FileInputStream fis = new FileInputStream(modelFile);
fis.read(modelBuffer);
fis.close();
} catch (IOException e) {
fail("Failed to read a model: " + e.getMessage());
}
Reported by PMD.
Line: 28
private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
String modelFileName = "";
String sourceImageFile = "";
Net net;
private static void normAssert(Mat ref, Mat test) {
Reported by PMD.
Line: 29
private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
String modelFileName = "";
String sourceImageFile = "";
Net net;
private static void normAssert(Mat ref, Mat test) {
final double l1 = 1e-5;
Reported by PMD.
Line: 31
String modelFileName = "";
String sourceImageFile = "";
Net net;
private static void normAssert(Mat ref, Mat test) {
final double l1 = 1e-5;
final double lInf = 1e-4;
double normL1 = Core.norm(ref, test, Core.NORM_L1) / ref.total();
Reported by PMD.
Line: 42
assertTrue(normLInf < lInf);
}
@Override
protected void setUp() throws Exception {
super.setUp();
String envDnnTestDataPath = System.getenv(ENV_OPENCV_DNN_TEST_DATA_PATH);
Reported by PMD.
Line: 69
net = Dnn.readNetFromTensorflow(modelFileName);
}
public void testGetLayerTypes() {
List<String> layertypes = new ArrayList();
net.getLayerTypes(layertypes);
assertFalse("No layer types returned!", layertypes.isEmpty());
}
Reported by PMD.
Line: 76
assertFalse("No layer types returned!", layertypes.isEmpty());
}
public void testGetLayer() {
List<String> layernames = net.getLayerNames();
assertFalse("Test net returned no layers!", layernames.isEmpty());
String testLayerName = layernames.get(0);
Reported by PMD.
Line: 76
assertFalse("No layer types returned!", layertypes.isEmpty());
}
public void testGetLayer() {
List<String> layernames = net.getLayerNames();
assertFalse("Test net returned no layers!", layernames.isEmpty());
String testLayerName = layernames.get(0);
Reported by PMD.
samples/python/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.py
23 issues
Line: 4
Column: 1
from __future__ import print_function
import sys
import cv2 as cv
import numpy as np
def print_help():
print('''
Reported by Pylint.
Line: 52
Column: 5
cv.log(magI, magI)
## [log]
## [crop_rearrange]
magI_rows, magI_cols = magI.shape
# crop the spectrum, if it has an odd number of rows or columns
magI = magI[0:(magI_rows & -2), 0:(magI_cols & -2)]
cx = int(magI_rows/2)
cy = int(magI_cols/2)
Reported by Pylint.
Line: 54
Column: 12
## [crop_rearrange]
magI_rows, magI_cols = magI.shape
# crop the spectrum, if it has an odd number of rows or columns
magI = magI[0:(magI_rows & -2), 0:(magI_cols & -2)]
cx = int(magI_rows/2)
cy = int(magI_cols/2)
q0 = magI[0:cx, 0:cy] # Top-Left - Create a ROI per quadrant
q1 = magI[cx:cx+cx, 0:cy] # Top-Right
Reported by Pylint.
Line: 1
Column: 1
from __future__ import print_function
import sys
import cv2 as cv
import numpy as np
def print_help():
print('''
Reported by Pylint.
Line: 8
Column: 1
import numpy as np
def print_help():
print('''
This program demonstrated the use of the discrete Fourier transform (DFT).
The dft of an image is taken and it's power spectrum is displayed.
Usage:
discrete_fourier_transform.py [image_name -- default lena.jpg]''')
Reported by Pylint.
Line: 16
Column: 1
discrete_fourier_transform.py [image_name -- default lena.jpg]''')
def main(argv):
print_help()
filename = argv[0] if len(argv) > 0 else 'lena.jpg'
Reported by Pylint.
Line: 16
Column: 1
discrete_fourier_transform.py [image_name -- default lena.jpg]''')
def main(argv):
print_help()
filename = argv[0] if len(argv) > 0 else 'lena.jpg'
Reported by Pylint.
Line: 16
Column: 1
discrete_fourier_transform.py [image_name -- default lena.jpg]''')
def main(argv):
print_help()
filename = argv[0] if len(argv) > 0 else 'lena.jpg'
Reported by Pylint.
Line: 22
Column: 5
filename = argv[0] if len(argv) > 0 else 'lena.jpg'
I = cv.imread(cv.samples.findFile(filename), cv.IMREAD_GRAYSCALE)
if I is None:
print('Error opening image')
return -1
## [expand]
rows, cols = I.shape
Reported by Pylint.
Line: 28
Column: 5
return -1
## [expand]
rows, cols = I.shape
m = cv.getOptimalDFTSize( rows )
n = cv.getOptimalDFTSize( cols )
padded = cv.copyMakeBorder(I, 0, m - rows, 0, n - cols, cv.BORDER_CONSTANT, value=[0, 0, 0])
## [expand]
## [complex_and_real]
planes = [np.float32(padded), np.zeros(padded.shape, np.float32)]
Reported by Pylint.
samples/dnn/dnn_model_runner/dnn_conversion/common/evaluation/classification/cls_data_fetcher.py
23 issues
Line: 4
Column: 1
import os
from abc import ABCMeta, abstractmethod
import cv2
import numpy as np
from ...img_utils import read_rgb_img, get_pytorch_preprocess
from ...test.configs.default_preprocess_config import PYTORCH_RSZ_HEIGHT, PYTORCH_RSZ_WIDTH
Reported by Pylint.
Line: 7
Column: 1
import cv2
import numpy as np
from ...img_utils import read_rgb_img, get_pytorch_preprocess
from ...test.configs.default_preprocess_config import PYTORCH_RSZ_HEIGHT, PYTORCH_RSZ_WIDTH
class DataFetch(object):
imgs_dir = ''
Reported by Pylint.
Line: 8
Column: 1
import numpy as np
from ...img_utils import read_rgb_img, get_pytorch_preprocess
from ...test.configs.default_preprocess_config import PYTORCH_RSZ_HEIGHT, PYTORCH_RSZ_WIDTH
class DataFetch(object):
imgs_dir = ''
frame_size = 0
Reported by Pylint.
Line: 74
Column: 20
img = cv2.resize(img, (PYTORCH_RSZ_WIDTH, PYTORCH_RSZ_HEIGHT))
img = self.center_crop(img)
if self.preprocess_input:
return self.presprocess_input(img)
return get_pytorch_preprocess(img)
class TFPreprocessedFetch(DataFetch):
def __init__(self, tf_cls_config, preprocess_input):
Reported by Pylint.
Line: 1
Column: 1
import os
from abc import ABCMeta, abstractmethod
import cv2
import numpy as np
from ...img_utils import read_rgb_img, get_pytorch_preprocess
from ...test.configs.default_preprocess_config import PYTORCH_RSZ_HEIGHT, PYTORCH_RSZ_WIDTH
Reported by Pylint.
Line: 11
Column: 1
from ...test.configs.default_preprocess_config import PYTORCH_RSZ_HEIGHT, PYTORCH_RSZ_WIDTH
class DataFetch(object):
imgs_dir = ''
frame_size = 0
bgr_to_rgb = False
__metaclass__ = ABCMeta
Reported by Pylint.
Line: 11
Column: 1
from ...test.configs.default_preprocess_config import PYTORCH_RSZ_HEIGHT, PYTORCH_RSZ_WIDTH
class DataFetch(object):
imgs_dir = ''
frame_size = 0
bgr_to_rgb = False
__metaclass__ = ABCMeta
Reported by Pylint.
Line: 19
Column: 5
__metaclass__ = ABCMeta
@abstractmethod
def preprocess(self, img):
pass
@staticmethod
def reshape_img(img):
img = img[:, :, 0:3].transpose(2, 0, 1)
Reported by Pylint.
Line: 23
Column: 5
pass
@staticmethod
def reshape_img(img):
img = img[:, :, 0:3].transpose(2, 0, 1)
return np.expand_dims(img, 0)
def center_crop(self, img):
cols = img.shape[1]
Reported by Pylint.
Line: 27
Column: 5
img = img[:, :, 0:3].transpose(2, 0, 1)
return np.expand_dims(img, 0)
def center_crop(self, img):
cols = img.shape[1]
rows = img.shape[0]
y1 = round((rows - self.frame_size) / 2)
y2 = round(y1 + self.frame_size)
Reported by Pylint.
platforms/osx/build_docs.py
22 issues
Line: 7
Column: 1
"""
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 7
Column: 1
"""
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 8
Column: 1
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 8
Column: 1
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 8
Column: 1
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 8
Column: 1
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 12
Column: 1
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
class OSXDocBuilder(DocBuilder):
def getToolchain(self):
return None
Reported by Pylint.
Line: 7
Column: 1
"""
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Pylint.
Line: 8
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
from __future__ import print_function
import os, sys, multiprocessing, argparse, traceback
from subprocess import check_call, check_output, CalledProcessError, Popen
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
Reported by Bandit.
Line: 12
Column: 1
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_docs import DocBuilder
class OSXDocBuilder(DocBuilder):
def getToolchain(self):
return None
Reported by Pylint.
modules/python/test/test_houghcircles.py
22 issues
Line: 10
Column: 1
# Python 2/3 compatibility
from __future__ import print_function
import cv2 as cv
import numpy as np
import sys
from numpy import pi, sin, cos
from tests_common import NewOpenCVTests
Reported by Pylint.
Line: 12
Column: 1
import cv2 as cv
import numpy as np
import sys
from numpy import pi, sin, cos
from tests_common import NewOpenCVTests
def circleApproximation(circle):
Reported by Pylint.
Line: 12
Column: 1
import cv2 as cv
import numpy as np
import sys
from numpy import pi, sin, cos
from tests_common import NewOpenCVTests
def circleApproximation(circle):
Reported by Pylint.
Line: 17
Column: 1
from tests_common import NewOpenCVTests
def circleApproximation(circle):
nPoints = 30
dPhi = 2*pi / nPoints
contour = []
for i in range(nPoints):
Reported by Pylint.
Line: 17
Column: 1
from tests_common import NewOpenCVTests
def circleApproximation(circle):
nPoints = 30
dPhi = 2*pi / nPoints
contour = []
for i in range(nPoints):
Reported by Pylint.
Line: 19
Column: 5
def circleApproximation(circle):
nPoints = 30
dPhi = 2*pi / nPoints
contour = []
for i in range(nPoints):
contour.append(([circle[0] + circle[2]*cos(i*dPhi),
circle[1] + circle[2]*sin(i*dPhi)]))
Reported by Pylint.
Line: 20
Column: 5
def circleApproximation(circle):
nPoints = 30
dPhi = 2*pi / nPoints
contour = []
for i in range(nPoints):
contour.append(([circle[0] + circle[2]*cos(i*dPhi),
circle[1] + circle[2]*sin(i*dPhi)]))
Reported by Pylint.
Line: 28
Column: 1
return np.array(contour).astype(int)
def convContoursIntersectiponRate(c1, c2):
s1 = cv.contourArea(c1)
s2 = cv.contourArea(c2)
s, _ = cv.intersectConvexConvex(c1, c2)
Reported by Pylint.
Line: 28
Column: 1
return np.array(contour).astype(int)
def convContoursIntersectiponRate(c1, c2):
s1 = cv.contourArea(c1)
s2 = cv.contourArea(c2)
s, _ = cv.intersectConvexConvex(c1, c2)
Reported by Pylint.
Line: 28
Column: 1
return np.array(contour).astype(int)
def convContoursIntersectiponRate(c1, c2):
s1 = cv.contourArea(c1)
s2 = cv.contourArea(c2)
s, _ = cv.intersectConvexConvex(c1, c2)
Reported by Pylint.