Help explain a portion of a code
显示 更早的评论
Hi, I need help in explaining what the bolded part of the code does. I understand the rest but I'm having a hard time figuring out what the bolded code means. If possible can someone simplify the code to make it easier to understand. Thank you.
file=input('Enter filename: ','s');
im=imread(file);
newim=uint8((zeros(size(im))));
for k=1:3
for i=2:size(im,1)-1
for j=2:size(im,2)-1
pixel=-4*double(im(i,j,k))+double(im(i+1,j,k))+double(im(i-1,j,k))+double(im(i,j+1,k))+double(im(i,j-1,k));
newim(i,j,k)=pixel;
end
end
end
newName=[file(1:find(file=='.')-1),'Outline',file(find(file=='.'):end)];
imwrite(newim,newName);
fprintf('Outline saved to %s\n',newName)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!