Questions tagged [python-imageio]

Imageio is a Python library that provides an easy interface to read and write a wide range of image data including animated images, volumetric data, and scientific formats. Make to use this tag for question related to it.

191 questions
0
votes
1 answer

Adding Text to GIF made with `imageio.mimread()`

I am working with this data analysis pipeline that makes gifs of video recordings, the function used for this is: def make_gif(self, datafile, save_file, frame_limit:int=20, fps:int=10, verbose=True): h5 = h5py.File(datafile, "r") frames =…
Knova
  • 15
  • 4
0
votes
1 answer

How to read images using skimage

seed = 42 np.random.seed = seed Img_Width=128 Img_Height=128 Img_Channel = 3 Train_Path = 'stage1_train/' Test_Path = 'stage1_test/' train_ids = next(os.walk(Train_Path))[1] test_ids = next(os.walk(Test_Path))[1] print(train_ids) X_train =…
0
votes
0 answers

OpenCV - How to create webM with a transparent background?

When I'm using COLOR_RGBA2BGR all works fine,but transparent background of the GIF become black Example gif url: https://i.stack.imgur.com/WYOQB.gif When I'm using COLOR_RGBA2BGRA, then OpenCV will generate an invalid video. How can I write webM…
0
votes
0 answers

Play mp4 (with audio) in Tkinter Python

i need play video with audio using module tkinter by giving location of files of ( mp4 and audio ) or mp4 and also both the video and audio should sync i tried this is my code-1: from tkinter import * import pygame from PIL import Image,…
0
votes
1 answer

Combining various image channels after gaussian filtering produces white image

I am trying to implement a gaussian filter for an image with dimensions (256, 320, 4). I first generated a gaussian Kernel for the same and then individually perform the convolution on each of the 4 channel, i.e on all the 256*320 greyscale images.…
0
votes
1 answer

Animate static image

I have a static image that I would like to animate to appear like this (except starting from a black image, not a white image): (image is from this post: Create animated gif from static image) Here is the code: import random import imageio import…
gnpunpun
  • 21
  • 2
0
votes
1 answer

TypeError: _open() got an unexpected keyword argument 'pilmode'

I am training a CNN model on the COCO dataset, and I am getting this error after a few iterations. The error is not consistent because I got this error in 1100 iterations, once in 4500 iterations and one time in 8900 iterations (all of them in 1…
0
votes
1 answer

mp4 to gif converter failing to produce

I'm struggling with my converter from mp4 to gif. Its basically been put together from imageio website and YouTube, but cant get it to work. #[python converter.py] import imageio import os clip = os.path.abspath('six.mp4') def…
0
votes
0 answers

Read only first frame from an MKV with Python

This answer shows how to read MKV video using Python, but it appears to be reading/processing the entire video before the call to imageio.get_reader returns. Is there a way to parse just the first frame of the MKV using imageio? If not, how about…
Dave Johansen
  • 889
  • 1
  • 7
  • 23
0
votes
1 answer

convert all img in one pdf .?

I would like to finish my script, I tried a lot to solve but being a beginner failed. I have a function imageio which takes image from website and after that, i would like resize all images in 63x88 and put all my images in one pdf. full_path =…
0
votes
0 answers

TypeError Invalid shape (4,) for image data on matplotlib show image

I try to convert the RGB image to greyscale using the below code import imageio import numpy as np import matplotlib.pyplot as plt pic = imageio.imread("my2.jpg") gray = lambda rgb : np.dot(rgb[... , :3] , [0.299 , 0.587, 0.114]) gray = gray(pic) …
bayu
  • 61
  • 1
  • 11
0
votes
2 answers

Imageio.imwrite does not save the correct values

Can someone please explain why do I get this inconsistency in rgb values after saving the image. import imageio as io image = 'img.jpg' type = image.split('.')[-1] output = 'output' + type img = io.imread(image) print(img[0][0][1]) #…
0
votes
1 answer

Changing image size while capturing using webcam using imageio

I am trying to capture image with each function call import imageio as iio camera = iio.get_reader("") screenshot = camera.get_data(0) plt.imsave(filename, screenshot) camera.close() I am able to save the image but the image size is varying…
Kumar
  • 125
  • 1
  • 9
0
votes
1 answer

set imageio compression level in python

I'm using imageio in Python to read in jpg images and write them as a gif, using something resembling the code below. import imageio with imageio.get_writer('mygif.gif', mode='I') as writer: for filename in framefiles: # iterate over names…
Frank Seidl
  • 148
  • 7
0
votes
1 answer

How to read a hdr image quickly in the RGBE format in Python?

I would like to know how to read a HDR image (.hdr) by obtaining pixel values in the RGBE format quickly and efficiently in Python. These are somethings I tried: import imageio img = imageio.imread(hdr_path, format="HDR-FI") alternatively: …
Coder Alpha
  • 157
  • 1
  • 10