271 questions
Score of 2
1 answer
80 views
How can I save an image after altering its color?
I have a small Python code to read and save an image:
import numpy as np
# from scipy.misc import imread, imsave # Not working
from imread import imread, imsave
img = imread('tst-image.jpg')
# print(...
Score of 0
1 answer
167 views
reading an image with cv2.imread vs matplotlib.pyplot.imread [duplicate]
I am trying to read and show a photo,
it works when I use plt.imshow(..) and I know for sure that the photo and the path are ok.
when I try using cv2 it says the photo is a nonetype
import numpy as np
...
Score of -1
1 answer
137 views
Why does my cv2.imread() giving me None? (python)
I am new to this image detection thing and I've been following a youtube video and trying to make a program that detects an image so I can automate some fishing in a game. But I keep getting this ...
Score of 0
0 answers
139 views
Errno 22: Invalid argument while using tiff.imread() in python
I have a folder with ~800 tiff images. i wrote the following code to save these as multiple tiff stacks of 220 images each. In a later section of this code, i try to open the tiff stacks that I've ...
Score of 1
1 answer
993 views
How to catch CV2 errors with try - except statements in Python
so, I have a few png files that are saved following the pattern
name_number1_section_number2
The two fields number1 and number 2 are taken up by integers, so a file would be named
name_1_section_23
...
Score of 0
0 answers
165 views
I'm using imageio.imread, the folder has 22 tif files the shape of the matrix I get is (514 1030 4), I expect (514 1030 22)
(First time user)
I want to read tif files from a folder.
N=22 (the number of tif files in the folder)
The name of the folder is: tif_files
The file names start at E_0 and ends at E_21
I'm reading the ...
Score of 0
1 answer
508 views
When calling Robot framework custom library definition by passing integers as arguments it is trying to read as a image file
This is my robot class file content
*** Settings ***
Library ./robotautogui.py
*** Test Cases ***
move it
move_mouse_to 600 200
and my custom python library file
import pyautogui
class ...
Score of 0
1 answer
218 views
"Dot indexing is not supported for variables of this type" in blockproc(I_STRUCT.coef_arrays{1},[8 8],fun);
After imread into a variable and sending it to the function, it returns an error "Dot indexing is not supported for variables of this type."
Not sure why, it seemed to work with jpg, but ...
Score of 0
1 answer
197 views
convert a .png image to gray scale matrix
I want to import a gray scale .png image into matlab. 2) I want it represented as a scalar field such that each pixel has a corresponding matrix element, and matrix operations can be done on it. 3) ...
Score of 0
1 answer
1818 views
Can't convert object to 'str' for 'filename'
I am working on app where react-native as a frontend and django-rest-framework as a backend. From frontend I am sending Image using formdata in backend. But I am getting this error Can't convert ...
Score of 3
2 answers
2614 views
Why does OpenCV imread() return grayscale images, despite color flag?
I'm reading an jp2 file using openCV's imread().
The image loads, but it's always grayscale.
I saw in the documentation that some IMREAD_FLAGS could cause this and I also know that cv2 may change the ...
Score of 1
0 answers
188 views
Why do Matlab's imread and OpenCV's imread return different pixel values when reading the same image?
The image in question is a uint16 pgm image with a bit depth of 10 but saved as 16-bit. When reading the image using Matlab's imread, the pixel values are 2^6 times larger than those obtained using ...
Score of 1
1 answer
353 views
Why read the same picture with python and javascript with the help of opencv, the results are inconsistent?I think it should be same
picture_4000*4000:
the python code is:
import cv2
pic_data = cv2.imread(path_to_picture)
the pic_data is:
pic_data
Out[21]:
array([[[125, 189, 204],
[125, 189, 204],
[125, 189, 204],...
Score of 0
0 answers
176 views
Numpy array only containing [0,0,0,1] when using imread on png file
Im using matplotlib and numpy to turn a png file (link to image: https://imgpile.com/i/boANTE) into a 2d array using this code:
import numpy as np
from matplotlib import pyplot as mat_plot
mapimage =...
Score of 0
0 answers
341 views
How to apply Bitwise AND operation for multiple images?
I need to do use bitAnd operation with img1 and each image of the directory. I read each image as img2.
img1 = np.zeros((600, 400, 3), np.uint8)
center_coordinates = (320, 200)
axesLength = (300, 80) ...
Score of 0
1 answer
295 views
JPG to GIF animation
I am using this code for conversion of JPGs to GIF animation. It works but produces strange colors (first and second picture in animation have incorrect colors and third is OK).
I would like to ask ...
Score of 1
1 answer
822 views
OpenCvSharp4 ImRead return empty image (whereas OpenCvSharp3 works)
Imread is not working anymore with ".tif" (48 bits) file after updating the OpenCvSharp wrapper version from OpenCvSharp3Any-Cpu (wrapper 4.X) to OpenCvSharp4.Windows and .Extensions. The ...
Score of 1
1 answer
581 views
Openvino unable to compile numpy array
Openvino throws "RuntimeError: Cannot get dims for non static shape" when an image is passed as numpy array to openvino Core().compile_model(). But the same image when passed after doing a ...
Score of 2
3 answers
2409 views
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 ...
Score of 0
1 answer
2703 views
cv2.resize changes color mode of my image
I want to resize an image but it turns blue when I use the method.
My venv has:
Python 3.9
opencv-python==4.5.5.64
I'm working on a .ipynb file through Pycharm.
Have this cell after imports:
sns....
Score of 0
0 answers
330 views
imread return None even though the image exists in the given path
images = glob.glob('../catkin_ws/src/project1/images/*.jpg')
print(images)
When I print the variable images I get all the image file like this in an array.
['../catkin_ws/src/project1/images/img1.jpg'...
Score of -1
1 answer
1117 views
Imread grayscale is different than imread + convert to grayscale [duplicate]
While working with OpenCV, I found a curious behavior and my knoledge couldn't explain it.
Maybe someone will have the answer.
image= cv.imread("image.jpg", 0)
__, thre = cv.threshold(image, ...
Score of 0
1 answer
1960 views
plt.gray() is not working and displaying original color image in matplotlib
With the following code, plt.gray() is not working and showing a colour image instead of grayscale. Even I put cmap="gray" separately in plt.imshow, still it is showing the image in colour. ...
Score of 1
0 answers
49 views
opencv 3.1.0 imread stunked, but imdecode is ok
I'm using opencv 3.1.0, tried to read an image by imread, just like
Mat image = cv::imread("1.jpg");
but it stunked without any error message (performs like in an endless loop)
I changed ...
Score of 1
3 answers
1105 views
How set white color background when concatenating images via python?
import numpy as np
from imageio import imread, imwrite
im1 = imread('https://api.sofascore.app/api/v1/team/2697/image')[...,:3]
im2 = imread('https://api.sofascore.app/api/v1/team/2692/image')[...,:3]...
Score of 0
1 answer
145 views
Matlab loop through images in a folder an transform each picture with Imreadto an array [duplicate]
I want to loop through a list of images in Matlab by unsing a loop. I want to get one Image at a time and turn it into a Matrix by using the imread function. Then I want to save each Matrix in a ...
Score of 0
1 answer
298 views
Why the view of some photos read by cv2.imread and plt.imread are different?
I have some photos taken by UAV, and I find that the view of some photos read by cv2.imread and plt.imread are different, one of them is upside down (180° rotation), but most photos are the same.
Why?
Score of -1
1 answer
413 views
open cv can not read all files form a path
I am working with a dataset of 72 images and 72 masks. I appended the images into a numpy ndarrayI want the cv2 to read the files from the path corresponding to the files in the numpy ndarray.
this is ...
Score of 2
1 answer
2139 views
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?...
Score of 0
2 answers
853 views
cv2.imread works with one file but not when iterating os.listdir()
I try to import several images to opencv with cv.imread() function.
I think there is a problem with the way I give the path to imread().
With one file it's ok with:
cv.imread('data/img.png')
But ...
Score of -1
2 answers
1269 views
What does imread() do when given IMREAD_GRAYSCALE? Why is this different from cvtColor()?
There are several ways in python to generate a greyscale image from an RGB version. One of those is just to read an image as greyscale using OpenCV.
im = cv.imread(path, cv.IMREAD_GRAYSCALE)
Another ...
Score of 2
2 answers
260 views
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 = ...
Score of 0
1 answer
4000 views
module 'skimage.data' has no attribute 'imread'
import skimage
image = skimage.data.imread("my_image.png")
I used this code to read an image, but I got an error as "skimage.data" has no attribute "imread".
My skimage ...
Score of 0
2 answers
611 views
OpenCV Tiff Wrong Color Values Readout
I have a 16-bit tiff image with no color profile (camera profile embedded) and I am trying to read its RGB values in OpenCV. However, comparing the output values to the values given when the image is ...
Score of 0
1 answer
236 views
How to use a picture from a plot for the further code
I tried to use a plot as image for my further code. I load an image in my pretrained model and my output is a tensor variable. In the next step I plot it with Image(img_hr).show(figsize=(18,15)). And ...
Score of 1
1 answer
641 views
Get pixel values in RGB images using PixelList in MATLAB
I am trying to get pixel intensity values from regions of interest in RGB images.
I segmented the image and saved the regions of interest (ROI) using regionprops 'PixelList' in MATLAB, as shown below:
...
Score of 0
2 answers
904 views
OpenCV imread(std::string filename, int flags) problem when using a variable for string filename in c++
I have a function that is something like this:
void OpenPattern(std::string filename, bool type){
Mat img = cv::imread(filename, cv::IMREAD_COLOR);
if(img.empty()){
printf("CANNOT ...
Score of 0
2 answers
2511 views
How to save cv2.imwrite into a variable and called it in cv.imread
I am using cv2.imwrite to save my new edited image. Now I want to call that in cv.imread. I want to write my new image to variable so I can call that variable in cv.imread but it looks like cv.imread ...
Score of 0
1 answer
1584 views
cv::imread() in OpenCV not reading my .png
I am really new to OpenCV and I was wondering why my debug string for empty matrix is running when I check if I have a png in my directory. I can confirm that I do indeed have an image by given name ...
Score of 1
1 answer
2846 views
How to check a jpeg image whether corrupt?
Here, I use opencv imread read the all the image without any problem while it raise out Corrupt Data: xxx extraeous bytes before marker 0xd9 when training with neural networks. How could I get out ...
Score of 0
0 answers
99 views
How to load large videos dataset with multiprocessing?
I am working with a large dataset of videos preprocessed and converted in frames. So I have the following folder tree:
data
training_set
class1
video1
Frame0.png, ..., FrameN.png
videoN
Frame0....
Score of 0
1 answer
413 views
Why is the last frame always excluded, when converting images into a video?
I have a folder with 225 pictures of maps. So, I compiled it to an mp4 file using imageio. Whether it's compiling 10 maps, 150, or all 225, the last picture is always not included in the video.
import ...
Score of 0
1 answer
322 views
Customer Error: imread read blank (None) image for file- Sagemaker AWS
I am following this tutorial with my custom data and my custom S3 buckets where train and validation data are. I am getting the following error:
Customer Error: imread read blank (None) image for file:...
Score of 1
1 answer
832 views
Python: How to save EXACT numpy array data to image using matplotlib.image.imsave()
I observed some strange behavior when saving and loading data using matplotlibs imsave() and imread() functions. The RGB values I save are different to the ones I get when loading the picture back in ...
Score of 0
2 answers
279 views
Unable to append in order
import os
train_dir = "/Images/train/"
data = []
for i in os.listdir(train_dir):
path = os.path.join(train_dir, i)
img = cv2.imread(path)
print(i)
data.append(img)
My train ...
Score of 0
0 answers
501 views
OpenCV(4.3.0): error: (-215:Assertion failed) !_src.empty() in function 'GaussianBlur'
I am new to OpenCV. I am trying to apply a Gaussian filter to the images. The below java code is working fine for one image but for all other images in the same or other location in my machine, it is ...
Score of 0
0 answers
118 views
open CV (python) my code has a problem with imread. It is not working as expected all the outputs are zero
I am using python to learn open CV and while I was trying to image process I came up with a problem. My code is like this:
import numpy as np
import cv2
img = cv2.imread("Pictures/sun.jpg"...
Score of 0
3 answers
2280 views
cv2.imread error:img = cv2.imread(0) SystemError: <built-in function imread> returned NULL without setting an error
I was making a simple program to take an image from the camera but a strange error has occurred:
Traceback (most recent call last):
File "the path was deleted for stackoverflow", line 3, in &...
Score of 2
0 answers
128 views
How can I read an image from memory in Matlab? (instead of imread)
I'm trying to get an image from buffer memory into Matlab.
For example in C++ and openCV I can get image from memory with;
fn_export double ImgFromMem(char* address,double width, double height) {
...
Score of 0
1 answer
681 views
Is cv2.imread trying to read the folder and not the images in it?
import numpy as np
import matplotlib.pyplot as plt
import os
import cv2
DATADIR = "C:\\Users\\Timmi K. Rysgaard\\OneDrive\\Desktop\\Sculptures\\"
CATEGORIES = ["Beetle", "...