<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 2.4.13.7-4-gfd63c6041</li>
<li>Operating System / Platform =&gt; Windows 10.0.17134 AMD64</li>
<li>Compiler =&gt; Visual studio 15 2017</li>
<li>CMake =&gt;3.12.3</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">If I set OpenCV to not build zlib and use a prebuilt zlib version, the configuration step of cmake will fail.</p>
<p dir="auto">I've tried setting the following options in cmake:</p>
<ul dir="auto">
<li>ZLIB_INCLUDE_DIR : <code class="notranslate">C:\development\zlib\include</code></li>
<li>ZLIB_LIBRARY_RELEASE : <code class="notranslate">C:\development\zlib\lib\zlibstatic.lib</code></li>
<li>ZLIB_LIBRARY_DEBUG : <code class="notranslate">C:\development\zlib\lib\zlibstaticd.lib</code></li>
</ul>
<p dir="auto">output is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 &quot;1.2.11&quot;) 
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 &quot;debug&quot; is followed by specifier &quot;optimized&quot;
  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 &quot;optimized&quot; 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!"><pre class="notranslate"><code class="notranslate">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!
</code></pre></div>
<p dir="auto"><strong>NOTE: if i set the RELEASE and DEBUG lib to the same file this does not occur.</strong></p>
<p dir="auto">It seems as if OpenCV doesn't parse the "optimized;"and "Debug;" flags properly that is sent together with the zlib filenames</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">while configuring opencv cmake, set  <code class="notranslate">ZLIB_LIBRARY_RELEASE</code> and <code class="notranslate">ZLIB_LIBRARY_DEBUG</code> to two different values</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.4.0</li>
<li>Operating System / Platform =&gt; Ubuntu/docker</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I was trying to inference on Yolo trained model using OpenCV 4.4.0 with a python code.<br>
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</p>
<p dir="auto">the code I'm using is :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 &gt; 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 &lt; 0):
				left = 0
			if (right &gt; height- 1):
				right = width - 1
			if (top &lt; 0):
				top = 0
			if (bottom &gt;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
					}
				}
			)
"><pre class="notranslate"><code class="notranslate">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 &gt; 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 &lt; 0):
				left = 0
			if (right &gt; height- 1):
				right = width - 1
			if (top &lt; 0):
				top = 0
			if (bottom &gt;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
					}
				}
			)

</code></pre></div>
<p dir="auto">after running this code and drawing boxes on image i get this result<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/31547256/88072463-57085f00-cb75-11ea-90e9-199011aea553.png"><img src="https://user-images.githubusercontent.com/31547256/88072463-57085f00-cb75-11ea-90e9-199011aea553.png" alt="Screenshot from 2020-07-21 17-11-50" style="max-width: 100%;"></a></p>
<p dir="auto">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<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/31547256/88086213-47921180-cb87-11ea-8b1f-d6cd1b6d3d75.png"><img src="https://user-images.githubusercontent.com/31547256/88086213-47921180-cb87-11ea-8b1f-d6cd1b6d3d75.png" alt="Screenshot from 2020-07-21 17-12-10" style="max-width: 100%;"></a></p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">I'm using the Yolov3 weights trained on COCO dataset with the cfg provided that come from <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/AlexeyAB/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/AlexeyAB">@AlexeyAB</a>  repo on github</p>
<h5 dir="auto">Issue submission checklist</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I report the issue, it's not a question

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I checked the problem with documentation, FAQ, open issues,<br>
answers.opencv.org, Stack Overflow, etc and have not found solution

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I updated to latest OpenCV version and the issue is still there

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> There is reproducer code and related data files: videos, images, onnx, etc

</li>
</ul>