Matlab code and some test images.