Issue 1:
System information (version)

OpenCV => 2.4.13.7-4-gfd63c6041

Operating System / Platform => Windows 10.0.17134 AMD64

Compiler => Visual studio 15 2017

CMake =>3.12.3

Detailed description

If I set OpenCV to not build zlib and use a prebuilt zlib version, the configuration step of cmake will fail.

I've tried setting the following options in cmake:

ZLIB_INCLUDE_DIR : C:\development\zlib\include

ZLIB_LIBRARY_RELEASE : C:\development\zlib\lib\zlibstatic.lib

ZLIB_LIBRARY_DEBUG : C:\development\zlib\lib\zlibstaticd.lib

output is

Checking for Windows (Phone) Platform SDK 8.0/8.1
Checking for Visual Studio 2012/2013
Found ZLIB: optimized;C:/development/zlib/lib/zlibstatic.lib;debug;C:/development/zlib/lib/zlibstaticd.lib (found version "1.2.11")
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Assume that non-module dependency is available: optimized (for module opencv_core)
Assume that non-module dependency is available: debug (for module opencv_core)
CMake Warning (dev) at cmake/OpenCVModule.cmake:593 (target_link_libraries):
Link library type specifier "debug" is followed by specifier "optimized"
instead of a library name. The first specifier will be ignored.
Call Stack (most recent call first):
modules/core/CMakeLists.txt:56 (ocv_create_module)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at cmake/OpenCVModule.cmake:593 (target_link_libraries):
The "optimized" argument must be followed by a library.
Call Stack (most recent call first):
modules/core/CMakeLists.txt:56 (ocv_create_module)

Configuring incomplete, errors occurred!

NOTE: if i set the RELEASE and DEBUG lib to the same file this does not occur.

It seems as if OpenCV doesn't parse the "optimized;"and "Debug;" flags properly that is sent together with the zlib filenames

Steps to reproduce

while configuring opencv cmake, set ZLIB_LIBRARY_RELEASE and ZLIB_LIBRARY_DEBUG to two different values

Issue 2:
System information (version)

OpenCV => 4.4.0

Operating System / Platform => Ubuntu/docker

Detailed description

I was trying to inference on Yolo trained model using OpenCV 4.4.0 with a python code.

The issue I had is that some image I was inferring on was giving me wrong bounding box that extends to the end of the image. that issue doesn't happen when I use the same model on darknet detector

the code I'm using is :

def __get_output_layers__(self):
layer_names = self.net.getLayerNames()
output_layers = [layer_names[i[0] - 1]
for i in self.net.getUnconnectedOutLayers()]
return output_layers
def infer(self):
self.net = cv2.dnn.readNet(os.path.join(self.model_path, 'yolo-obj.cfg'),
os.path.join(self.model_path, 'yolo-obj.weights'))
conf_threshold = data['confidence']
nms_threshold = data['nms_threshold']
height, width, depth = np_image.shape
# create input blob
blob = cv2.dnn.blobFromImage(
np_image, self.scale, (self.image_width, self.image_height), (self.R_mean, self.G_mean, self.B_mean),
self.swapRB, self.crop)
# feed the blob to the network
self.net.setInput(blob)
# get the output layers
output_layers = self.net.forward(self.__get_output_layers__())
# for each detection from each output layer
# get the confidence, class id, bounding box params
# and ignore detections below threshold
boxes = []
class_ids = []
confidences = []
for layer in output_layers:
for detection in layer:
scores = detection[5:]
class_id = np.argmax(scores)
confidence = scores[class_id]
if confidence * 100 > conf_threshold:
center_x = int(detection[0] * width)
center_y = int(detection[1] * height)
w = int(detection[2] * width)
h = int(detection[3] * height)
x = center_x - w / 2
y = center_y - h / 2
class_ids.append(int(class_id))
confidences.append(float(confidence * 100))
boxes.append([x, y, w, h])

# apply non-max suppression to remove duplicate bounding boxes for same object
remaining_indices = cv2.dnn.NMSBoxes(
boxes, confidences, conf_threshold, nms_threshold)

for i in range(len(boxes)):
# i = i[0]
box = boxes[i]
x = box[0]
y = box[1]
w = box[2]
h = box[3]

# release resources
cv2.destroyAllWindows()

# return the remaining boxes
output_bboxes = []
for i in remaining_indices:
box = boxes[i[0]]
left = int(box[0])

right = int(box[0]) + int(box[2])

top = int(box[1])

bottom = int(box[1]) + int(box[3])

if (left < 0):
left = 0
if (right > height- 1):
right = width - 1
if (top < 0):
top = 0
if (bottom >height - 1):
bottom = height - 1

output_bboxes.append(
{
'ObjectClassName': self.labels[class_ids[i[0]]],
'ObjectClassId': class_ids[i[0]],
'confidence': confidences[i[0]],
'coordinates': {
'left': left,
'right':right,
'top': top,
'bottom': bottom
}
}
)

after running this code and drawing boxes on image i get this result

but when i use the darknet detector i get this image which is fine without the issue of bounding box extending to the end of the image

Steps to reproduce

I'm using the Yolov3 weights trained on COCO dataset with the cfg provided that come from @AlexeyAB repo on github

Issue submission checklist

I report the issue, it's not a question

I checked the problem with documentation, FAQ, open issues,

answers.opencv.org, Stack Overflow, etc and have not found solution

I updated to latest OpenCV version and the issue is still there

There is reproducer code and related data files: videos, images, onnx, etc