Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

so in principle your code is working, but dilation should not be the function of your choice if you would like to have a pixel assignment of the highest value in a 3x3 neighbourhood grid. What you are doing here is a grayscale dilation. If you are using a 3x3 grid the changes are really small.

I guess you will need a maximum Filter. Have a look at: https://stackoverflow.com/questions/10621312/opencv-filter-image-replace-kernel-with-local-maximum

or maybe this is working for you: from scipy import ndimage as ndi ... image_max = ndi.maximum_filter(dist_trans, size=3, mode='constant') #change size to see diferent results

hope it helps

so in principle your code is working, but dilation should not be the (only) function of your choice if you would like to have a pixel assignment of the highest value in a 3x3 neighbourhood grid. What you are doing here is a grayscale dilation. If you are using a 3x3 grid the changes are really small.

I guess you will need a maximum Filter. Have a look at: https://stackoverflow.com/questions/10621312/opencv-filter-image-replace-kernel-with-local-maximum

or maybe this is working for you: from scipy import ndimage as ndi ... image_max = ndi.maximum_filter(dist_trans, size=3, mode='constant') #change size to see diferent results

hope it helps

so in principle your code is working, but dilation should not be the (only) function of your choice if you would like to have a pixel assignment of the highest value in a 3x3 neighbourhood grid. What you are doing here is a grayscale dilation. If you are using a 3x3 grid the changes are really small.

I guess you will need a maximum Filter. Have a look at: https://stackoverflow.com/questions/10621312/opencv-filter-image-replace-kernel-with-local-maximum

or maybe this is working for you: you:

from scipy import ndimage as ndi ... ndi

...

image_max = ndi.maximum_filter(dist_trans, size=3, mode='constant') #change size to see diferent results

hope it helps