Questions tagged [scikit-image]

scikit-image is a Python image processing toolbox for SciPy.

scikit-image is a collection of algorithms for image processing with SciPy. The scikit-image SciKit extends scipy.ndimage to provide a versatile set of image processing routines.

1871 questions
9
votes
2 answers

scikit-image: write a ndarray to image with imsave, read back with imread, data don't match

here is the minimum working example: import numpy as np from skimage.io import imsave, imread image = np.array([[[109, 232, 173], [ 55, 35, 144]], [[ 43, 124, 185], [234, 127, 246]]],…
scott huang
  • 2,478
  • 4
  • 21
  • 36
9
votes
3 answers

detect rectangle in image and crop

I have lots of scanned images of handwritten digit inside a rectangle(small one). Please help me to crop each image containing digits and save them by giving the same name to each row. import cv2 img = cv2.imread('Data\Scan_20170612_4.jpg') gray…
utkarsh
  • 333
  • 1
  • 3
  • 11
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
9
votes
2 answers

OpenCV: RGB to YUV conversion, and showing channels like Wikipedia

I have been looking this conversion for a while. What are the ways of converting RGB image to YUV image and accessing Y, U and V channels using Python on Linux? (using opencv, skimage, or etc...) Update: I used opencv img_yuv = cv2.cvtColor(image,…
hma
  • 556
  • 2
  • 11
  • 29
9
votes
2 answers

Merging non-overlapping array blocks

I divided a (512x512) 2-dimensional array to 2x2 blocks using this function. skimage.util.view_as_blocks (arr_in, block_shape) array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]]) >>> B = view_as_blocks(A,…
hma
  • 556
  • 2
  • 11
  • 29
9
votes
1 answer

on reading tiff file using skimage

I am using the following code to read a set of tiff files from a folder from PIL import image from skimage import io io.use_plugin('pil') images = os.listdir(train_data_path) for image_name in images: img =…
user785099
  • 5,323
  • 10
  • 44
  • 62
9
votes
2 answers

Load custom image from file system in scikit-image

I am new to Python and I am trying to do the tutorial, shown on the official page. My goal is, to analyze a picture I've created, using the Local Otsu Threshold method. The code with an example picture works fine but I want to read a custom image,…
John
  • 795
  • 3
  • 15
  • 38
9
votes
3 answers

Wiener Filter for image deblur

I am trying to implement the Wiener Filter to perform deconvolution on blurred image. My implementation is like this import numpy as np from numpy.fft import fft2, ifft2 def wiener_filter(img, kernel, K = 10): dummy = np.copy(img) kernel =…
yc2986
  • 1,101
  • 3
  • 20
  • 23
9
votes
2 answers

What to choose to begin with ComputerVision: Scikit-image or OpenCV?

My goal is to recognize specific types of traffic signs: red circles on video in real time.
8
votes
2 answers

How to write text over an image using scikit-image?

I know how to do this with OpenCV and PIL. I can't use OpenCV in this project and if I use PIL I have to convert in between image PIL Image and numpy array. I don't want to do that. I'm already using skimage so... How do I write text on top of an…
noel
  • 2,257
  • 3
  • 24
  • 39
8
votes
4 answers

Problem installing scikit-image probably due to blosc

Hi I am trying to install scikit image in a virtual environment on ubuntu 18.04. It fails when it tries to install imagecodecs, I tried to install imagecodecs separately but it gives the same error which is something due to blosc. I installed blosc…
si_mon
  • 171
  • 1
  • 8
8
votes
2 answers

Convert image from float64 to uint8 makes the image look darker

I have images of type float64 generated by GANs, and I save them through skimage.io.imsave. The process works well and the saved image looks nice, but I get a warning message as follows: Lossy conversion from float64 to uint8. Range…
Maybe
  • 2,129
  • 5
  • 25
  • 45
8
votes
1 answer

What is the difference between opencv ximgproc.slic and skimage segmentation.slic?

I run the SLIC (Simple Linear Iterative Clustering) superpixels algorithm from opencv and skimage on the same picture with, but got different results, the skimage slic result is better, Shown in the picture below.First one is opencv SLIC, the second…
Yifeng_Li
  • 133
  • 2
  • 6
8
votes
2 answers

Efficiently resize batch of np.array images

I have a 4D np.array size (10000,32,32,3) that represents a set of 10000 RGB images. How can I use skimage.transform.resize or other function to resize all images efficiently so that the (32,32) is interpolated to (224,224)? I'd prefer to do this…
Austin
  • 6,921
  • 12
  • 73
  • 138
8
votes
1 answer

hog() got an unexpected keyword argument 'visualize'

I am running the scikit-image Histogram of Gradients example The example code is as follows: import matplotlib.pyplot as plt from skimage.feature import hog from skimage import data, color, exposure image = color.rgb2gray(data.astronaut()) fd,…
SeanJ
  • 1,203
  • 2
  • 19
  • 39