Maybe i misunderstood something about the log. when I do log(phi(x_i,x_j)), in most of the cases i get negative values - which is wrong since the message have to be positive, right? otherwise we might get negative values for the pixels.

The only times where we don't get negative values is when the difference between the pixel values is really small.

Does that make sense? how?

]]>When working with logs, the message updates etc are additive, so zero values shouldn't be a problem. ]]>

We get much better results without it, and it causes some problems since there are cases of zero values in the message.

]]>its a bit problematic since log{m} can be negative and then the sum of messages calculate for normalizing can be negative

which would change the sign of the messages which would probably affect the node's belief.

Thanks!

]]>Thus, if:

m_{ij}(x_j)= max_{x_i} \phi(x_i,x_j) \prod_{k\in N(i)\neq j} m_{ki}(x_i)

You can equivalently write:

log(m_{ij}(x_j))= max_{x_i} log(\phi(x_i,x_j)) + \sum{k\in N(i)\neq j} \log{m_{ki}(x_i)}

And do all updates in log space.

]]>