100分求翻译一个matlab文件,和C#混合编程要用到,读不懂源码,恼火
文件一 图像边缘检测 ske3.m%imshow(f,[])
F=fft2(f);
S=fftshift(log(1+abs(F)));
S=gscale(S);
%imshow(S)
h=fspecial('sobel');
freqz2(h)
PQ=paddedsize(size(f));
H=freqz2(h,PQ(1),PQ(2));
H1=ifftshift(H);
gs=imfilter(double(f),h);
%imshow(gs,[])
%figure,imshow(abs(gs),[])
F=fft2(f);
S=fftshift(log(1+abs(F)));
S=gscale(S);
%imshow(S)
h=fspecial('sobel');
freqz2(h)
PQ=paddedsize(size(f));
H=freqz2(h,PQ(1),PQ(2));
H1=ifftshift(H);
gs=imfilter(double(f),h,'replicate');
gs=abs(gs);
gs=gscale(gs);
%imshow(gs,[])
gs=adpmedian(gs,9)
%figure,imshow(abs(gs),[])
%figure, imshow(gs)
f=im2double(gs);
h=fspecial('gaussian',25,15);
g=imfilter(f,h,'replicate');
%figure,imshow(g,[])
g=adpmedian(g,9);
s=im2bw(g,1.2*graythresh(g));
%figure,imshow(s,[])
s=bwmorph(s,'skel',Inf);
s1=bwmorph(s,'spur',10);
%imshow(s,[]),figure,
imshow(s1,[])
文件一 求图像长度 ske4.m
length=nnz(s1)
//哪位高手能给注释一下,小弟感激不尽~~