I just noticed that there is a bug in the code that manifests itself in "later" versions of Matlab. The bug is related to the Matlab function called IMFILTER. What happens is that when calculating the diffusion weights if the first parameter is in single float format (and not double) then the results are unstable. By unstable I mean that the actual numbers change when you apply the function on the same data. I suspect that it is related to the way how memory is reserved in the MEX-code.

Temporary fix is very easy, you just apply:

  • U = double(U); V = double(V);

in all the functions where the diffusion weights wW, wE, wN and wS are calculated in the Matlab-code. Typically the function that updates the diffusion weights is called:

  • function [wW wN wS wE] = OPdiffWeights(U, V)

Previously in earlier versions of Matlab this was not a problem and the code has been tested in different computers with different operating systems and different versions of Matlab and so on. However, all this made me realize that the library has grown so much that I should start using version control. Since I like the way git-works, I will probably start using that for version control and most probably will "host" the code in Github or equivalent.

Therefore, please let me know if you have experienced similar problems? 

Jarno Ralli
Author: Jarno Ralli
Jarno Ralli is a computer vision scientist and a programmer.

Let's get social!

FacebookTwitterGoogle BookmarksLinkedIn

Frequent Words