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
22
votes
3 answers

OpenCV : undefined reference to imread()

I have configured OpenCV 3.1.0 in Eclipse Mars. These are my configuration, G++ includes: D:/opencv/build/install/include; GCC includes: D:/opencv/build/install/include Linker libraries: libopencv_core310, libopencv_highgui310 Linker libraries path:…
Shinchan
  • 572
  • 2
  • 5
  • 16
14
votes
2 answers

OpenCV vs Matlab : Different Values on pixels with imread

I have encountered a problem with the function imread() in Matlab (2014) and OpenCV (3.0) on Windows 7 with jpg files. I don't have the same values by reading the same file jpg and the same pixel. Here are my 2 codes : (OpenCV code followed by the…
Nablast
  • 211
  • 2
  • 7
13
votes
2 answers

Load BytesIO image with opencv

I'm trying to load an image with OPENCV from an io.BytesIO() structure. Originally, the code loads the image with PIL, like below: image_stream = io.BytesIO() image_stream.write(connection.read(image_len)) image_stream.seek(0) image =…
Henrique
  • 328
  • 1
  • 2
  • 10
12
votes
2 answers

Image Orientation (python+openCV)

Using Python and OpenCV, I try to read an image which size is (3264*2448), but the resulting size is always (2448*3264). That means the direction of the image is changed by 90 degrees. The code is following: img1 = cv2.imread("C:\\Users\\test.jpg",…
yuanyesjtu
  • 121
  • 1
  • 1
  • 5
12
votes
4 answers

opencv imread() on Windows for non-ASCII file names

We have an OpenCV problem of opening (and writing) file paths that contain non-ASCII characters on Windows. Affected functions are: cv::imread(), cv::imwrite(), ... As far as I saw in the OpenCV source code, it uses fopen even on Windows (instead of…
Vyacheslav
  • 1,186
  • 2
  • 15
  • 29
11
votes
1 answer

How to extract green channel from RGB image in Python using Scikit-Image library?

I am extremely new to scikit-image (skimage) library in Python for image processing (started few minutes ago!). I have used imread to read an image file in a numpy.ndarray. The array is 3 dimensional where the size of the third dimension is 3…
exAres
  • 4,806
  • 16
  • 53
  • 95
10
votes
2 answers

Using cv2.imread: " returned NULL without setting an error", as if it can't open the picture or get the data

This is the part of my code that gives the problem. It is supposed to count the amount of green pixels in a picture: img = Image.open('path.tif') BLACK_MIN = np.array([0, 20, 20], np.uint8) BLACK_MAX = np.array([120, 255, 255], np.uint8) imgg =…
anoold
  • 103
  • 1
  • 1
  • 4
10
votes
4 answers

How to resolve an error: imread is not a member of cv?

I use OpenCV 3.0 and Ubuntu 14.04. I'm trying to compile a few codes on Ubuntu using OpenCV. I get error "error: 'imread' is not a member of 'cv'" Due to my previous search knowledge, I tried compiling by adding "highgui.h". I use: $g++ main.cpp…
CanCam
  • 111
  • 1
  • 1
  • 3
9
votes
3 answers

How to draw a point in an image using given coordinate

I loaded the image and tried to draw a red point in an image img=mpimg.imread('./images/im00001.jpg') red = [0,0,255] # Change one pixel img[ 0.,-26.10911452,0. ]=red imgplot = plt.imshow(img) but the following error occurred ValueError:…
user11312666
9
votes
1 answer

Image does not load as grayscale (skimage)

I'm trying to load an image as grayscale as follows: from skimage import data from skimage.viewer import ImageViewer img = data.imread('my_image.png', as_gray=True) However, if I check for its shape using img.shape it turns out to be a…
rdv
  • 682
  • 2
  • 8
  • 19
8
votes
2 answers

having cv2.imread reading images from file objects or memory-stream-like data (here non-extracted tar)

I have a .tar file containing several hundreds of pictures (.png). I need to process them via opencv. I am wondering whether - for efficiency reasons - it is possible to process them without passing by the disc. In other, words I want to read the…
Acorbe
  • 8,367
  • 5
  • 37
  • 66
7
votes
3 answers

How to add unique image formats to Matlab's imread, and Matlab's drag and drop?

We have a number of internal image formats which I process in Matlab. I have read/write functions for all of them. For specificity, consider the TGA image format, for which there is a file exchange image reader. Matlab has reasonable drag and drop…
John
  • 5,735
  • 3
  • 46
  • 62
7
votes
2 answers

Read an image from a qrc using imread() of OpenCV

I want to read an image from a qrc using imread() of OpenCV in this way: Mat img = imread(":/TempIcons/logo.png"); but the final img size is [0x0]. I have also tried: Mat img = imread("qrc://TempIcons/logo.png"); but the size I get is the same. I…
Angie Quijano
  • 4,167
  • 3
  • 25
  • 30
6
votes
2 answers

Image height and width getting swapped when read using opencv imread

When I read an image using opencv imread function, I find its height and width being swapped as what it should be. Like my original image is of dimensions (610 by 406) but on being read using opencv::imread function, its dimensions are 406 by 610.…
sm08
  • 61
  • 1
  • 3
5
votes
3 answers

'libpng error: Read Error' by using open cv imread

I am currently using Anaconda 4.3.27, Python 3.6.2 and OpenCV 3.3.0 When I try img1 = cv2.imread('D:\Images\3D-Matplotlib.png') img2 = cv2.imread('D:\Images\mainsvmimage.png') I get libpng error: Read Errorand a pop-up shows up, indicating that…
Jorre Goossens
  • 139
  • 1
  • 2
  • 10
1
2 3
18 19