The following issues were found
modules/highgui/misc/java/src/java/highgui+ImageWindow.java
19 issues
Line: 19
public final static int WINDOW_NORMAL = 0;
public final static int WINDOW_AUTOSIZE = 1;
public String name;
public Mat img = null;
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
Reported by PMD.
Line: 20
public final static int WINDOW_AUTOSIZE = 1;
public String name;
public Mat img = null;
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
Reported by PMD.
Line: 20
public final static int WINDOW_AUTOSIZE = 1;
public String name;
public Mat img = null;
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
Reported by PMD.
Line: 21
public String name;
public Mat img = null;
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
Reported by PMD.
Line: 22
public String name;
public Mat img = null;
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
public int flag;
Reported by PMD.
Line: 23
public Mat img = null;
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
public int flag;
public int x = -1;
Reported by PMD.
Line: 24
public Boolean alreadyUsed = false;
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
public int flag;
public int x = -1;
public int y = -1;
Reported by PMD.
Line: 25
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
public int flag;
public int x = -1;
public int y = -1;
public int width = -1;
Reported by PMD.
Line: 25
public Boolean imgToBeResized = false;
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
public int flag;
public int x = -1;
public int y = -1;
public int width = -1;
Reported by PMD.
Line: 26
public Boolean windowToBeResized = false;
public Boolean positionToBeChanged = false;
public JFrame frame = null;
public JLabel lbl = null;
public int flag;
public int x = -1;
public int y = -1;
public int width = -1;
public int height = -1;
Reported by PMD.
samples/dnn/action_recognition.py
19 issues
Line: 3
Column: 1
import os
import numpy as np
import cv2 as cv
import argparse
from common import findFile
parser = argparse.ArgumentParser(description='Use this script to run action recognition using 3D ResNet34',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
Reported by Pylint.
Line: 1
Column: 1
import os
import numpy as np
import cv2 as cv
import argparse
from common import findFile
parser = argparse.ArgumentParser(description='Use this script to run action recognition using 3D ResNet34',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
Reported by Pylint.
Line: 1
Column: 1
import os
import numpy as np
import cv2 as cv
import argparse
from common import findFile
parser = argparse.ArgumentParser(description='Use this script to run action recognition using 3D ResNet34',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
Reported by Pylint.
Line: 4
Column: 1
import os
import numpy as np
import cv2 as cv
import argparse
from common import findFile
parser = argparse.ArgumentParser(description='Use this script to run action recognition using 3D ResNet34',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
Reported by Pylint.
Line: 7
Column: 1
import argparse
from common import findFile
parser = argparse.ArgumentParser(description='Use this script to run action recognition using 3D ResNet34',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
parser.add_argument('--model', required=True, help='Path to model.')
parser.add_argument('--classes', default=findFile('action_recongnition_kinetics.txt'), help='Path to classes list.')
Reported by Pylint.
Line: 9
Column: 1
parser = argparse.ArgumentParser(description='Use this script to run action recognition using 3D ResNet34',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
parser.add_argument('--model', required=True, help='Path to model.')
parser.add_argument('--classes', default=findFile('action_recongnition_kinetics.txt'), help='Path to classes list.')
# To get net download original repository https://github.com/kenshohara/video-classification-3d-cnn-pytorch
# For correct ONNX export modify file: video-classification-3d-cnn-pytorch/models/resnet.py
Reported by Pylint.
Line: 11
Column: 1
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--input', '-i', help='Path to input video file. Skip this argument to capture frames from a camera.')
parser.add_argument('--model', required=True, help='Path to model.')
parser.add_argument('--classes', default=findFile('action_recongnition_kinetics.txt'), help='Path to classes list.')
# To get net download original repository https://github.com/kenshohara/video-classification-3d-cnn-pytorch
# For correct ONNX export modify file: video-classification-3d-cnn-pytorch/models/resnet.py
# change
# - def downsample_basic_block(x, planes, stride):
Reported by Pylint.
Line: 13
Column: 1
parser.add_argument('--model', required=True, help='Path to model.')
parser.add_argument('--classes', default=findFile('action_recongnition_kinetics.txt'), help='Path to classes list.')
# To get net download original repository https://github.com/kenshohara/video-classification-3d-cnn-pytorch
# For correct ONNX export modify file: video-classification-3d-cnn-pytorch/models/resnet.py
# change
# - def downsample_basic_block(x, planes, stride):
# - out = F.avg_pool3d(x, kernel_size=1, stride=stride)
# - zero_pads = torch.Tensor(out.size(0), planes - out.size(1),
Reported by Pylint.
Line: 35
Column: 1
# To ONNX export use torch.onnx.export(model, inputs, model_name)
def get_class_names(path):
class_names = []
with open(path) as f:
for row in f:
class_names.append(row[:-1])
return class_names
Reported by Pylint.
Line: 37
Column: 24
def get_class_names(path):
class_names = []
with open(path) as f:
for row in f:
class_names.append(row[:-1])
return class_names
def classify_video(video_path, net_path):
Reported by Pylint.
samples/dnn/edge_detection.py
18 issues
Line: 1
Column: 1
import cv2 as cv
import argparse
parser = argparse.ArgumentParser(
description='This sample shows how to define custom OpenCV deep learning layers in Python. '
'Holistically-Nested Edge Detection (https://arxiv.org/abs/1504.06375) neural network '
'is used as an example model. Find a pre-trained model at https://github.com/s9xie/hed.')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
parser.add_argument('--prototxt', help='Path to deploy.prototxt', required=True)
Reported by Pylint.
Line: 17
Column: 32
#! [CropLayer]
class CropLayer(object):
def __init__(self, params, blobs):
self.xstart = 0
self.xend = 0
self.ystart = 0
self.yend = 0
Reported by Pylint.
Line: 17
Column: 24
#! [CropLayer]
class CropLayer(object):
def __init__(self, params, blobs):
self.xstart = 0
self.xend = 0
self.ystart = 0
self.yend = 0
Reported by Pylint.
Line: 1
Column: 1
import cv2 as cv
import argparse
parser = argparse.ArgumentParser(
description='This sample shows how to define custom OpenCV deep learning layers in Python. '
'Holistically-Nested Edge Detection (https://arxiv.org/abs/1504.06375) neural network '
'is used as an example model. Find a pre-trained model at https://github.com/s9xie/hed.')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
parser.add_argument('--prototxt', help='Path to deploy.prototxt', required=True)
Reported by Pylint.
Line: 2
Column: 1
import cv2 as cv
import argparse
parser = argparse.ArgumentParser(
description='This sample shows how to define custom OpenCV deep learning layers in Python. '
'Holistically-Nested Edge Detection (https://arxiv.org/abs/1504.06375) neural network '
'is used as an example model. Find a pre-trained model at https://github.com/s9xie/hed.')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
parser.add_argument('--prototxt', help='Path to deploy.prototxt', required=True)
Reported by Pylint.
Line: 6
Column: 1
parser = argparse.ArgumentParser(
description='This sample shows how to define custom OpenCV deep learning layers in Python. '
'Holistically-Nested Edge Detection (https://arxiv.org/abs/1504.06375) neural network '
'is used as an example model. Find a pre-trained model at https://github.com/s9xie/hed.')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
parser.add_argument('--prototxt', help='Path to deploy.prototxt', required=True)
parser.add_argument('--caffemodel', help='Path to hed_pretrained_bsds.caffemodel', required=True)
parser.add_argument('--width', help='Resize input image to a specific width', default=500, type=int)
Reported by Pylint.
Line: 7
Column: 1
parser = argparse.ArgumentParser(
description='This sample shows how to define custom OpenCV deep learning layers in Python. '
'Holistically-Nested Edge Detection (https://arxiv.org/abs/1504.06375) neural network '
'is used as an example model. Find a pre-trained model at https://github.com/s9xie/hed.')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
parser.add_argument('--prototxt', help='Path to deploy.prototxt', required=True)
parser.add_argument('--caffemodel', help='Path to hed_pretrained_bsds.caffemodel', required=True)
parser.add_argument('--width', help='Resize input image to a specific width', default=500, type=int)
parser.add_argument('--height', help='Resize input image to a specific height', default=500, type=int)
Reported by Pylint.
Line: 12
Column: 1
parser.add_argument('--prototxt', help='Path to deploy.prototxt', required=True)
parser.add_argument('--caffemodel', help='Path to hed_pretrained_bsds.caffemodel', required=True)
parser.add_argument('--width', help='Resize input image to a specific width', default=500, type=int)
parser.add_argument('--height', help='Resize input image to a specific height', default=500, type=int)
args = parser.parse_args()
#! [CropLayer]
class CropLayer(object):
def __init__(self, params, blobs):
Reported by Pylint.
Line: 16
Column: 1
args = parser.parse_args()
#! [CropLayer]
class CropLayer(object):
def __init__(self, params, blobs):
self.xstart = 0
self.xend = 0
self.ystart = 0
self.yend = 0
Reported by Pylint.
Line: 16
Column: 1
args = parser.parse_args()
#! [CropLayer]
class CropLayer(object):
def __init__(self, params, blobs):
self.xstart = 0
self.xend = 0
self.ystart = 0
self.yend = 0
Reported by Pylint.
samples/java/tutorial_code/ImgTrans/HoughLine/HoughLines.java
18 issues
Line: 27
// Check if image is loaded fine
if( src.empty() ) {
System.out.println("Error opening image!");
System.out.println("Program Arguments: [image_name -- default "
+ default_file +"] \n");
System.exit(-1);
}
//! [load]
Reported by PMD.
Line: 28
// Check if image is loaded fine
if( src.empty() ) {
System.out.println("Error opening image!");
System.out.println("Program Arguments: [image_name -- default "
+ default_file +"] \n");
System.exit(-1);
}
//! [load]
Reported by PMD.
Line: 26
Mat src = Imgcodecs.imread(filename, Imgcodecs.IMREAD_GRAYSCALE);
// Check if image is loaded fine
if( src.empty() ) {
System.out.println("Error opening image!");
System.out.println("Program Arguments: [image_name -- default "
+ default_file +"] \n");
System.exit(-1);
}
Reported by PMD.
Line: 30
System.out.println("Error opening image!");
System.out.println("Program Arguments: [image_name -- default "
+ default_file +"] \n");
System.exit(-1);
}
//! [load]
//! [edge_detection]
// Edge detection
Reported by PMD.
Line: 56
double a = Math.cos(theta), b = Math.sin(theta);
double x0 = a*rho, y0 = b*rho;
Point pt1 = new Point(Math.round(x0 + 1000*(-b)), Math.round(y0 + 1000*(a)));
Point pt2 = new Point(Math.round(x0 - 1000*(-b)), Math.round(y0 - 1000*(a)));
Imgproc.line(cdst, pt1, pt2, new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
}
//! [draw_lines]
Reported by PMD.
Line: 57
double a = Math.cos(theta), b = Math.sin(theta);
double x0 = a*rho, y0 = b*rho;
Point pt1 = new Point(Math.round(x0 + 1000*(-b)), Math.round(y0 + 1000*(a)));
Point pt2 = new Point(Math.round(x0 - 1000*(-b)), Math.round(y0 - 1000*(a)));
Imgproc.line(cdst, pt1, pt2, new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
}
//! [draw_lines]
//! [hough_lines_p]
Reported by PMD.
Line: 58
double x0 = a*rho, y0 = b*rho;
Point pt1 = new Point(Math.round(x0 + 1000*(-b)), Math.round(y0 + 1000*(a)));
Point pt2 = new Point(Math.round(x0 - 1000*(-b)), Math.round(y0 - 1000*(a)));
Imgproc.line(cdst, pt1, pt2, new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
}
//! [draw_lines]
//! [hough_lines_p]
// Probabilistic Line Transform
Reported by PMD.
Line: 71
// Draw the lines
for (int x = 0; x < linesP.rows(); x++) {
double[] l = linesP.get(x, 0);
Imgproc.line(cdstP, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
}
//! [draw_lines_p]
//! [imshow]
// Show results
Reported by PMD.
Line: 71
// Draw the lines
for (int x = 0; x < linesP.rows(); x++) {
double[] l = linesP.get(x, 0);
Imgproc.line(cdstP, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
}
//! [draw_lines_p]
//! [imshow]
// Show results
Reported by PMD.
Line: 71
// Draw the lines
for (int x = 0; x < linesP.rows(); x++) {
double[] l = linesP.get(x, 0);
Imgproc.line(cdstP, new Point(l[0], l[1]), new Point(l[2], l[3]), new Scalar(0, 0, 255), 3, Imgproc.LINE_AA, 0);
}
//! [draw_lines_p]
//! [imshow]
// Show results
Reported by PMD.
modules/python/test/test_gaussian_mix.py
18 issues
Line: 13
Column: 1
import numpy as np
from numpy import random
import cv2 as cv
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
for _ in xrange(cluster_n):
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
from numpy import random
import cv2 as cv
Reported by Pylint.
Line: 11
Column: 1
if PY3:
xrange = range
import numpy as np
from numpy import random
import cv2 as cv
def make_gaussians(cluster_n, img_size):
points = []
Reported by Pylint.
Line: 12
Column: 1
xrange = range
import numpy as np
from numpy import random
import cv2 as cv
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
Reported by Pylint.
Line: 13
Column: 1
import numpy as np
from numpy import random
import cv2 as cv
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
for _ in xrange(cluster_n):
Reported by Pylint.
Line: 15
Column: 1
from numpy import random
import cv2 as cv
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
for _ 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: 20
Column: 9
ref_distrs = []
for _ 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: 22
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: 29
Column: 1
points = np.float32( np.vstack(points) )
return points, ref_distrs
from tests_common import NewOpenCVTests
class gaussian_mix_test(NewOpenCVTests):
def test_gaussian_mix(self):
Reported by Pylint.
samples/java/tutorial_code/video/background_subtraction/BackgroundSubtractionDemo.java
18 issues
Line: 29
//! [capture]
VideoCapture capture = new VideoCapture(input);
if (!capture.isOpened()) {
System.err.println("Unable to open: " + input);
System.exit(0);
}
//! [capture]
Mat frame = new Mat(), fgMask = new Mat();
Reported by PMD.
Line: 15
class BackgroundSubtraction {
public void run(String[] args) {
String input = args.length > 0 ? args[0] : "../data/vtest.avi";
boolean useMOG2 = args.length > 1 ? args[1] == "MOG2" : true;
//! [create]
BackgroundSubtractor backSub;
if (useMOG2) {
backSub = Video.createBackgroundSubtractorMOG2();
Reported by PMD.
Line: 15
class BackgroundSubtraction {
public void run(String[] args) {
String input = args.length > 0 ? args[0] : "../data/vtest.avi";
boolean useMOG2 = args.length > 1 ? args[1] == "MOG2" : true;
//! [create]
BackgroundSubtractor backSub;
if (useMOG2) {
backSub = Video.createBackgroundSubtractorMOG2();
Reported by PMD.
Line: 15
class BackgroundSubtraction {
public void run(String[] args) {
String input = args.length > 0 ? args[0] : "../data/vtest.avi";
boolean useMOG2 = args.length > 1 ? args[1] == "MOG2" : true;
//! [create]
BackgroundSubtractor backSub;
if (useMOG2) {
backSub = Video.createBackgroundSubtractorMOG2();
Reported by PMD.
Line: 30
VideoCapture capture = new VideoCapture(input);
if (!capture.isOpened()) {
System.err.println("Unable to open: " + input);
System.exit(0);
}
//! [capture]
Mat frame = new Mat(), fgMask = new Mat();
while (true) {
Reported by PMD.
Line: 48
//! [display_frame_number]
// get the frame number and write it on the current frame
Imgproc.rectangle(frame, new Point(10, 2), new Point(100, 20), new Scalar(255, 255, 255), -1);
String frameNumberString = String.format("%d", (int)capture.get(Videoio.CAP_PROP_POS_FRAMES));
Imgproc.putText(frame, frameNumberString, new Point(15, 15), Core.FONT_HERSHEY_SIMPLEX, 0.5,
new Scalar(0, 0, 0));
//! [display_frame_number]
Reported by PMD.
Line: 48
//! [display_frame_number]
// get the frame number and write it on the current frame
Imgproc.rectangle(frame, new Point(10, 2), new Point(100, 20), new Scalar(255, 255, 255), -1);
String frameNumberString = String.format("%d", (int)capture.get(Videoio.CAP_PROP_POS_FRAMES));
Imgproc.putText(frame, frameNumberString, new Point(15, 15), Core.FONT_HERSHEY_SIMPLEX, 0.5,
new Scalar(0, 0, 0));
//! [display_frame_number]
Reported by PMD.
Line: 48
//! [display_frame_number]
// get the frame number and write it on the current frame
Imgproc.rectangle(frame, new Point(10, 2), new Point(100, 20), new Scalar(255, 255, 255), -1);
String frameNumberString = String.format("%d", (int)capture.get(Videoio.CAP_PROP_POS_FRAMES));
Imgproc.putText(frame, frameNumberString, new Point(15, 15), Core.FONT_HERSHEY_SIMPLEX, 0.5,
new Scalar(0, 0, 0));
//! [display_frame_number]
Reported by PMD.
Line: 50
// get the frame number and write it on the current frame
Imgproc.rectangle(frame, new Point(10, 2), new Point(100, 20), new Scalar(255, 255, 255), -1);
String frameNumberString = String.format("%d", (int)capture.get(Videoio.CAP_PROP_POS_FRAMES));
Imgproc.putText(frame, frameNumberString, new Point(15, 15), Core.FONT_HERSHEY_SIMPLEX, 0.5,
new Scalar(0, 0, 0));
//! [display_frame_number]
//! [show]
// show the current frame and the fg masks
Reported by PMD.
Line: 51
Imgproc.rectangle(frame, new Point(10, 2), new Point(100, 20), new Scalar(255, 255, 255), -1);
String frameNumberString = String.format("%d", (int)capture.get(Videoio.CAP_PROP_POS_FRAMES));
Imgproc.putText(frame, frameNumberString, new Point(15, 15), Core.FONT_HERSHEY_SIMPLEX, 0.5,
new Scalar(0, 0, 0));
//! [display_frame_number]
//! [show]
// show the current frame and the fg masks
HighGui.imshow("Frame", frame);
Reported by PMD.
samples/java/tutorial_code/highgui/trackbar/AddingImagesTrackbar.java
18 issues
Line: 40
matImgSrc2 = Imgcodecs.imread(imagePath2);
//! [load]
if (matImgSrc1.empty()) {
System.out.println("Empty image: " + imagePath1);
System.exit(0);
}
if (matImgSrc2.empty()) {
System.out.println("Empty image: " + imagePath2);
System.exit(0);
Reported by PMD.
Line: 44
System.exit(0);
}
if (matImgSrc2.empty()) {
System.out.println("Empty image: " + imagePath2);
System.exit(0);
}
//! [window]
// Create and set up the window.
Reported by PMD.
Line: 21
public class AddingImagesTrackbar {
private static final int ALPHA_SLIDER_MAX = 100;
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 21
public class AddingImagesTrackbar {
private static final int ALPHA_SLIDER_MAX = 100;
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 22
public class AddingImagesTrackbar {
private static final int ALPHA_SLIDER_MAX = 100;
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 22
public class AddingImagesTrackbar {
private static final int ALPHA_SLIDER_MAX = 100;
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 23
private static final int ALPHA_SLIDER_MAX = 100;
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public AddingImagesTrackbar(String[] args) {
Reported by PMD.
Line: 23
private static final int ALPHA_SLIDER_MAX = 100;
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public AddingImagesTrackbar(String[] args) {
Reported by PMD.
Line: 24
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public AddingImagesTrackbar(String[] args) {
//! [load]
Reported by PMD.
Line: 24
private int alphaVal = 0;
private Mat matImgSrc1;
private Mat matImgSrc2;
private Mat matImgDst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public AddingImagesTrackbar(String[] args) {
//! [load]
Reported by PMD.
samples/java/tutorial_code/Histograms_Matching/histogram_calculation/CalcHistDemo.java
18 issues
Line: 21
String filename = args.length > 0 ? args[0] : "../data/lena.jpg";
Mat src = Imgcodecs.imread(filename);
if (src.empty()) {
System.err.println("Cannot read image: " + filename);
System.exit(0);
}
//! [Load image]
//! [Separate the image in 3 places ( B, G and R )]
Reported by PMD.
Line: 20
//! [Load image]
String filename = args.length > 0 ? args[0] : "../data/lena.jpg";
Mat src = Imgcodecs.imread(filename);
if (src.empty()) {
System.err.println("Cannot read image: " + filename);
System.exit(0);
}
//! [Load image]
Reported by PMD.
Line: 22
Mat src = Imgcodecs.imread(filename);
if (src.empty()) {
System.err.println("Cannot read image: " + filename);
System.exit(0);
}
//! [Load image]
//! [Separate the image in 3 places ( B, G and R )]
List<Mat> bgrPlanes = new ArrayList<>();
Reported by PMD.
Line: 73
rHist.get(0, 0, rHistData);
for( int i = 1; i < histSize; i++ ) {
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(bHistData[i - 1])),
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
Reported by PMD.
Line: 74
for( int i = 1; i < histSize; i++ ) {
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(bHistData[i - 1])),
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
}
Reported by PMD.
Line: 74
for( int i = 1; i < histSize; i++ ) {
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(bHistData[i - 1])),
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
}
Reported by PMD.
Line: 75
for( int i = 1; i < histSize; i++ ) {
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(bHistData[i - 1])),
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
}
//! [Draw for each channel]
Reported by PMD.
Line: 76
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(bHistData[i - 1])),
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
}
//! [Draw for each channel]
Reported by PMD.
Line: 76
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(bHistData[i - 1])),
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
}
//! [Draw for each channel]
Reported by PMD.
Line: 77
new Point(binW * (i), histH - Math.round(bHistData[i])), new Scalar(255, 0, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(gHistData[i - 1])),
new Point(binW * (i), histH - Math.round(gHistData[i])), new Scalar(0, 255, 0), 2);
Imgproc.line(histImage, new Point(binW * (i - 1), histH - Math.round(rHistData[i - 1])),
new Point(binW * (i), histH - Math.round(rHistData[i])), new Scalar(0, 0, 255), 2);
}
//! [Draw for each channel]
//! [Display]
Reported by PMD.
samples/java/tutorial_code/ImgProc/threshold/Threshold.java
18 issues
Line: 46
// Load an image
src = Imgcodecs.imread(imagePath);
if (src.empty()) {
System.out.println("Empty image: " + imagePath);
System.exit(0);
}
// Convert the image to Gray
Imgproc.cvtColor(src, srcGray, Imgproc.COLOR_BGR2GRAY);
//! [load]
Reported by PMD.
Line: 29
+ "1: Binary Inverted <br> 2: Truncate <br> "
+ "3: To Zero <br> 4: To Zero Inverted</body></html>";
private static final String TRACKBAR_VALUE = "Value";
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
Reported by PMD.
Line: 29
+ "1: Binary Inverted <br> 2: Truncate <br> "
+ "3: To Zero <br> 4: To Zero Inverted</body></html>";
private static final String TRACKBAR_VALUE = "Value";
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
Reported by PMD.
Line: 30
+ "3: To Zero <br> 4: To Zero Inverted</body></html>";
private static final String TRACKBAR_VALUE = "Value";
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 31
private static final String TRACKBAR_VALUE = "Value";
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 31
private static final String TRACKBAR_VALUE = "Value";
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 31
private static final String TRACKBAR_VALUE = "Value";
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
Reported by PMD.
Line: 32
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public Threshold(String[] args) {
Reported by PMD.
Line: 32
private int thresholdValue = 0;
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public Threshold(String[] args) {
Reported by PMD.
Line: 33
private int thresholdType = 3;
private Mat src;
private Mat srcGray = new Mat();
private Mat dst = new Mat();
private JFrame frame;
private JLabel imgLabel;
public Threshold(String[] args) {
//! [load]
Reported by PMD.
modules/python/test/test_kmeans.py
18 issues
Line: 11
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
from numpy import random
import sys
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
Reported by Pylint.
Line: 13
Column: 1
import numpy as np
import cv2 as cv
from numpy import random
import sys
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
from tests_common import NewOpenCVTests
Reported by Pylint.
Line: 16
Column: 5
import sys
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
from tests_common import NewOpenCVTests
def make_gaussians(cluster_n, img_size):
points = []
Reported by Pylint.
Line: 18
Column: 1
if PY3:
xrange = range
from tests_common import NewOpenCVTests
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
sizes = []
Reported by Pylint.
Line: 20
Column: 1
from tests_common import NewOpenCVTests
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
sizes = []
for _ in xrange(cluster_n):
mean = (0.1 + 0.8*random.rand(2)) * img_size
Reported by Pylint.
Line: 26
Column: 9
sizes = []
for _ 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: 28
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) )
sizes.append(n)
points = np.float32( np.vstack(points) )
Reported by Pylint.
Line: 36
Column: 1
points = np.float32( np.vstack(points) )
return points, ref_distrs, sizes
def getMainLabelConfidence(labels, nLabels):
n = len(labels)
labelsDict = dict.fromkeys(range(nLabels), 0)
labelsConfDict = dict.fromkeys(range(nLabels))
Reported by Pylint.
Line: 36
Column: 1
points = np.float32( np.vstack(points) )
return points, ref_distrs, sizes
def getMainLabelConfidence(labels, nLabels):
n = len(labels)
labelsDict = dict.fromkeys(range(nLabels), 0)
labelsConfDict = dict.fromkeys(range(nLabels))
Reported by Pylint.
Line: 36
Column: 1
points = np.float32( np.vstack(points) )
return points, ref_distrs, sizes
def getMainLabelConfidence(labels, nLabels):
n = len(labels)
labelsDict = dict.fromkeys(range(nLabels), 0)
labelsConfDict = dict.fromkeys(range(nLabels))
Reported by Pylint.