how to create mask NxN automatically

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to create mask NxN automatically

Maxime demers
Hi everyone,

I would like to hear you about the possibility to create mask of N dimension to "scan" an image. The aim of this mask is to check for each pixel if its value is between the intervals confidence of the mask's pixels or not. Im looking for a function that will create a mask of the desired dimension of the user. For instance: 3x3, 5x5, 7x7, 11x11, etc.

if the scanned pixel is defined by (i,j)
the function should put all the values of the mask NxN at the position (i,j) into a list.

For now, I can manualy create mask of 3x3 and 5x5 by including the pixels (i-1,j-1) to (i+1,j+1) etc... in a list, but its getting complicated for 7x7 and bigger mask.

Thanks for your help, its really appreciated

Maxime Demers
Geomatics and Remote Sensing
University de Sherbrooke

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: how to create mask NxN automatically

Chris Mitchell-2
Are you using numpy or doing for loops?

On Thu, Nov 18, 2010 at 10:46 AM, Maxime demers <[hidden email]> wrote:

> Hi everyone,
>
> I would like to hear you about the possibility to create mask of N dimension
> to "scan" an image. The aim of this mask is to check for each pixel if its
> value is between the intervals confidence of the mask's pixels or not. Im
> looking for a function that will create a mask of the desired dimension of
> the user. For instance: 3x3, 5x5, 7x7, 11x11, etc.
>
> if the scanned pixel is defined by (i,j)
> the function should put all the values of the mask NxN at the position (i,j)
> into a list.
>
> For now, I can manualy create mask of 3x3 and 5x5 by including the pixels
> (i-1,j-1) to (i+1,j+1) etc... in a list, but its getting complicated for 7x7
> and bigger mask.
>
> Thanks for your help, its really appreciated
>
> Maxime Demers
> Geomatics and Remote Sensing
> University de Sherbrooke
>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig
>
>
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: how to create mask NxN automatically

Chris Barker
On 11/18/10 8:47 AM, Chris Mitchell wrote:
> Are you using numpy or doing for loops?

definitely a job for numpy -- if you aren't using it, check it out.

-CHB


> On Thu, Nov 18, 2010 at 10:46 AM, Maxime demers<[hidden email]>  wrote:
>> Hi everyone,
>>
>> I would like to hear you about the possibility to create mask of N dimension
>> to "scan" an image. The aim of this mask is to check for each pixel if its
>> value is between the intervals confidence of the mask's pixels or not. Im
>> looking for a function that will create a mask of the desired dimension of
>> the user. For instance: 3x3, 5x5, 7x7, 11x11, etc.
>>
>> if the scanned pixel is defined by (i,j)
>> the function should put all the values of the mask NxN at the position (i,j)
>> into a list.
>>
>> For now, I can manualy create mask of 3x3 and 5x5 by including the pixels
>> (i-1,j-1) to (i+1,j+1) etc... in a list, but its getting complicated for 7x7
>> and bigger mask.
>>
>> Thanks for your help, its really appreciated
>>
>> Maxime Demers
>> Geomatics and Remote Sensing
>> University de Sherbrooke
>>
>> _______________________________________________
>> Image-SIG maillist  -  [hidden email]
>> http://mail.python.org/mailman/listinfo/image-sig
>>
>>
> _______________________________________________
> Image-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/image-sig


--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig