Watch this Author's files
No, it is not an alternativ since edge can handle grayscale images, too. However, I like the good documentation, the comments in the code and the H1 line.
refer to the function conv2 to be much more efficient in calculating an averaging filter.
A useless function. It is slow since it uses a loop that could easily be vectorized. There is no help, the function reads an image that must reside on your working directory to be read...
Please remove. This may be a nice programming exercise but it doesn't help anyone here.
This is quite cumbersome:
You could just write
img = 255-img;