The following issues were found
samples/java/opencv_version.java
7 issues
Line: 11
if ((1==args.length) && (0==args[0].compareTo("--build"))) {
System.out.println(Core.getBuildInformation());
} else
if ((1==args.length) && (0==args[0].compareTo("--help"))) {
System.out.println("\t--build\n\t\tprint complete build info");
System.out.println("\t--help\n\t\tprint this help");
Reported by PMD.
Line: 15
} else
if ((1==args.length) && (0==args[0].compareTo("--help"))) {
System.out.println("\t--build\n\t\tprint complete build info");
System.out.println("\t--help\n\t\tprint this help");
} else {
System.out.println("Welcome to OpenCV " + Core.VERSION);
}
Reported by PMD.
Line: 16
if ((1==args.length) && (0==args[0].compareTo("--help"))) {
System.out.println("\t--build\n\t\tprint complete build info");
System.out.println("\t--help\n\t\tprint this help");
} else {
System.out.println("Welcome to OpenCV " + Core.VERSION);
}
}
Reported by PMD.
Line: 19
System.out.println("\t--help\n\t\tprint this help");
} else {
System.out.println("Welcome to OpenCV " + Core.VERSION);
}
}
}
Reported by PMD.
Line: 3
import org.opencv.core.Core;
class opencv_version {
static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
public static void main(String[] args) {
if ((1==args.length) && (0==args[0].compareTo("--build"))) {
Reported by PMD.
Line: 9
public static void main(String[] args) {
if ((1==args.length) && (0==args[0].compareTo("--build"))) {
System.out.println(Core.getBuildInformation());
} else
if ((1==args.length) && (0==args[0].compareTo("--help"))) {
Reported by PMD.
Line: 13
System.out.println(Core.getBuildInformation());
} else
if ((1==args.length) && (0==args[0].compareTo("--help"))) {
System.out.println("\t--build\n\t\tprint complete build info");
System.out.println("\t--help\n\t\tprint this help");
} else {
Reported by PMD.
samples/python/inpaint.py
7 issues
Line: 22
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
from common import Sketcher
def main():
import sys
Reported by Pylint.
Line: 30
Column: 5
import sys
try:
fn = sys.argv[1]
except:
fn = 'fruits.jpg'
img = cv.imread(cv.samples.findFile(fn))
if img is None:
print('Failed to load image file:', fn)
Reported by Pylint.
Line: 26
Column: 1
from common import Sketcher
def main():
import sys
try:
fn = sys.argv[1]
except:
fn = 'fruits.jpg'
Reported by Pylint.
Line: 27
Column: 5
from common import Sketcher
def main():
import sys
try:
fn = sys.argv[1]
except:
fn = 'fruits.jpg'
Reported by Pylint.
Line: 29
Column: 9
def main():
import sys
try:
fn = sys.argv[1]
except:
fn = 'fruits.jpg'
img = cv.imread(cv.samples.findFile(fn))
if img is None:
Reported by Pylint.
Line: 31
Column: 9
try:
fn = sys.argv[1]
except:
fn = 'fruits.jpg'
img = cv.imread(cv.samples.findFile(fn))
if img is None:
print('Failed to load image file:', fn)
sys.exit(1)
Reported by Pylint.
Line: 43
Column: 9
sketch = Sketcher('img', [img_mark, mark], lambda : ((255, 255, 255), 255))
while True:
ch = cv.waitKey()
if ch == 27:
break
if ch == ord(' '):
res = cv.inpaint(img_mark, mark, 3, cv.INPAINT_TELEA)
cv.imshow('inpaint', res)
Reported by Pylint.
samples/dnn/dnn_model_runner/dnn_conversion/pytorch/classification/py_to_py_resnet50_onnx.py
7 issues
Line: 3
Column: 1
import os
import torch
import torch.onnx
from torch.autograd import Variable
from torchvision import models
def get_pytorch_onnx_model(original_model):
Reported by Pylint.
Line: 4
Column: 1
import os
import torch
import torch.onnx
from torch.autograd import Variable
from torchvision import models
def get_pytorch_onnx_model(original_model):
Reported by Pylint.
Line: 5
Column: 1
import torch
import torch.onnx
from torch.autograd import Variable
from torchvision import models
def get_pytorch_onnx_model(original_model):
# define the directory for further converted model save
Reported by Pylint.
Line: 6
Column: 1
import torch
import torch.onnx
from torch.autograd import Variable
from torchvision import models
def get_pytorch_onnx_model(original_model):
# define the directory for further converted model save
onnx_model_path = "models"
Reported by Pylint.
Line: 1
Column: 1
import os
import torch
import torch.onnx
from torch.autograd import Variable
from torchvision import models
def get_pytorch_onnx_model(original_model):
Reported by Pylint.
Line: 9
Column: 1
from torchvision import models
def get_pytorch_onnx_model(original_model):
# define the directory for further converted model save
onnx_model_path = "models"
# define the name of further converted model
onnx_model_name = "resnet50.onnx"
Reported by Pylint.
Line: 40
Column: 1
return full_model_path
def main():
# initialize PyTorch ResNet-50 model
original_model = models.resnet50(pretrained=True)
# get the path to the converted into ONNX PyTorch model
full_model_path = get_pytorch_onnx_model(original_model)
Reported by Pylint.
modules/calib3d/misc/java/test/StereoBMTest.java
7 issues
Line: 7
public class StereoBMTest extends OpenCVTestCase {
public void testComputeMatMatMat() {
fail("Not yet implemented");
}
public void testComputeMatMatMatInt() {
fail("Not yet implemented");
Reported by PMD.
Line: 8
public class StereoBMTest extends OpenCVTestCase {
public void testComputeMatMatMat() {
fail("Not yet implemented");
}
public void testComputeMatMatMatInt() {
fail("Not yet implemented");
}
Reported by PMD.
Line: 11
fail("Not yet implemented");
}
public void testComputeMatMatMatInt() {
fail("Not yet implemented");
}
public void testStereoBM() {
fail("Not yet implemented");
Reported by PMD.
Line: 15
fail("Not yet implemented");
}
public void testStereoBM() {
fail("Not yet implemented");
}
public void testStereoBMInt() {
fail("Not yet implemented");
Reported by PMD.
Line: 19
fail("Not yet implemented");
}
public void testStereoBMInt() {
fail("Not yet implemented");
}
public void testStereoBMIntInt() {
fail("Not yet implemented");
Reported by PMD.
Line: 23
fail("Not yet implemented");
}
public void testStereoBMIntInt() {
fail("Not yet implemented");
}
public void testStereoBMIntIntInt() {
fail("Not yet implemented");
Reported by PMD.
Line: 27
fail("Not yet implemented");
}
public void testStereoBMIntIntInt() {
fail("Not yet implemented");
}
}
Reported by PMD.
platforms/android/ndk-16.config.py
7 issues
Line: 2
Column: 5
ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
Line: 3
Column: 5
ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
Line: 4
Column: 5
ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
Line: 5
Column: 5
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
Line: 6
Column: 5
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
Line: 1
Column: 1
ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
Line: 2
Column: 1
ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI("4", "x86", "x86-4.9"),
]
Reported by Pylint.
modules/video/misc/java/test/TrackerCreateTest.java
7 issues
Line: 16
public class TrackerCreateTest extends OpenCVTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
Reported by PMD.
Line: 17
public class TrackerCreateTest extends OpenCVTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
public void testCreateTrackerGOTURN() {
Reported by PMD.
Line: 22
}
public void testCreateTrackerGOTURN() {
try {
Tracker tracker = TrackerGOTURN.create();
assert(tracker != null);
} catch (CvException e) {
// expected, model files may be missing
Reported by PMD.
Line: 26
try {
Tracker tracker = TrackerGOTURN.create();
assert(tracker != null);
} catch (CvException e) {
// expected, model files may be missing
}
}
public void testCreateTrackerMIL() {
Reported by PMD.
Line: 31
}
}
public void testCreateTrackerMIL() {
Tracker tracker = TrackerMIL.create();
assert(tracker != null);
Mat mat = new Mat(100, 100, CvType.CV_8UC1);
Rect rect = new Rect(10, 10, 30, 30);
tracker.init(mat, rect); // should not crash (https://github.com/opencv/opencv/issues/19915)
Reported by PMD.
Line: 36
assert(tracker != null);
Mat mat = new Mat(100, 100, CvType.CV_8UC1);
Rect rect = new Rect(10, 10, 30, 30);
tracker.init(mat, rect); // should not crash (https://github.com/opencv/opencv/issues/19915)
}
}
Reported by PMD.
Line: 3
package org.opencv.test.video;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.CvException;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.test.OpenCVTestCase;
Reported by PMD.
modules/core/misc/java/src/java/core+MatOfPoint3f.java
7 issues
Line: 35
public MatOfPoint3f(Point3...a) {
super();
fromArray(a);
}
public void alloc(int elemNumber) {
if(elemNumber>0)
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
Reported by PMD.
Line: 48
return;
int num = a.length;
alloc(num);
float buff[] = new float[num * _channels];
for(int i=0; i<num; i++) {
Point3 p = a[i];
buff[_channels*i+0] = (float) p.x;
buff[_channels*i+1] = (float) p.y;
buff[_channels*i+2] = (float) p.z;
Reported by PMD.
Line: 51
float buff[] = new float[num * _channels];
for(int i=0; i<num; i++) {
Point3 p = a[i];
buff[_channels*i+0] = (float) p.x;
buff[_channels*i+1] = (float) p.y;
buff[_channels*i+2] = (float) p.z;
}
put(0, 0, buff); //TODO: check ret val!
}
Reported by PMD.
Line: 52
for(int i=0; i<num; i++) {
Point3 p = a[i];
buff[_channels*i+0] = (float) p.x;
buff[_channels*i+1] = (float) p.y;
buff[_channels*i+2] = (float) p.z;
}
put(0, 0, buff); //TODO: check ret val!
}
Reported by PMD.
Line: 53
Point3 p = a[i];
buff[_channels*i+0] = (float) p.x;
buff[_channels*i+1] = (float) p.y;
buff[_channels*i+2] = (float) p.z;
}
put(0, 0, buff); //TODO: check ret val!
}
public Point3[] toArray() {
Reported by PMD.
Line: 60
public Point3[] toArray() {
int num = (int) total();
Point3[] ap = new Point3[num];
if(num == 0)
return ap;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
Reported by PMD.
Line: 66
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
ap[i] = new Point3(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2]);
return ap;
}
public void fromList(List<Point3> lp) {
Point3 ap[] = lp.toArray(new Point3[0]);
Reported by PMD.
modules/core/misc/java/src/java/core+MatOfPoint3.java
7 issues
Line: 35
public MatOfPoint3(Point3...a) {
super();
fromArray(a);
}
public void alloc(int elemNumber) {
if(elemNumber>0)
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
Reported by PMD.
Line: 48
return;
int num = a.length;
alloc(num);
int buff[] = new int[num * _channels];
for(int i=0; i<num; i++) {
Point3 p = a[i];
buff[_channels*i+0] = (int) p.x;
buff[_channels*i+1] = (int) p.y;
buff[_channels*i+2] = (int) p.z;
Reported by PMD.
Line: 51
int buff[] = new int[num * _channels];
for(int i=0; i<num; i++) {
Point3 p = a[i];
buff[_channels*i+0] = (int) p.x;
buff[_channels*i+1] = (int) p.y;
buff[_channels*i+2] = (int) p.z;
}
put(0, 0, buff); //TODO: check ret val!
}
Reported by PMD.
Line: 52
for(int i=0; i<num; i++) {
Point3 p = a[i];
buff[_channels*i+0] = (int) p.x;
buff[_channels*i+1] = (int) p.y;
buff[_channels*i+2] = (int) p.z;
}
put(0, 0, buff); //TODO: check ret val!
}
Reported by PMD.
Line: 53
Point3 p = a[i];
buff[_channels*i+0] = (int) p.x;
buff[_channels*i+1] = (int) p.y;
buff[_channels*i+2] = (int) p.z;
}
put(0, 0, buff); //TODO: check ret val!
}
public Point3[] toArray() {
Reported by PMD.
Line: 60
public Point3[] toArray() {
int num = (int) total();
Point3[] ap = new Point3[num];
if(num == 0)
return ap;
int buff[] = new int[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
Reported by PMD.
Line: 66
int buff[] = new int[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
ap[i] = new Point3(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2]);
return ap;
}
public void fromList(List<Point3> lp) {
Point3 ap[] = lp.toArray(new Point3[0]);
Reported by PMD.
modules/python/test/test_async.py
7 issues
Line: 5
Column: 1
from __future__ import print_function
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
class AsyncTest(NewOpenCVTests):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
class AsyncTest(NewOpenCVTests):
Reported by Pylint.
Line: 9
Column: 1
from tests_common import NewOpenCVTests
class AsyncTest(NewOpenCVTests):
def test_async_simple(self):
m = np.array([[1,2],[3,4],[5,6]])
async_result = cv.utils.testAsyncArray(m)
self.assertTrue(async_result.valid())
Reported by Pylint.
Line: 11
Column: 5
class AsyncTest(NewOpenCVTests):
def test_async_simple(self):
m = np.array([[1,2],[3,4],[5,6]])
async_result = cv.utils.testAsyncArray(m)
self.assertTrue(async_result.valid())
ret, result = async_result.get(timeoutNs=10**6) # 1ms
self.assertTrue(ret)
Reported by Pylint.
Line: 12
Column: 9
class AsyncTest(NewOpenCVTests):
def test_async_simple(self):
m = np.array([[1,2],[3,4],[5,6]])
async_result = cv.utils.testAsyncArray(m)
self.assertTrue(async_result.valid())
ret, result = async_result.get(timeoutNs=10**6) # 1ms
self.assertTrue(ret)
self.assertFalse(async_result.valid())
Reported by Pylint.
Line: 21
Column: 5
self.assertEqual(cv.norm(m, result, cv.NORM_INF), 0)
def test_async_exception(self):
async_result = cv.utils.testAsyncException()
self.assertTrue(async_result.valid())
try:
_ret, _result = async_result.get(timeoutNs=10**6) # 1ms
self.fail("Exception expected")
Reported by Pylint.
Line: 27
Column: 9
try:
_ret, _result = async_result.get(timeoutNs=10**6) # 1ms
self.fail("Exception expected")
except cv.error as e:
self.assertEqual(cv.Error.StsOk, e.code)
if __name__ == '__main__':
Reported by Pylint.
modules/ml/misc/python/test/test_knearest.py
7 issues
Line: 2
Column: 1
#!/usr/bin/env python
import cv2 as cv
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import cv2 as cv
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
import cv2 as cv
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
Reported by Pylint.
Line: 6
Column: 1
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
self.assertTrue(k_nearest.isTrained())
Reported by Pylint.
Line: 6
Column: 1
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
self.assertTrue(k_nearest.isTrained())
Reported by Pylint.
Line: 6
Column: 1
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
self.assertTrue(k_nearest.isTrained())
Reported by Pylint.
Line: 7
Column: 5
from tests_common import NewOpenCVTests
class knearest_test(NewOpenCVTests):
def test_load(self):
k_nearest = cv.ml.KNearest_load(self.find_file("ml/opencv_ml_knn.xml"))
self.assertFalse(k_nearest.empty())
self.assertTrue(k_nearest.isTrained())
if __name__ == '__main__':
Reported by Pylint.