<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; 4.0.0</li>
<li>Operating System / Platform =&gt; Windows 64 Bit</li>
<li>Compiler =&gt; Visual Studio 2015</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">current implementation refuses to find <em>any</em> QR code when presented with an image that contains more than one.</p>
<p dir="auto">it would be nice if it could do that.</p>
<h5 dir="auto">Steps to reproduce</h5>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import cv2 as cv
import numpy as np
im = cv.imread(&quot;qrcode.png&quot;)
det = cv.QRCodeDetector()
rv, pts = det.detect(im)
print(&quot;single:&quot;, rv) # True
rv, pts = det.detect(np.hstack([im, im])) # duplicate side by side
print(&quot;multiple:&quot;, rv) # False"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">cv2</span> <span class="pl-k">as</span> <span class="pl-s1">cv</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-s1">im</span> <span class="pl-c1">=</span> <span class="pl-s1">cv</span>.<span class="pl-en">imread</span>(<span class="pl-s">"qrcode.png"</span>)
<span class="pl-s1">det</span> <span class="pl-c1">=</span> <span class="pl-s1">cv</span>.<span class="pl-v">QRCodeDetector</span>()
<span class="pl-s1">rv</span>, <span class="pl-s1">pts</span> <span class="pl-c1">=</span> <span class="pl-s1">det</span>.<span class="pl-en">detect</span>(<span class="pl-s1">im</span>)
<span class="pl-en">print</span>(<span class="pl-s">"single:"</span>, <span class="pl-s1">rv</span>) <span class="pl-c"># True</span>
<span class="pl-s1">rv</span>, <span class="pl-s1">pts</span> <span class="pl-c1">=</span> <span class="pl-s1">det</span>.<span class="pl-en">detect</span>(<span class="pl-s1">np</span>.<span class="pl-en">hstack</span>([<span class="pl-s1">im</span>, <span class="pl-s1">im</span>])) <span class="pl-c"># duplicate side by side</span>
<span class="pl-en">print</span>(<span class="pl-s">"multiple:"</span>, <span class="pl-s1">rv</span>) <span class="pl-c"># False</span></pre></div>
<h5 dir="auto">System information (version)</h5>

<h5 dir="auto">Detailed description</h5>
<p dir="auto">I am trying to load the .pb file using OpenCV dnn.readNetFromTensorflow.I am unable to load it. I am adding my custom(dsnt) layer on top of Keras sequential model. Here is the error I am getting in Ubuntu 18.04 with OpenCV 4.5.0 and 4.3.0</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="OpenCV(4.5.0) /home/srinu/Documents/cpp_inference/opencv_4-5-0/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:1025: error: (-215:Assertion failed) values.type() == CV_32FC1 in function 'populateNet'"><pre class="notranslate"><code class="notranslate">OpenCV(4.5.0) /home/srinu/Documents/cpp_inference/opencv_4-5-0/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:1025: error: (-215:Assertion failed) values.type() == CV_32FC1 in function 'populateNet'
</code></pre></div>
<h4 dir="auto">Generating .pb file using below script</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# loaded = tf.saved_model.load('/saved_model')
# infer = loaded.signatures['serving_default']
#
# f = tf.function(infer).get_concrete_function(input_1=tf.TensorSpec(shape=[None, 224, 224, 3], dtype=tf.float32))
# f2 = convert_variables_to_constants_v2(f)
# graph_def = f2.graph.as_graph_def()
#
# # Export frozen graph
# with tf.io.gfile.GFile('frozen_graph.pb', 'wb') as f:
#    f.write(graph_def.SerializeToString())"><pre class="notranslate"><code class="notranslate"># loaded = tf.saved_model.load('/saved_model')
# infer = loaded.signatures['serving_default']
#
# f = tf.function(infer).get_concrete_function(input_1=tf.TensorSpec(shape=[None, 224, 224, 3], dtype=tf.float32))
# f2 = convert_variables_to_constants_v2(f)
# graph_def = f2.graph.as_graph_def()
#
# # Export frozen graph
# with tf.io.gfile.GFile('frozen_graph.pb', 'wb') as f:
#    f.write(graph_def.SerializeToString())
</code></pre></div>
<h4 dir="auto">Loading the resulted .pb file using below script</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import cv2
img_file = &quot;\lash.jpg&quot;
img_cv2 = cv2.imread(img_file)


inWidth = 224
inHeight = 224
blob = cv2.dnn.blobFromImage(img_cv2,
                                scalefactor=1.0 / 255,
                                size=(inWidth, inHeight),
                                mean=(0, 0, 0),
                                swapRB=False,
                                crop=False)

net = cv2.dnn.readNetFromTensorflow('/frozen_graph.pb')
net.setInput(blob)
out = net.forward()"><pre class="notranslate"><code class="notranslate">import cv2
img_file = "\lash.jpg"
img_cv2 = cv2.imread(img_file)


inWidth = 224
inHeight = 224
blob = cv2.dnn.blobFromImage(img_cv2,
                                scalefactor=1.0 / 255,
                                size=(inWidth, inHeight),
                                mean=(0, 0, 0),
                                swapRB=False,
                                crop=False)

net = cv2.dnn.readNetFromTensorflow('/frozen_graph.pb')
net.setInput(blob)
out = net.forward()
</code></pre></div>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dkurt/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/dkurt">@dkurt</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alalek/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/alalek">@alalek</a>  Can anyone help me</p>