Questions tagged [imread]

Use this tag for questions regarding reading images in OpenCV, Matlab or similar image processing languages.

cv::imread() and cv2.imread() are ways to read images using OpenCV in C++ and Python.

imread(filename) is how you would read the image in Matlab.

273 questions
3
votes
1 answer

OpenCV3.0 - Imgcodecs.imread returns empty file

I am a newbie in OpenCV - using OpenCV310 on Android. When I call Imgcodecs.imread on a file that exists, I always get an empty Mat. Could someone help me, Please? The code is: File root = Environment.getExternalStorageDirectory(); File file = new…
D-Inker.
  • 31
  • 8
3
votes
2 answers

Python imread bug: "Unsupported BMP bitfields layout"

I seem to have encountered a bug in scipy.misc.imread, and I'm looking for a workaround. Here's a clip of the error report: from scipy.misc import imread im = imread('380.bmp') ... C:\Anaconda3\lib\site-packages\PIL\BmpImagePlugin.py in…
Yly
  • 2,150
  • 4
  • 20
  • 33
3
votes
3 answers

The parameter `image` must be a 2-dimensional array

I am going to compute co-occurance matrix of some textures and in following you see the code, normally when I hardcode one address in cv2.imread(), no error arises, but now that I have used one variable(train_image), I got error, that 'The parameter…
shafigh
  • 61
  • 1
  • 2
  • 10
3
votes
3 answers

"Can't open file "C:" for reading; you may not have read permission." error in MATLAB

I have such a code; for x = 1:100 path = sprintf('C:\Users\hasan_000\Documents\MATLAB\Project\Images\%d.jpg', x); imgarray = imread(sprintf(path)); end I have a folder involves 100 pictures. I want to convert them to matrix by uploading…
yusuf
  • 3,591
  • 8
  • 45
  • 86
3
votes
2 answers

python matplotlib.pyplot imread

I'm using plt.imread for reading big .tiff images. Because of the big dimensions, I would like to select just a part of the image to be loaded. I would like to do something like: plt.imread(filename, [s1:s2, r1:r2]) choosing the initial and final…
user3284140
  • 71
  • 1
  • 1
  • 6
3
votes
3 answers

Opencv imread does not work with relative path

As the title says. I've tried to load an image with argv and with absolute path and it worked, but with relative path it doesn't. The image is in the same directory of the executable. I'm using visual studio 2013 and opencv 2.4.10 on windows 7 64…
bjorn
  • 338
  • 6
  • 18
3
votes
4 answers

error: undefined reference to `cv::imread(std::string const&, int)'

I'm new to Qt and I have a project that needs to configure OpenCV in Qt , I tried to run a simple code in Qt but I got this error "undefined reference to cv::imread(std::string const&, int)" and here is my code... #include…
Moonlight
  • 232
  • 2
  • 5
  • 18
2
votes
3 answers

how to read an image with opencv using path variable in Python

So I have a variable that holds the image path as a string. but I get the below error while trying to read the image using the path variable. The path variable is coming from another function that calls this code. Error: can't open/read file: check…
Shane
  • 61
  • 7
2
votes
1 answer

extract channel names from a multi-channel image

I am using skimage.io.imread (which uses tifffile) to read a QPTIFF file. Multiple channels are successfully read as multiple dimensions. Is it possible to extract the channel names and other metadata?
burger
  • 5,683
  • 9
  • 40
  • 63
2
votes
2 answers

Serial output of Python images

How can I render images sequentially in Spyder? At the moment, it turns out to display only the last image from skimage.io import imread, imshow img_5 = imread('C:/abc1.png') imshow(img_5) img_6 = imread('C:/abc2.png') imshow(img_6)
user15761564
2
votes
1 answer

Module 'scipy.ndimage' has no attribute 'imread'

I am trying to read an image from scipy. But it give the error "no attribute 'imread'". What could cause for this? AttributeError Traceback (most recent call last) in 5 …
2
votes
0 answers

Magic's return value: JPEG image data in case of HEIC image

Doubt 1: For HEIC images, the return value provided by Magic is JPEG. Can someone help me with the explanation? Doubt 2: Why is cv2.imread reading the images when in the supported file formats .HEIC is not present? Also, if there's support for…
2
votes
5 answers

imread not reading an existing image on Java Android from Linux

package com.example.cppinandroid; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import org.opencv.core.Mat; import java.io.File; import static…
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
2
votes
0 answers

Bringing image data and labels together

I have a mother directory which contains several subfolders in which I stored images of license plates. In the mother directory, there also lies a folder named train Val, whoch is a csv-file which contains labels of the data. trainVal contains the…
Tobitor
  • 1,388
  • 1
  • 23
  • 58
2
votes
0 answers

OpenCV errors and warnings with visual studio 2019

I am getting starting with openCV but I am having trouble running a simple program involving imshow with an image. Have a feeling it something I have configured wrong. First of all, I am getting an "Exeption Unhandled" error, details: Unhandled…
1 2
3
18 19