scikit-image

How to read mp4 video to be processed by scikit-image?

白昼怎懂夜的黑 提交于 2019-11-28 17:50:01
问题 I would like to apply a scikit-image function (specifically the template matching function match_template ) to the frames of a mp4 video, h264 encoding. It's important for my application to track the time of each frame, but I know the framerate so I can easily calculate from the frame number. Please note that I'm running on low resources, and I would like to keep dependencies as slim as possible: numpy is needed anyway, and since I'm planning to use scikit-image , I would avoid importing (and

How to install scikit-image?

本秂侑毒 提交于 2019-11-28 13:32:17
问题 Its scikit-image Download says: pip install -U scikit-image or easy_install -U scikit-image but both fail, regardless of the flag U, as shown below: Georgioss-MacBook-Pro:Downloads gsamaras$ sudo pip install scikit-image The directory '/Users/gsamaras/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '

reshaping a view of a n-dimensional array without using reshape

不羁岁月 提交于 2019-11-28 09:30:26
问题 tl;dr Can I reshape a view of a numpy array from 5x5x5x3x3x3 to 125x1x1x3x3x3 without using numpy.reshape? I would like to perform a sliding window operation (with different strides) to a volume (size of MxMxM). The sliding window array can be generated with the use of numpy.lib.stride_tricks.as_strided, as previously suggested by Benjamin and Eickenberg, and demonstrated in the below code snippet, which uses a helper method from skimage that uses as_strided . The output from this helper

How to identify incomplete rectangles in openCV

走远了吗. 提交于 2019-11-28 01:04:05
问题 How would I go around identifying and extracting rectangles from an image such as the one shown below. Note that my rectangles might be incomplete and have some missing edges and some sides might be partial lines. Thanks ! 回答1: This can be solved using morphological operations such as eroding and dilating. This two operations will help creating closed rectangles. After that you can use the tutorial from this page to detect simple shapes such as rectangles. I implemented a quick demo which

Calculating percentage of Bounding box overlap, for image detector evaluation

好久不见. 提交于 2019-11-27 21:22:42
问题 In testing an object detection algorithm in large images, we check our detected bounding boxes against the coordinates given for the ground truth rectangles. According to the Pascal VOC challenges, there's this: A predicted bounding box is considered correct if it overlaps more than 50% with a ground-truth bounding box, otherwise the bounding box is considered a false positive detection. Multiple detections are penalized. If a system predicts several bounding boxes that overlap with a single

Error with pip install scikit-image

∥☆過路亽.° 提交于 2019-11-27 16:10:46
问题 I am using Windows 8.1 64 bit and Python 2.7. While trying to install scikit-image from the shell pip install scikit-image I have encountered this error: Command "python setup.py egg_info" failed with error code 1 in c:\users\france~1\appdata\local\temp\pip-buildtksnfe\scikit-image\ The download is fine but the installation fails. What is the problem here and how to solve it? EDIT After upgrading my pip with python -m pip install -U pip setuptools and trying again, I got: Command "python

How to find the average colour of an image in Python with OpenCV?

江枫思渺然 提交于 2019-11-27 11:23:33
I tried this code: import cv2 image = cv2.imread("sample.jpg") pixel = image[200, 550] print pixel But I am getting error as: 'Nonetype' no attributes error getitem This error is getting displayed after executing the third line of code. How to fix the error There are two potential causes for this error to happen: The file name is misspelled. The image file is not in the current working directory. To fix this issue you should make sure the filename is correctly spelled (do case sensitive check just in case) and the image file is in the current working directory (there are two options here: you

Save numpy array as image with high precision (16 bits) with scikit-image

爱⌒轻易说出口 提交于 2019-11-27 03:20:43
问题 I am working with 2D floating-point numpy arrays that I would like to save to greyscale .png files with high precision (e.g. 16 bits). I would like to do this using the scikit-image skimage.io package if possible. Here's the main thing I've tried: import numpy as np from skimage import io, exposure, img_as_uint, img_as_float im = np.array([[1., 2.], [3., 4.]], dtype='float64') im = exposure.rescale_intensity(im, out_range='float') im = img_as_uint(im) im produces: array([[ 0, 21845], [43690,

Split text lines in scanned document

我只是一个虾纸丫 提交于 2019-11-26 12:07:33
I am trying to find a way to break the split the lines of text in a scanned document that has been adaptive thresholded. Right now, I am storing the pixel values of the document as unsigned ints from 0 to 255, and I am taking the average of the pixels in each line, and I split the lines into ranges based on whether the average of the pixels values is larger than 250, and then I take the median of each range of lines for which this holds. However, this methods sometimes fails, as there can be black splotches on the image. Is there a more noise-resistant way to do this task? EDIT: Here is some

Interactive pixel information of an image in Python?

十年热恋 提交于 2019-11-26 05:28:33
问题 Short version: is there a Python method for displaying an image which shows, in real time, the pixel indices and intensities? So that as I move the cursor over the image, I have a continually updated display such as pixel[103,214] = 198 (for grayscale) or pixel[103,214] = (138,24,211) for rgb? Long version: Suppose I open a grayscale image saved as an ndarray im and display it with imshow from matplotlib: im = plt.imread(\'image.png\') plt.imshow(im,cm.gray) What I get is the image, and in