In the line above you have not defined a threshold, probably it takes zero then, thus delivering a black picture. Also, you use a sigma of 0.1 which means virtually no Gauss Blur in the first Canny step. Within Matlab you can get an optimized threhold by:
[~, th] = edge(gray,'canny');
and then apply the optimized threshold th multiplied by some factor f (from my experience f should be between 1-3), you have to try out:
edges=edge(gray,'canny',f*th,'both', sigma);
sigma is sqrt(2) by default (you used 0.1 above). Following remarks:
- Matlab calculated the optimized threshold as a percentile of the distribution of intensity gradients (you can see the construction of edge() if you enter "edit edge", if I remember correctly)
- the above parameter th is a vector consisting of the low and high threshold. Matlab always uses low_threshold = 0.4* high_threshold