luispedro / mahotas

Computer Vision in Python
https://mahotas.rtfd.io
Other
839 stars 147 forks source link

[Inquery] Change distance in Haralick features #60

Closed glemaitre closed 8 years ago

glemaitre commented 9 years ago

Hi,

I am currently working with Haralick features and wanted to have a discussion about that. Sometimes, it could be handy to play with a distance parameter when computing the co-occurence instead of using the default value (1 px).

I was checking what could be the best way to modify the source and thought that it could be easier to discuss here. I see two possibilities:

Guillaume Lemaitre

luispedro commented 9 years ago

The resampling is the easiest and can be done with the existing code, but it is not the exact same result.

You don't need to change the C code, you just need to pass it a correct "neighborhood", for example for D=2, direction "right", instead of

[[0 0 0]
 [0 0 1]
 [0 0 0]]

you need to pass it:

[[0 0 0 0]
 [0 0 0 1]
 [0 0 0 0]]

HTH Luis

glemaitre commented 9 years ago

thanks

luispedro commented 9 years ago

Actually, that probably should be:

[[0 0 0 0 0]
 [0 0 0 0 1]
 [0 0 0 0 0]]

(ie, a 5x5 matrix).

glemaitre commented 9 years ago

Ok if I come to do it, I would make a pull request if you are interested.

luispedro commented 9 years ago

Thanks. I would certainly be happy to see this feature (I use the downsampling method myself, but others have asked about it).