[Numpy-discussion] look for value, depending to y position

Nadav Horesh nadavh@visionsense....
Wed Apr 14 04:13:21 CDT 2010


I assume that you forgot to specify the range between 300 and 400. But anyway this piece of code may give you a direction:

----------------------------------
import numpy as np

ythreshold = np.repeat(np.arange(4,-1,-1), 100) * 20 +190
bin_image = image > ythreshold[:,None]
----------------------------------

Anyway I advice you to look at image morphology operations in scipy.ndimage

  Nadav


-----Original Message-----
From: numpy-discussion-bounces@scipy.org on behalf of ioannis syntychakis
Sent: Wed 14-Apr-10 10:11
To: Discussion of Numerical Python
Subject: [Numpy-discussion] look for value, depending to y position
 
Hallo everybody

maybe somebody can help with the following:

i'm using numpy and pil to find objects in a grayscale image. I make an
array of the image and then i look for pixels with the value above the 230.
Then i convert the array to image and i see my objects.

What i want is to make the grayscale depented to the place on th image.

the image is 500 to 500 pixels.

and for example i want that the pixelvalue the program is looking for
decreases in the y direction.

on position y= 0 to 100 the programm is looking  for pixelvalues above the
250
 on position y= 100 to 200 the programm is looking  for pixelvalues above
the 230
 on position y= 200 to 300 the programm is looking  for pixelvalues above
the 210
 on position y= 400 to 500the programm is looking  for pixelvalues above the
190

is this possible?

thanks in advance.

greetings, Jannis

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3355 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100414/4f6319e2/attachment-0001.bin 


More information about the NumPy-Discussion mailing list