The following issues were found
samples/dnn/fast_neural_style.py
5 issues
Line: 2
Column: 1
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(
description='This script is used to run style transfer models from '
'https://github.com/jcjohnson/fast-neural-style using OpenCV')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
Reported by Pylint.
Line: 3
Column: 1
from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
parser = argparse.ArgumentParser(
description='This script is used to run style transfer models from '
'https://github.com/jcjohnson/fast-neural-style using OpenCV')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
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='This script is used to run style transfer models from '
'https://github.com/jcjohnson/fast-neural-style using OpenCV')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
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='This script is used to run style transfer models from '
'https://github.com/jcjohnson/fast-neural-style using OpenCV')
parser.add_argument('--input', help='Path to image or video. Skip to capture frames from camera')
Reported by Pylint.
Line: 13
Column: 1
parser.add_argument('--model', help='Path to .t7 model')
parser.add_argument('--width', default=-1, type=int, help='Resize input to specific width.')
parser.add_argument('--height', default=-1, type=int, help='Resize input to specific height.')
parser.add_argument('--median_filter', default=0, type=int, help='Kernel size of postprocessing blurring.')
args = parser.parse_args()
net = cv.dnn.readNetFromTorch(cv.samples.findFile(args.model))
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
Reported by Pylint.
samples/dnn/dnn_model_runner/dnn_conversion/common/test/configs/test_config.py
5 issues
Line: 1
Column: 1
import os
from dataclasses import dataclass, field
from typing import List
@dataclass
class CommonConfig:
output_data_root_dir: str = "dnn_model_runner/dnn_conversion"
logs_dir: str = os.path.join(output_data_root_dir, "logs")
Reported by Pylint.
Line: 7
Column: 1
@dataclass
class CommonConfig:
output_data_root_dir: str = "dnn_model_runner/dnn_conversion"
logs_dir: str = os.path.join(output_data_root_dir, "logs")
log_file_path: str = os.path.join(logs_dir, "{}_log.txt")
Reported by Pylint.
Line: 14
Column: 1
@dataclass
class TestClsConfig:
batch_size: int = 1
frame_size: int = 224
img_root_dir: str = "./ILSVRC2012_img_val"
# location of image-class matching
img_cls_file: str = "./val.txt"
Reported by Pylint.
Line: 24
Column: 1
@dataclass
class TestClsModuleConfig:
cls_test_data_dir: str = "../data"
test_module_name: str = "classification"
test_module_path: str = "classification.py"
input_img: str = os.path.join(cls_test_data_dir, "squirrel_cls.jpg")
model: str = ""
Reported by Pylint.
Line: 24
Column: 1
@dataclass
class TestClsModuleConfig:
cls_test_data_dir: str = "../data"
test_module_name: str = "classification"
test_module_path: str = "classification.py"
input_img: str = os.path.join(cls_test_data_dir, "squirrel_cls.jpg")
model: str = ""
Reported by Pylint.
samples/dnn/dnn_model_runner/dnn_conversion/common/img_utils.py
5 issues
Line: 1
Column: 1
import cv2
import numpy as np
from .test.configs.default_preprocess_config import BASE_IMG_SCALE_FACTOR
def read_rgb_img(img_file, is_bgr_to_rgb=True):
img = cv2.imread(img_file, cv2.IMREAD_COLOR)
if is_bgr_to_rgb:
Reported by Pylint.
Line: 4
Column: 1
import cv2
import numpy as np
from .test.configs.default_preprocess_config import BASE_IMG_SCALE_FACTOR
def read_rgb_img(img_file, is_bgr_to_rgb=True):
img = cv2.imread(img_file, cv2.IMREAD_COLOR)
if is_bgr_to_rgb:
Reported by Pylint.
Line: 1
Column: 1
import cv2
import numpy as np
from .test.configs.default_preprocess_config import BASE_IMG_SCALE_FACTOR
def read_rgb_img(img_file, is_bgr_to_rgb=True):
img = cv2.imread(img_file, cv2.IMREAD_COLOR)
if is_bgr_to_rgb:
Reported by Pylint.
Line: 7
Column: 1
from .test.configs.default_preprocess_config import BASE_IMG_SCALE_FACTOR
def read_rgb_img(img_file, is_bgr_to_rgb=True):
img = cv2.imread(img_file, cv2.IMREAD_COLOR)
if is_bgr_to_rgb:
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img
Reported by Pylint.
Line: 14
Column: 1
return img
def get_pytorch_preprocess(img):
img = img.astype(np.float32)
img *= BASE_IMG_SCALE_FACTOR
img -= [0.485, 0.456, 0.406]
img /= [0.229, 0.224, 0.225]
return img
Reported by Pylint.
modules/gapi/test/internal/gapi_int_executor_tests.cpp
5 issues
Line: 24
CWE codes:
788
tmp[0] = cv::gapi::bitwise_not(cv::gapi::bitwise_not(in[0]));
tmp[1] = cv::gapi::boxFilter(in[1], -1, cv::Size(3,3));
tmp[2] = tmp[0] + tmp[1]; // FIXME: handle tmp[2] = tmp[0]+tmp[2] typo
scl = cv::gapi::sum(tmp[1]);
tmp[3] = cv::gapi::medianBlur(tmp[1], 3);
out[0] = tmp[2] + scl;
out[1] = cv::gapi::boxFilter(tmp[3], -1, cv::Size(3,3));
Reported by Cppcheck.
Line: 25
CWE codes:
788
tmp[0] = cv::gapi::bitwise_not(cv::gapi::bitwise_not(in[0]));
tmp[1] = cv::gapi::boxFilter(in[1], -1, cv::Size(3,3));
tmp[2] = tmp[0] + tmp[1]; // FIXME: handle tmp[2] = tmp[0]+tmp[2] typo
scl = cv::gapi::sum(tmp[1]);
tmp[3] = cv::gapi::medianBlur(tmp[1], 3);
out[0] = tmp[2] + scl;
out[1] = cv::gapi::boxFilter(tmp[3], -1, cv::Size(3,3));
// isl0 #internal1
Reported by Cppcheck.
Line: 26
CWE codes:
788
tmp[1] = cv::gapi::boxFilter(in[1], -1, cv::Size(3,3));
tmp[2] = tmp[0] + tmp[1]; // FIXME: handle tmp[2] = tmp[0]+tmp[2] typo
scl = cv::gapi::sum(tmp[1]);
tmp[3] = cv::gapi::medianBlur(tmp[1], 3);
out[0] = tmp[2] + scl;
out[1] = cv::gapi::boxFilter(tmp[3], -1, cv::Size(3,3));
// isl0 #internal1
// ........................... .........
Reported by Cppcheck.
Line: 27
CWE codes:
788
tmp[2] = tmp[0] + tmp[1]; // FIXME: handle tmp[2] = tmp[0]+tmp[2] typo
scl = cv::gapi::sum(tmp[1]);
tmp[3] = cv::gapi::medianBlur(tmp[1], 3);
out[0] = tmp[2] + scl;
out[1] = cv::gapi::boxFilter(tmp[3], -1, cv::Size(3,3));
// isl0 #internal1
// ........................... .........
// (in1) -> NotNot ->(tmp0) --> Add ---------> (tmp2) --> AddC -------> (out1)
Reported by Cppcheck.
Line: 28
CWE codes:
788
scl = cv::gapi::sum(tmp[1]);
tmp[3] = cv::gapi::medianBlur(tmp[1], 3);
out[0] = tmp[2] + scl;
out[1] = cv::gapi::boxFilter(tmp[3], -1, cv::Size(3,3));
// isl0 #internal1
// ........................... .........
// (in1) -> NotNot ->(tmp0) --> Add ---------> (tmp2) --> AddC -------> (out1)
// :.....................^...: :..^....:
Reported by Cppcheck.
platforms/winpack_dldt/2021.4/patch.config.py
5 issues
Line: 1
Column: 1
applyPatch('20210630-dldt-disable-unused-targets.patch')
applyPatch('20210630-dldt-pdb.patch')
applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch')
applyPatch('20210630-dldt-vs-version.patch')
Reported by Pylint.
Line: 2
Column: 1
applyPatch('20210630-dldt-disable-unused-targets.patch')
applyPatch('20210630-dldt-pdb.patch')
applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch')
applyPatch('20210630-dldt-vs-version.patch')
Reported by Pylint.
Line: 3
Column: 1
applyPatch('20210630-dldt-disable-unused-targets.patch')
applyPatch('20210630-dldt-pdb.patch')
applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch')
applyPatch('20210630-dldt-vs-version.patch')
Reported by Pylint.
Line: 4
Column: 1
applyPatch('20210630-dldt-disable-unused-targets.patch')
applyPatch('20210630-dldt-pdb.patch')
applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch')
applyPatch('20210630-dldt-vs-version.patch')
Reported by Pylint.
Line: 1
Column: 1
applyPatch('20210630-dldt-disable-unused-targets.patch')
applyPatch('20210630-dldt-pdb.patch')
applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch')
applyPatch('20210630-dldt-vs-version.patch')
Reported by Pylint.
modules/java/generator/android/java/org/opencv/android/BaseLoaderCallback.java
5 issues
Line: 25
{
/** OpenCV initialization was successful. **/
case LoaderCallbackInterface.SUCCESS:
{
/** Application must override this method to handle successful library initialization. **/
} break;
/** OpenCV loader can not start Google Play Market. **/
case LoaderCallbackInterface.MARKET_ERROR:
{
Reported by PMD.
Line: 86
public void onPackageInstall(final int operation, final InstallCallbackInterface callback)
{
switch (operation)
{
case InstallCallbackInterface.NEW_INSTALLATION:
{
AlertDialog InstallMessage = new AlertDialog.Builder(mAppContext).create();
InstallMessage.setTitle("Package not found");
Reported by PMD.
Line: 86
public void onPackageInstall(final int operation, final InstallCallbackInterface callback)
{
switch (operation)
{
case InstallCallbackInterface.NEW_INSTALLATION:
{
AlertDialog InstallMessage = new AlertDialog.Builder(mAppContext).create();
InstallMessage.setTitle("Package not found");
Reported by PMD.
Line: 86
public void onPackageInstall(final int operation, final InstallCallbackInterface callback)
{
switch (operation)
{
case InstallCallbackInterface.NEW_INSTALLATION:
{
AlertDialog InstallMessage = new AlertDialog.Builder(mAppContext).create();
InstallMessage.setTitle("Package not found");
Reported by PMD.
Line: 139
((Activity) mAppContext).finish();
}
protected Context mAppContext;
private final static String TAG = "OCV/BaseLoaderCallback";
}
Reported by PMD.
modules/java/generator/android/java/org/opencv/android/CameraActivity.java
5 issues
Line: 41
super.onStart();
boolean havePermission = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(CAMERA) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
havePermission = false;
}
}
if (havePermission) {
Reported by PMD.
Line: 5
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
Reported by PMD.
Line: 8
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
Reported by PMD.
Line: 9
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.CAMERA;
Reported by PMD.
Line: 39
@Override
protected void onStart() {
super.onStart();
boolean havePermission = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(CAMERA) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
havePermission = false;
}
Reported by PMD.
platforms/winpack_dldt/2021.3/patch.config.py
5 issues
Line: 1
Column: 1
applyPatch('20210324-dldt-disable-unused-targets.patch')
applyPatch('20210324-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20210324-dldt-vs-version.patch')
Reported by Pylint.
Line: 2
Column: 1
applyPatch('20210324-dldt-disable-unused-targets.patch')
applyPatch('20210324-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20210324-dldt-vs-version.patch')
Reported by Pylint.
Line: 3
Column: 1
applyPatch('20210324-dldt-disable-unused-targets.patch')
applyPatch('20210324-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20210324-dldt-vs-version.patch')
Reported by Pylint.
Line: 4
Column: 1
applyPatch('20210324-dldt-disable-unused-targets.patch')
applyPatch('20210324-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20210324-dldt-vs-version.patch')
Reported by Pylint.
Line: 1
Column: 1
applyPatch('20210324-dldt-disable-unused-targets.patch')
applyPatch('20210324-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20210324-dldt-vs-version.patch')
Reported by Pylint.
platforms/winpack_dldt/2021.2/patch.config.py
5 issues
Line: 1
Column: 1
applyPatch('20201217-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201218-dldt-vs-version.patch')
Reported by Pylint.
Line: 2
Column: 1
applyPatch('20201217-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201218-dldt-vs-version.patch')
Reported by Pylint.
Line: 3
Column: 1
applyPatch('20201217-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201218-dldt-vs-version.patch')
Reported by Pylint.
Line: 4
Column: 1
applyPatch('20201217-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201218-dldt-vs-version.patch')
Reported by Pylint.
Line: 1
Column: 1
applyPatch('20201217-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201218-dldt-vs-version.patch')
Reported by Pylint.
platforms/winpack_dldt/2020.4/patch.config.py
5 issues
Line: 1
Column: 1
applyPatch('20200701-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201005-dldt-fix-cldnn-compilation.patch')
Reported by Pylint.
Line: 2
Column: 1
applyPatch('20200701-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201005-dldt-fix-cldnn-compilation.patch')
Reported by Pylint.
Line: 3
Column: 1
applyPatch('20200701-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201005-dldt-fix-cldnn-compilation.patch')
Reported by Pylint.
Line: 4
Column: 1
applyPatch('20200701-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201005-dldt-fix-cldnn-compilation.patch')
Reported by Pylint.
Line: 1
Column: 1
applyPatch('20200701-dldt-disable-unused-targets.patch')
applyPatch('20200413-dldt-pdb.patch')
applyPatch('20200604-dldt-disable-multidevice.patch')
applyPatch('20201005-dldt-fix-cldnn-compilation.patch')
Reported by Pylint.