Tagged Questions
1
vote
2answers
40 views
Inverting numpy array image which might be uint8, uint16,
Is there a prettier way to do this? Specifically, are these max values available through the numpy API? I haven't been able to find them in the API, although they are easily found here in the docs.
...
0
votes
1answer
50 views
Pixel color inside a contour using numpy
I am trying to constitute a numpy array containing the color hue of each pixel within a contour, using opencv 2.4. I have extracted the coordinates of all point included inside the contour using ...
1
vote
1answer
52 views
Turning selected pixels to black based on an HSV hue range
This snippet of code is part of a program that turns pixels to black in an opencv image based on an HSV hue range (here, 180-250).
Does somebody happen to understand why the code below raises the ...
0
votes
0answers
30 views
Pypng write produces a blank/black image
I'm trying to run the exnumpy.py script from: http://pypng.googlecode.com/svn/trunk/code/exnumpy.py. I've supplied it with multiple pictures and have tried running it on multiple computers, but every ...
6
votes
4answers
199 views
Peak detection in a noisy 2d array
I'm trying to get python to return, as close as possible, the center of the most obvious clustering in an image like the one below:
In my previous question I asked how to get the global maximum and ...
2
votes
1answer
110 views
Numpy dot product
I have an image represented with a Numpy array, i.e. each pixel is an array [r,g,b].
Now, I want to convert it in YUV using matrix multiplication and trying not to use loops.
self.yuv=self.rgb
...
0
votes
1answer
114 views
Trying to understand NumPy's linalg.norm method
I do not understand what this code is doing. X is a matrix which each row of it is an eigenvector of an image. What does the norm do?
# Take an eigenvector and make it into an image
def ...
1
vote
1answer
180 views
Face Recognition - How to return the correct image?
I am trying to make hand gesture recognition (similar to face recognition) using Principal Component Analysis(PCA) in python. I have a Test image and I want to get its nearest match from a set of ...
2
votes
2answers
92 views
NumPy/OpenCV 2: how to enumerate all pixels from region?
This is a continuation of my older question.
Given non-rectangular region, how do I enumerate all pixels from it and arrange them as a single vector? Order doesn't matter (though should be ...
0
votes
0answers
99 views
Python - AttributeError: __getitem__
I am required to access all images in a folder and store it in a matrix using python. Here is my code.
import Image
import os
from PIL import Image
from numpy import *
import numpy as np
#import ...
1
vote
1answer
101 views
Image to matrix using python
I am required to access all images in a folder and store it in a matrix. I was able to do it using matlab and here is the code:
input_dir = 'C:\Users\Karim\Downloads\att_faces\New Folder';
image_dims ...
1
vote
2answers
648 views
How to determine a region of interest and then crop an image using OpenCV
I asked a similar question here but that is focused more on tesseract.
I have a sample image as below. I would like to make the white square my Region of Interest and then crop out that part ...
0
votes
1answer
133 views
Convert Image ( png ) To Matrix And Then To 1D Array
I have 5 pictures and i want to convert each image to 1d array and put it in a matrix as vector. I want to be able to convert each vector to image again.
img = Image.open('orig.png').convert('RGBA')
...
1
vote
2answers
89 views
What's the meaning of numbers in numpy arrays?
In numpy, The array method could convert a image to a big array, the question is , whats' the meaning of the numbers in this array?(RGB value? gray-scale value? )
What's more, when I convert a image ...
2
votes
1answer
677 views
How do I plot FFT in Numpy
This seems like a very easy question, yet I couldn't find any documentation for this.
I have an image in Numpy, and i want to imshow the FFT.
In Matlab I can just do
F = fft(myimg)
imshow(F)
I ...
1
vote
2answers
125 views
Remove points which contains pixels fewer than (N)
I tried almost all filters in PIL, but failed.
Is there any function in numpy of scipy to remove the noise?
Like Bwareaopen() in Matlab()?
e.g:
PS: If there is a way to fill the letters into ...
4
votes
1answer
523 views
NumPy/OpenCV 2: how do I crop non-rectangular region?
I have a set of points that make a shape (closed polyline). Now I want to copy/crop all pixels from some image inside this shape, leaving the rest black/transparent. How do I do this?
For example, I ...
1
vote
1answer
192 views
Aggregating neighbouring pixels Python / GDAL and Numpy without interpolation
Consider we have an image of 2000 x 2000 pixels and the pixel size is 10 x 10 meters. The pixel values are also float numbers ranging from 0.00 - 10.00. This is image A.
I would like to resize image ...
0
votes
1answer
95 views
image feature detection with large structuring element
I am trying to extract some features from an image but each of the extracted features are really small. The easiest way to extract larger features seems to be to use a larger structuring element but ...
1
vote
1answer
51 views
Copy a image on a new larger image
I have a color image sourceImage and I would copy this image on a new larger color image destImage: the source image should be centered over the new image. In order to perform this procedure, I wrote ...
-1
votes
1answer
134 views
'Sort' the pixels in an image in python [closed]
Given an N x M image, I want collect all pixels of each color together and represent the image as a (N*M) x 1 image (image of N*M pixels by 1 pixel), with the following two criteria:
All pixels of ...
2
votes
3answers
722 views
Grayscale image to NumPy array for Fourier transform
Currently I'm using PIL and NumPy. I have a colored png image and I want to:
Read it in in grayscale
Convert to NumPy array
Perform a FFT on array
Display the image
This is what I'm trying (in ...
3
votes
3answers
248 views
Finding bounding boxes of RGB colors in image
I'm working with a page segmentation algorithm. The output of the code writes an image with the pixels of each zone assigned a unique color. I'd like to process the image to find the bounding boxes of ...
2
votes
3answers
418 views
Using numpy to efficiently convert 16-bit image data to 8 bit for display, with intensity scaling
I frequently convert 16-bit grayscale image data to 8-bit image data for display. It's almost always useful to adjust the minimum and maximum display intensity to highlight the 'interesting' parts of ...
4
votes
2answers
177 views
Scipy Binary Closing - Edge Pixels lose value
I am attempting to fill holes in a binary image. The image is rather large so I have broken it into chunks for processing.
When I use the scipy.ndimage.morphology.binary_fill_holes functions, it ...
1
vote
1answer
278 views
Efficiently remove rows/columns of numpy image array
I am trying to remove rows or columns from an image represented by a Numpy array. My image is of type uint16 and 2560 x 2176. As an example, say I want to remove the first 16 columns to make it 2560 x ...
1
vote
2answers
151 views
Iteration over binarized image with numpy is slow
I need to iterate over all the pixels in a binarized image to find shapes. But it takes a long time to iterate each image pixel in this manner. Is there any other way to iterate the image pixels in a ...
1
vote
1answer
317 views
Image rotation and scaling the frequency domain?
I'm writing some code to recover the rotation, scaling and translation of a test image relative to a template using phase correlation, a la Reddy & Chatterji 1996. I take the FFT of my original ...
1
vote
2answers
219 views
Slicing a numpy image array into blocks
I'm doing image processing for object detection using python. I need to divide my image into all possible blocks. For example given this toy image:
x = np.arange(25)
x = x.reshape((5, 5))
[[ 0 1 2 ...
1
vote
2answers
398 views
how to convert an image from BGR to LAB with opencv 2.4 python 2.7 and numpy
Hy
I am working with opencv 2.4 and numpy. I would like to open an image and get all the informations about it (8 bit - if its RGB-BGR etc) and also try to change the color space.
I have this code:
...