creating a weight map from a binary image

Hi, I would like to create a weight map from a binary image in way to have more intensity values in the border pixels between the close object. To make it more clear I need to calculate w(x) from an input image in the below image following the formula mentioned below. Where w0 and sigma are two constant value, x denotes pixels in the image, d1 denotes the distance to the border of the nearest object and d2 is distance to the border of the second nearest cell.
I need this weight map to implement the loss function in the U-net architecture for image segmentation.

4 comentarios

KALYAN ACHARJYA
KALYAN ACHARJYA el 26 de Jul. de 2018
Share, what you have tried so far? So that we can modify your code.
Guillaume
Guillaume el 26 de Jul. de 2018
How is distance to be calculated? Euclidean or another option?
Distance to the nearest object is trivial to calculate, distance to the 2nd nearest is going to be a lot more tricky. Right now, I can't think of an algorithm that wouldn't be extremely inefficient. You're probably going to have to research distance transform algorithms and see if one can be adapted to ignore the nearest object.
Where did you get this formula? If it comes from a paper don't they explain how to calculate d2?
Amirreza Mahbod
Amirreza Mahbod el 26 de Jul. de 2018
Thanks for your quick reply. Could you please tell me how it would be possible to calculate the distance to nearest object in matlab or python? You can find the paper from here (I am referring to figure 3c and 3d) but unfortunately there is no practical explanation for that.
Guillaume
Guillaume el 26 de Jul. de 2018
The distance to the nearest object is bwdist with the correct metric as per the link in my previous comment.

Iniciar sesión para comentar.

Respuestas (0)

Preguntada:

el 26 de Jul. de 2018

Comentada:

el 26 de Jul. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by