[Numpy-discussion] Neighbour-frequency matrix

David Warde-Farley dwf@cs.toronto....
Wed Jul 15 18:37:10 CDT 2009


On 15-Jul-09, at 6:40 PM, Vebjorn Ljosa wrote:

> On Jul 15, 2009, at 17:51, David Warde-Farley wrote:
>
>> Suppose I have an 8-bit integer 2-d array, X, and I want a 256x256
>> matrix that tells me how many times a pixel value v was horizontally
>> (along second dimension) adjacent to a pixel value b
>
>> Is there an efficient way to do such a thing with numpy operations? I
>> can't think of a way.
>
> I wrote the following cooccurrence matrix function as part of
> computing Haralick texture features.  It's not exactly what you ask
> for, but close enough that it may give you some ideas.

The Haralick-style features are exactly what I was thinking about.  
Thanks for the pointer to that code. :)

Just curious - I noticed in the comments that you (or someone) said  
there's a problem in the original paper's definition. Do you have any  
idea which feature that concerned?

David



More information about the NumPy-Discussion mailing list