Beta Matlab image processing code