1 图像处理方式编写成函数
function image= edge(imageFile)%%image是输出,edge是函数名,imageFile是图像名称
image = imread(imageFile);
if isrgb(image)
image = rgb2gray(image);%%如果是彩色图像,转化成灰度图像
end
...下面写你要处理的过程。写完后保存。
2 把你的图像拷贝到matlab\workm,目录下。
3 在command window里直接调用该函数,假设图像名称为111,格式为jpg
I=edge('111.jpg');即可!
将M文件中的处理方法保存为函数形式,将图片的存储路径或者名字作为参数。
在主函数里直接调用就行!