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

<ul dir="auto">
<li>OpenCV =&gt; 4.1.0</li>
<li>Operating System / Platform =&gt; Ubuntu 5.4.0-6ubuntu1~16.04.10</li>
<li>Compiler =&gt; Java</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<p dir="auto">I use jdk1.8 and opencv410 to read webp picture，I can open and write webp format from file with no problem, but I can't decode from memory. The code (at the end) returns:</p>
<p dir="auto">imdecode_(''): can't read data: OpenCV(4.1.0) /home/yuxiaoyang/repo_test/xmss_3rdparty/opencv-4.1.0-imsize/modules/imgcodecs/src/grfmt_webp.cpp:164: error: (-215:Assertion failed) data.rows == 1 in function 'readData'</p>
<p dir="auto">However, it works with opencv 3.1.0</p>
<p dir="auto"><strong>Code：</strong>,<br>
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);<br>
String rotate6 = "/tmp/webp.webp";<br>
Mat imdecode = Imgcodecs.imdecode(new MatOfByte(FileUtils.readFileToByteArray(new File(rotate6))), Imgcodecs.IMREAD_UNCHANGED);<br>
System.out.println("imdecode width=" + imdecode.width());<br>
System.out.println("imdecode height=" + imdecode.height());</p>
<p dir="auto"><strong>Code Return：</strong><br>
imdecode_(''): can't read data: OpenCV(4.1.0) /home/yuxiaoyang/repo_test/xmss_3rdparty/opencv-4.1.0-imsize/modules/imgcodecs/src/grfmt_webp.cpp:164: error: (-215:Assertion failed) data.rows == 1 in function 'readData'</p>
<p dir="auto">imdecode width=0<br>
imdecode height=0</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">Python 3.7.3<br>
opencv-python 4.1.0.25 from pip install opencv-python<br>
I can open and write webp format from file with no problem, but I can't decode from memory. The code (at the end) returns:</p>
<blockquote>
<p dir="auto">imdecode_(''): can't read data: OpenCV(4.1.0) /io/opencv/modules/imgcodecs/src/grfmt_webp.cpp:164: error: (-215:Assertion failed) data.rows == 1 in function 'readData'<br>
However, it works with opencv 3.4.2 from conda install opencv.<br>
Also, Kaggle kernel environment (Python 3.6.6 and opencv-python 4.1.0.25) just returns None object without throwing an error.</p>
</blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="img = cv2.imread(file)
retval, buf = cv2.imencode(&quot;.webp&quot;, img, [cv2.IMWRITE_WEBP_QUALITY, 100])
img = cv2.imdecode(buf, 1)"><pre class="notranslate"><code class="notranslate">img = cv2.imread(file)
retval, buf = cv2.imencode(".webp", img, [cv2.IMWRITE_WEBP_QUALITY, 100])
img = cv2.imdecode(buf, 1)
</code></pre></div>