The following issues were found
samples/python/houghcircles.py
10 issues
Line: 15
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
import sys
def main():
try:
Reported by Pylint.
Line: 34
Column: 9
if circles is not None: # Check if circles have been found and only then iterate over these and add them to the image
circles = np.uint16(np.around(circles))
_a, b, _c = circles.shape
for i in range(b):
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv.LINE_AA)
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv.LINE_AA) # draw center of circle
cv.imshow("detected circles", cimg)
Reported by Pylint.
Line: 17
Column: 1
import numpy as np
import cv2 as cv
import sys
def main():
try:
fn = sys.argv[1]
except IndexError:
Reported by Pylint.
Line: 19
Column: 1
import sys
def main():
try:
fn = sys.argv[1]
except IndexError:
fn = 'board.jpg'
Reported by Pylint.
Line: 21
Column: 9
def main():
try:
fn = sys.argv[1]
except IndexError:
fn = 'board.jpg'
src = cv.imread(cv.samples.findFile(fn))
img = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
Reported by Pylint.
Line: 23
Column: 9
try:
fn = sys.argv[1]
except IndexError:
fn = 'board.jpg'
src = cv.imread(cv.samples.findFile(fn))
img = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
img = cv.medianBlur(img, 5)
cimg = src.copy() # numpy function
Reported by Pylint.
Line: 32
Column: 1
circles = cv.HoughCircles(img, cv.HOUGH_GRADIENT, 1, 10, np.array([]), 100, 30, 1, 30)
if circles is not None: # Check if circles have been found and only then iterate over these and add them to the image
circles = np.uint16(np.around(circles))
_a, b, _c = circles.shape
for i in range(b):
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv.LINE_AA)
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv.LINE_AA) # draw center of circle
Reported by Pylint.
Line: 34
Column: 13
if circles is not None: # Check if circles have been found and only then iterate over these and add them to the image
circles = np.uint16(np.around(circles))
_a, b, _c = circles.shape
for i in range(b):
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv.LINE_AA)
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv.LINE_AA) # draw center of circle
cv.imshow("detected circles", cimg)
Reported by Pylint.
Line: 36
Column: 1
circles = np.uint16(np.around(circles))
_a, b, _c = circles.shape
for i in range(b):
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv.LINE_AA)
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv.LINE_AA) # draw center of circle
cv.imshow("detected circles", cimg)
cv.imshow("source", src)
Reported by Pylint.
Line: 37
Column: 1
_a, b, _c = circles.shape
for i in range(b):
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv.LINE_AA)
cv.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv.LINE_AA) # draw center of circle
cv.imshow("detected circles", cimg)
cv.imshow("source", src)
cv.waitKey(0)
Reported by Pylint.
modules/core/misc/java/src/java/core+Scalar.java
10 issues
Line: 29
val = vals.clone();
else {
val = new double[4];
set(vals);
}
}
public void set(double[] vals) {
if (vals != null) {
Reported by PMD.
Line: 47
return new Scalar(v, v, v, v);
}
public Scalar clone() {
return new Scalar(val);
}
public Scalar mul(Scalar it, double scale) {
return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale,
Reported by PMD.
Line: 6
//javadoc:Scalar_
public class Scalar {
public double val[];
public Scalar(double v0, double v1, double v2, double v3) {
val = new double[] { v0, v1, v2, v3 };
}
Reported by PMD.
Line: 47
return new Scalar(v, v, v, v);
}
public Scalar clone() {
return new Scalar(val);
}
public Scalar mul(Scalar it, double scale) {
return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale,
Reported by PMD.
Line: 47
return new Scalar(v, v, v, v);
}
public Scalar clone() {
return new Scalar(val);
}
public Scalar mul(Scalar it, double scale) {
return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale,
Reported by PMD.
Line: 72
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + java.util.Arrays.hashCode(val);
return result;
}
@Override
public boolean equals(Object obj) {
Reported by PMD.
Line: 81
if (this == obj) return true;
if (!(obj instanceof Scalar)) return false;
Scalar it = (Scalar) obj;
if (!java.util.Arrays.equals(val, it.val)) return false;
return true;
}
@Override
public String toString() {
Reported by PMD.
Line: 81
if (this == obj) return true;
if (!(obj instanceof Scalar)) return false;
Scalar it = (Scalar) obj;
if (!java.util.Arrays.equals(val, it.val)) return false;
return true;
}
@Override
public String toString() {
Reported by PMD.
Line: 24
val = new double[] { v0, 0, 0, 0 };
}
public Scalar(double[] vals) {
if (vals != null && vals.length == 4)
val = vals.clone();
else {
val = new double[4];
set(vals);
Reported by PMD.
Line: 33
}
}
public void set(double[] vals) {
if (vals != null) {
val[0] = vals.length > 0 ? vals[0] : 0;
val[1] = vals.length > 1 ? vals[1] : 0;
val[2] = vals.length > 2 ? vals[2] : 0;
val[3] = vals.length > 3 ? vals[3] : 0;
Reported by PMD.
modules/core/misc/java/src/java/core+RotatedRect.java
10 issues
Line: 24
public RotatedRect(double[] vals) {
this();
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
center.x = vals.length > 0 ? (double) vals[0] : 0;
Reported by PMD.
Line: 79
return r;
}
public RotatedRect clone() {
return new RotatedRect(center, size, angle);
}
@Override
public int hashCode() {
Reported by PMD.
Line: 6
//javadoc:RotatedRect_
public class RotatedRect {
public Point center;
public Size size;
public double angle;
public RotatedRect() {
this.center = new Point();
Reported by PMD.
Line: 7
public class RotatedRect {
public Point center;
public Size size;
public double angle;
public RotatedRect() {
this.center = new Point();
this.size = new Size();
Reported by PMD.
Line: 8
public Point center;
public Size size;
public double angle;
public RotatedRect() {
this.center = new Point();
this.size = new Size();
this.angle = 0;
Reported by PMD.
Line: 79
return r;
}
public RotatedRect clone() {
return new RotatedRect(center, size, angle);
}
@Override
public int hashCode() {
Reported by PMD.
Line: 79
return r;
}
public RotatedRect clone() {
return new RotatedRect(center, size, angle);
}
@Override
public int hashCode() {
Reported by PMD.
Line: 22
this.angle = a;
}
public RotatedRect(double[] vals) {
this();
set(vals);
}
public void set(double[] vals) {
Reported by PMD.
Line: 27
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
center.x = vals.length > 0 ? (double) vals[0] : 0;
center.y = vals.length > 1 ? (double) vals[1] : 0;
size.width = vals.length > 2 ? (double) vals[2] : 0;
size.height = vals.length > 3 ? (double) vals[3] : 0;
Reported by PMD.
Line: 43
}
}
public void points(Point pt[])
{
double _angle = angle * Math.PI / 180.0;
double b = (double) Math.cos(_angle) * 0.5f;
double a = (double) Math.sin(_angle) * 0.5f;
Reported by PMD.
samples/dnn/dnn_model_runner/dnn_conversion/common/test/cls_model_test_pipeline.py
10 issues
Line: 1
Column: 1
from .configs.test_config import TestClsConfig, TestClsModuleConfig
from .model_test_pipeline import ModelTestPipeline
from ..evaluation.classification.cls_accuracy_evaluator import ClsAccEvaluation
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
Reported by Pylint.
Line: 2
Column: 1
from .configs.test_config import TestClsConfig, TestClsModuleConfig
from .model_test_pipeline import ModelTestPipeline
from ..evaluation.classification.cls_accuracy_evaluator import ClsAccEvaluation
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
Reported by Pylint.
Line: 3
Column: 1
from .configs.test_config import TestClsConfig, TestClsModuleConfig
from .model_test_pipeline import ModelTestPipeline
from ..evaluation.classification.cls_accuracy_evaluator import ClsAccEvaluation
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
Reported by Pylint.
Line: 4
Column: 1
from .configs.test_config import TestClsConfig, TestClsModuleConfig
from .model_test_pipeline import ModelTestPipeline
from ..evaluation.classification.cls_accuracy_evaluator import ClsAccEvaluation
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
Reported by Pylint.
Line: 56
Column: 9
))
def _configure_acc_eval(self, log_path):
self._accuracy_evaluator = ClsAccEvaluation(
log_path,
self.test_config.img_cls_file,
self.test_config.batch_size
)
Reported by Pylint.
Line: 1
Column: 1
from .configs.test_config import TestClsConfig, TestClsModuleConfig
from .model_test_pipeline import ModelTestPipeline
from ..evaluation.classification.cls_accuracy_evaluator import ClsAccEvaluation
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
Reported by Pylint.
Line: 7
Column: 1
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
network_model,
model_processor,
dnn_model_processor,
Reported by Pylint.
Line: 7
Column: 1
from ..utils import get_test_module
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
network_model,
model_processor,
dnn_model_processor,
Reported by Pylint.
Line: 8
Column: 5
class ClsModelTestPipeline(ModelTestPipeline):
def __init__(
self,
network_model,
model_processor,
dnn_model_processor,
data_fetcher,
Reported by Pylint.
Line: 18
Column: 9
cls_args_parser=None,
default_input_blob_preproc=None
):
super(ClsModelTestPipeline, self).__init__(
network_model,
model_processor,
dnn_model_processor
)
Reported by Pylint.
modules/core/misc/java/src/java/core+Point3.java
10 issues
Line: 26
public Point3(double[] vals) {
this();
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
x = vals.length > 0 ? vals[0] : 0;
Reported by PMD.
Line: 41
}
}
public Point3 clone() {
return new Point3(x, y, z);
}
public double dot(Point3 p) {
return x * p.x + y * p.y + z * p.z;
Reported by PMD.
Line: 6
//javadoc:Point3_
public class Point3 {
public double x, y, z;
public Point3(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
Reported by PMD.
Line: 6
//javadoc:Point3_
public class Point3 {
public double x, y, z;
public Point3(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
Reported by PMD.
Line: 6
//javadoc:Point3_
public class Point3 {
public double x, y, z;
public Point3(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
Reported by PMD.
Line: 41
}
}
public Point3 clone() {
return new Point3(x, y, z);
}
public double dot(Point3 p) {
return x * p.x + y * p.y + z * p.z;
Reported by PMD.
Line: 41
}
}
public Point3 clone() {
return new Point3(x, y, z);
}
public double dot(Point3 p) {
return x * p.x + y * p.y + z * p.z;
Reported by PMD.
Line: 6
//javadoc:Point3_
public class Point3 {
public double x, y, z;
public Point3(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
Reported by PMD.
Line: 24
z = 0;
}
public Point3(double[] vals) {
this();
set(vals);
}
public void set(double[] vals) {
Reported by PMD.
Line: 29
set(vals);
}
public void set(double[] vals) {
if (vals != null) {
x = vals.length > 0 ? vals[0] : 0;
y = vals.length > 1 ? vals[1] : 0;
z = vals.length > 2 ? vals[2] : 0;
} else {
Reported by PMD.
3rdparty/openexr/Imath/ImathVec.h
10 issues
Line: 856
CWE codes:
758
inline T &
Vec2<T>::operator [] (int i)
{
return (&x)[i];
}
template <class T>
inline const T &
Vec2<T>::operator [] (int i) const
Reported by Cppcheck.
Line: 863
CWE codes:
758
inline const T &
Vec2<T>::operator [] (int i) const
{
return (&x)[i];
}
template <class T>
inline
Vec2<T>::Vec2 ()
Reported by Cppcheck.
Line: 1277
CWE codes:
758
inline T &
Vec3<T>::operator [] (int i)
{
return (&x)[i];
}
template <class T>
inline const T &
Vec3<T>::operator [] (int i) const
Reported by Cppcheck.
Line: 1277
CWE codes:
758
inline T &
Vec3<T>::operator [] (int i)
{
return (&x)[i];
}
template <class T>
inline const T &
Vec3<T>::operator [] (int i) const
Reported by Cppcheck.
Line: 1277
CWE codes:
758
inline T &
Vec3<T>::operator [] (int i)
{
return (&x)[i];
}
template <class T>
inline const T &
Vec3<T>::operator [] (int i) const
Reported by Cppcheck.
Line: 1284
CWE codes:
758
inline const T &
Vec3<T>::operator [] (int i) const
{
return (&x)[i];
}
template <class T>
inline
Vec3<T>::Vec3 ()
Reported by Cppcheck.
Line: 1284
CWE codes:
758
inline const T &
Vec3<T>::operator [] (int i) const
{
return (&x)[i];
}
template <class T>
inline
Vec3<T>::Vec3 ()
Reported by Cppcheck.
Line: 1284
CWE codes:
758
inline const T &
Vec3<T>::operator [] (int i) const
{
return (&x)[i];
}
template <class T>
inline
Vec3<T>::Vec3 ()
Reported by Cppcheck.
Line: 1771
CWE codes:
758
inline T &
Vec4<T>::operator [] (int i)
{
return (&x)[i];
}
template <class T>
inline const T &
Vec4<T>::operator [] (int i) const
Reported by Cppcheck.
Line: 1778
CWE codes:
758
inline const T &
Vec4<T>::operator [] (int i) const
{
return (&x)[i];
}
template <class T>
inline
Vec4<T>::Vec4 ()
Reported by Cppcheck.
modules/python/package/cv2/_extra_py_code/__init__.py
10 issues
Line: 36
Column: 3
del sys.modules[__name__ + name]
# TODO: listdir
def init(base):
_load_py_code(base, '.cv2') # special case
prefix = base
prefix_len = len(prefix)
Reported by Pylint.
Line: 1
Column: 1
import sys
import importlib
__all__ = ['init']
DEBUG = False
if hasattr(sys, 'OpenCV_LOADER_DEBUG'):
DEBUG = True
Reported by Pylint.
Line: 14
Column: 9
def _load_py_code(base, name):
try:
m = importlib.import_module(__name__ + name)
except ImportError:
return # extension doesn't exist?
if DEBUG: print('OpenCV loader: added python code extension for: ' + name)
Reported by Pylint.
Line: 18
Column: 15
except ImportError:
return # extension doesn't exist?
if DEBUG: print('OpenCV loader: added python code extension for: ' + name)
if hasattr(m, '__all__'):
export_members = { k : getattr(m, k) for k in m.__all__ }
else:
export_members = m.__dict__
Reported by Pylint.
Line: 25
Column: 12
else:
export_members = m.__dict__
for k, v in export_members.items():
if k.startswith('_'): # skip internals
continue
if isinstance(v, type(sys)): # don't bring modules
continue
if DEBUG: print(' symbol: {} = {}'.format(k, v))
Reported by Pylint.
Line: 30
Column: 19
continue
if isinstance(v, type(sys)): # don't bring modules
continue
if DEBUG: print(' symbol: {} = {}'.format(k, v))
setattr(sys.modules[base + name ], k, v)
del sys.modules[__name__ + name]
Reported by Pylint.
Line: 37
Column: 1
# TODO: listdir
def init(base):
_load_py_code(base, '.cv2') # special case
prefix = base
prefix_len = len(prefix)
modules = [ m for m in sys.modules.keys() if m.startswith(prefix) ]
Reported by Pylint.
Line: 42
Column: 28
prefix = base
prefix_len = len(prefix)
modules = [ m for m in sys.modules.keys() if m.startswith(prefix) ]
for m in modules:
m2 = m[prefix_len:] # strip prefix
if len(m2) == 0:
continue
if m2.startswith('._'): # skip internals
Reported by Pylint.
Line: 43
Column: 9
prefix_len = len(prefix)
modules = [ m for m in sys.modules.keys() if m.startswith(prefix) ]
for m in modules:
m2 = m[prefix_len:] # strip prefix
if len(m2) == 0:
continue
if m2.startswith('._'): # skip internals
continue
Reported by Pylint.
Line: 44
Column: 9
modules = [ m for m in sys.modules.keys() if m.startswith(prefix) ]
for m in modules:
m2 = m[prefix_len:] # strip prefix
if len(m2) == 0:
continue
if m2.startswith('._'): # skip internals
continue
if m2.startswith('.load_config_'): # skip helper files
Reported by Pylint.
samples/python/tutorial_code/features2D/feature_homography/SURF_FLANN_matching_homography_Demo.py
10 issues
Line: 2
Column: 1
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Code for Feature Matching with FLANN tutorial.')
parser.add_argument('--input1', help='Path to input image 1.', default='box.png')
parser.add_argument('--input2', help='Path to input image 2.', default='box_in_scene.png')
args = parser.parse_args()
Reported by Pylint.
Line: 1
Column: 1
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Code for Feature Matching with FLANN tutorial.')
parser.add_argument('--input1', help='Path to input image 1.', default='box.png')
parser.add_argument('--input2', help='Path to input image 2.', default='box_in_scene.png')
args = parser.parse_args()
Reported by Pylint.
Line: 1
Column: 1
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Code for Feature Matching with FLANN tutorial.')
parser.add_argument('--input1', help='Path to input image 1.', default='box.png')
parser.add_argument('--input2', help='Path to input image 2.', default='box_in_scene.png')
args = parser.parse_args()
Reported by Pylint.
Line: 4
Column: 1
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Code for Feature Matching with FLANN tutorial.')
parser.add_argument('--input1', help='Path to input image 1.', default='box.png')
parser.add_argument('--input2', help='Path to input image 2.', default='box_in_scene.png')
args = parser.parse_args()
Reported by Pylint.
Line: 15
Column: 5
img_scene = cv.imread(cv.samples.findFile(args.input2), cv.IMREAD_GRAYSCALE)
if img_object is None or img_scene is None:
print('Could not open or find the images!')
exit(0)
#-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors
minHessian = 400
detector = cv.xfeatures2d_SURF.create(hessianThreshold=minHessian)
keypoints_obj, descriptors_obj = detector.detectAndCompute(img_object, None)
Reported by Pylint.
Line: 18
Column: 1
exit(0)
#-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors
minHessian = 400
detector = cv.xfeatures2d_SURF.create(hessianThreshold=minHessian)
keypoints_obj, descriptors_obj = detector.detectAndCompute(img_object, None)
keypoints_scene, descriptors_scene = detector.detectAndCompute(img_scene, None)
#-- Step 2: Matching descriptor vectors with a FLANN based matcher
Reported by Pylint.
Line: 29
Column: 1
knn_matches = matcher.knnMatch(descriptors_obj, descriptors_scene, 2)
#-- Filter matches using the Lowe's ratio test
ratio_thresh = 0.75
good_matches = []
for m,n in knn_matches:
if m.distance < ratio_thresh * n.distance:
good_matches.append(m)
Reported by Pylint.
Line: 36
Column: 1
good_matches.append(m)
#-- Draw matches
img_matches = np.empty((max(img_object.shape[0], img_scene.shape[0]), img_object.shape[1]+img_scene.shape[1], 3), dtype=np.uint8)
cv.drawMatches(img_object, keypoints_obj, img_scene, keypoints_scene, good_matches, img_matches, flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
#-- Localize the object
obj = np.empty((len(good_matches),2), dtype=np.float32)
scene = np.empty((len(good_matches),2), dtype=np.float32)
Reported by Pylint.
Line: 37
Column: 1
#-- Draw matches
img_matches = np.empty((max(img_object.shape[0], img_scene.shape[0]), img_object.shape[1]+img_scene.shape[1], 3), dtype=np.uint8)
cv.drawMatches(img_object, keypoints_obj, img_scene, keypoints_scene, good_matches, img_matches, flags=cv.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
#-- Localize the object
obj = np.empty((len(good_matches),2), dtype=np.float32)
scene = np.empty((len(good_matches),2), dtype=np.float32)
for i in range(len(good_matches)):
Reported by Pylint.
Line: 42
Column: 1
#-- Localize the object
obj = np.empty((len(good_matches),2), dtype=np.float32)
scene = np.empty((len(good_matches),2), dtype=np.float32)
for i in range(len(good_matches)):
#-- Get the keypoints from the good matches
obj[i,0] = keypoints_obj[good_matches[i].queryIdx].pt[0]
obj[i,1] = keypoints_obj[good_matches[i].queryIdx].pt[1]
scene[i,0] = keypoints_scene[good_matches[i].trainIdx].pt[0]
scene[i,1] = keypoints_scene[good_matches[i].trainIdx].pt[1]
Reported by Pylint.
modules/ml/misc/java/test/MLTest.java
10 issues
Line: 14
public class MLTest extends OpenCVTestCase {
public void testSaveLoad() {
Mat samples = new MatOfFloat(new float[] {
5.1f, 3.5f, 1.4f, 0.2f,
4.9f, 3.0f, 1.4f, 0.2f,
4.7f, 3.2f, 1.3f, 0.2f,
4.6f, 3.1f, 1.5f, 0.2f,
Reported by PMD.
Line: 14
public class MLTest extends OpenCVTestCase {
public void testSaveLoad() {
Mat samples = new MatOfFloat(new float[] {
5.1f, 3.5f, 1.4f, 0.2f,
4.9f, 3.0f, 1.4f, 0.2f,
4.7f, 3.2f, 1.3f, 0.2f,
4.6f, 3.1f, 1.5f, 0.2f,
Reported by PMD.
Line: 31
0, 0, 0, 0, 0, 1, 1, 1, 1, 1
}).reshape(1, 10);
SVM saved = SVM.create();
assertFalse(saved.isTrained());
saved.train(samples, Ml.ROW_SAMPLE, responses);
assertTrue(saved.isTrained());
String filename = OpenCVTestRunner.getTempFileName("yml");
Reported by PMD.
Line: 33
SVM saved = SVM.create();
assertFalse(saved.isTrained());
saved.train(samples, Ml.ROW_SAMPLE, responses);
assertTrue(saved.isTrained());
String filename = OpenCVTestRunner.getTempFileName("yml");
saved.save(filename);
SVM loaded = SVM.load(filename);
Reported by PMD.
Line: 34
assertFalse(saved.isTrained());
saved.train(samples, Ml.ROW_SAMPLE, responses);
assertTrue(saved.isTrained());
String filename = OpenCVTestRunner.getTempFileName("yml");
saved.save(filename);
SVM loaded = SVM.load(filename);
assertTrue(saved.isTrained());
Reported by PMD.
Line: 37
assertTrue(saved.isTrained());
String filename = OpenCVTestRunner.getTempFileName("yml");
saved.save(filename);
SVM loaded = SVM.load(filename);
assertTrue(saved.isTrained());
}
}
Reported by PMD.
Line: 38
String filename = OpenCVTestRunner.getTempFileName("yml");
saved.save(filename);
SVM loaded = SVM.load(filename);
assertTrue(saved.isTrained());
}
}
Reported by PMD.
Line: 39
String filename = OpenCVTestRunner.getTempFileName("yml");
saved.save(filename);
SVM loaded = SVM.load(filename);
assertTrue(saved.isTrained());
}
}
Reported by PMD.
Line: 8
import org.opencv.core.Mat;
import org.opencv.core.MatOfFloat;
import org.opencv.core.MatOfInt;
import org.opencv.core.CvType;
import org.opencv.test.OpenCVTestCase;
import org.opencv.test.OpenCVTestRunner;
public class MLTest extends OpenCVTestCase {
Reported by PMD.
Line: 38
String filename = OpenCVTestRunner.getTempFileName("yml");
saved.save(filename);
SVM loaded = SVM.load(filename);
assertTrue(saved.isTrained());
}
}
Reported by PMD.
modules/core/misc/java/src/java/core+CvType.java
9 issues
Line: 3
package org.opencv.core;
public final class CvType {
// type depth constants
public static final int
CV_8U = 0,
CV_8S = 1,
CV_16U = 2,
Reported by PMD.
Line: 3
package org.opencv.core;
public final class CvType {
// type depth constants
public static final int
CV_8U = 0,
CV_8S = 1,
CV_16U = 2,
Reported by PMD.
Line: 3
package org.opencv.core;
public final class CvType {
// type depth constants
public static final int
CV_8U = 0,
CV_8S = 1,
CV_16U = 2,
Reported by PMD.
Line: 91
return depth(type) < CV_32F;
}
public static final int ELEM_SIZE(int type) {
switch (depth(type)) {
case CV_8U:
case CV_8S:
return channels(type);
case CV_16U:
Reported by PMD.
Line: 111
}
}
public static final String typeToString(int type) {
String s;
switch (depth(type)) {
case CV_8U:
s = "CV_8U";
break;
Reported by PMD.
Line: 111
}
}
public static final String typeToString(int type) {
String s;
switch (depth(type)) {
case CV_8U:
s = "CV_8U";
break;
Reported by PMD.
Line: 144
}
int ch = channels(type);
if (ch <= 4)
return s + "C" + ch;
else
return s + "C(" + ch + ")";
}
Reported by PMD.
Line: 23
public static final int CV_USRTYPE1 = CV_16F;
// predefined type constants
public static final int
CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
Reported by PMD.
Line: 33
CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4),
CV_16FC1 = CV_16FC(1), CV_16FC2 = CV_16FC(2), CV_16FC3 = CV_16FC(3), CV_16FC4 = CV_16FC(4);
private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
public static final int makeType(int depth, int channels) {
if (channels <= 0 || channels >= CV_CN_MAX) {
throw new UnsupportedOperationException(
"Channels count should be 1.." + (CV_CN_MAX - 1));
Reported by PMD.