matlab与数字图像处理.ppt

上传人:牧羊曲112 文档编号:5438912 上传时间:2023-07-07 格式:PPT 页数:48 大小:814.50KB
返回 下载 相关 举报
matlab与数字图像处理.ppt_第1页
第1页 / 共48页
matlab与数字图像处理.ppt_第2页
第2页 / 共48页
matlab与数字图像处理.ppt_第3页
第3页 / 共48页
matlab与数字图像处理.ppt_第4页
第4页 / 共48页
matlab与数字图像处理.ppt_第5页
第5页 / 共48页
点击查看更多>>
资源描述

《matlab与数字图像处理.ppt》由会员分享,可在线阅读,更多相关《matlab与数字图像处理.ppt(48页珍藏版)》请在三一办公上搜索。

1、Matlab with DIP 教学,The MATLAB Image Processing Toolbox,The Image Processing Toolbox is a collection of MATLAB functions(called M-functions or M-files)that extend the capability of the MATLAB environment for the solution of digital image processing problems.,The MATLAB Image Processing Toolbox(cont.)

2、,Including:-Spatial image transformations-Morphological operations-Neighborhood and block operations-Linear filtering and filter design-Transforms-Image analysis and enhancement-Image registration-Deblurring-Region of interest operations,How do I know M-function?,Find it in Matlab Help.-by category.

3、-by alphabetical order.Find it on the textbook.,Matlab 内建图像,C:MATLAB7toolboximagesimdemos皆为Matlab Help中范例的原始图像。使用时只需直接在指令中输入文件名,即可使用。适用于观察影像处理结果,Different Image Types,Indexed imagesIntensity(grayscale)images Binary images RGB(true-color)images,Reading an image,imread()功用:将图像加载并存成array格式备用用法:I,map=im

4、read(filename);I=imread(filename);ex:I=imread(pout.tif);I为指向影像的变量 不指定变数,则为ans,Displaying an image,imshow()功用:开启一个窗口显示影像 用法:imshow(I)imshow(I,map)Figure,imshow()功用:开启一个新窗口显示影像 用法:figure,imshow(I),Displaying an image(cont.),imshow(I,low,high)imshow(I,)功用:displays I as a grayscale intensity image,speci

5、fying the data range for I.The minimum value in I is displayed as black,and the maximum value is displayed as white.,Displaying an image(cont.),Spatial domain,Displaying an image(cont.),pixval:功能:cursor on image to show pixel values 用法:imshow(I),pixval,Displaying an image(cont.),colorbar功能:To displa

6、y an image with a colorbar that indicates the range of intensity values.用法:imshow(I),colorbarex:I=imread(pout.tif);imshow(I),colorbar,Writing an image,imwrite()功能:将影像写入成档案用法:imwrite(I,filename,format)ex:imwrite(I,pout.jpg,JPEG);,Image information,Image size:size()ex:I=imread(saturn.png);size(I)M,N=s

7、ize(I)M=影像I的高 N=影像I的宽,Image information,whos功用:display information about an image.ex:whos IImfinfo(filename)功用:display information about image file.ex:info=imfinfo(saturn.png),Digital Image processing,图像二值化g=im2bw(I,T);功用:Convert intensity image I to binary image g using threshold T,where T must be

8、in range 0,1.ex:I=imread(pout.tif);g=im2bw(I,0.4);imshow(g),colorbar,Digital Image processing(cont.),彩色转灰阶Rgb2gray()功用:将RBG彩色影像转换成gray-level影像。ex:I=imread(saturn.png);g=rgb2gray(I);imshow(g),colorbar,Digital Image processing(cont.),反相imcomplement()功用:The negative of an image.ex:J=imcomplement(g);ims

9、how(J),Digital Image processing(cont.),变更影像大小 imresize(I,scale,method);功用:To change the size of an image.interpolation Method:-nearest:Nearest-neighbor interpolation-bilinear:Bilinear(the default)-bicubic:Bicubic interpolation,Digital Image processing(cont.),ex:I=imread(circuit.tif);J=imresize(I,1.2

10、5);imshow(I)figure,imshow(J)ex:I=imread(circuit.tif);J=imresize(I,100 150,bilinear);imshow(I)figure,imshow(J),Digital Image processing(cont.),旋转影像imrotate(I,angle);功用:To rotate an image.ex:I=imread(pout.tif);J=imrotate(I,35);imshow(J),More Example,Using affine transformation 1.Rotation 45 degree I=i

11、mread(cameraman.tif);T=maketform(affine,cosd(45)-sind(45)0;sind(45)cosd(45)0;0 0 1);tformfwd(10 20,T);I2=imtransform(I,T);imshow(I2),More Example(cont.),2.TranslationI=imread(cameraman.tif);se=translate(strel(1),25 25);J=imdilate(I,se);imshow(I),title(Original)figure,imshow(J),title(Translated);,Mor

12、e Example(cont.),3.shearI=imread(cameraman.tif);T=maketform(affine,1 0 0;1 2 0;0 0 1);tformfwd(10 20,T);I2=imtransform(I,T);imshow(I2),More Example(cont.),Edge detectors1.Sobel edge detectorCode:/Both horizontal and verticalI=imread(cameraman.tif);BW2=edge(I,sobel,0.02,both);figure,imshow(BW2),More

13、Example(cont.),2.the Canny method low threshold:0.04,high threshold:0.10,sigma is 1 Code:I=imread(cameraman.tif);BW4=edge(I,canny,0.04 0.10,1);figure,imshow(BW4),More Example(cont.),Canny 以 C语言来实作会困难很多!,More Example(cont.),Filter(mean filter)Code:I=imread(coins.png);h=ones(5,5)/25;I2=imfilter(I,h);i

14、mshow(I),title(Original Image);figure,imshow(I2),title(Filtered Image),More Example(cont.),Filter(unsharp masking filter)Code:I=imread(cameraman.tif);h=fspecial(unsharp);I2=imfilter(I,h);imshow(I),title(Original Image)figure,imshow(I2),title(Filtered Image),M-function 不够用怎么办?,自己写。在网络上寻找高手的package。当找

15、到新的M-files时,需帮它设定路径,才可以像一般内建function直接使用。,Set path,Set path(cont.),MATLAB Compiler,MATLAB Compiler 能让您将MATLAB 程序转换为可单独执行的应用程序和软件组件,并分享给其它使用者。MATLAB Compiler 可免除您经由手动编写方式将 MATLAB 程序代码转译为 C 或 C+的程序。要再安装MATLAB Component Run-time(MCR)组件等。,MATLAB Compiler(cont.),C to Matlab设定了合适的编译器,matlab 会自动帮我们编译这个程序。E

16、xample:hello world指令:-编译:mex filename ex:mex hello.c-执行:filename ex:hello,MATLAB Compiler(cont.),hello.c#include#include mex.h void mexFunction(int nlhs,mxArray*plhs,int nrhs,const mxArray*prhs)printf(Hello,world.);mex.h 定义了所有 Matlab 和 C 沟通所用到的 subroutine。mexFunction 是程序的进入点,等价于 ANSI C 的 main。,參考書籍,

17、Digital Image Processing Using MATLAB by Rafael C.Gonzalez,Richard E.Woods Steven L.Eddins,3个Projects,电能表读数识别人脸检测印刷线路板缺陷检测,电能表读数识别,对字轮进行精确定位与识别;对条码进行精确定位与识别,Matlab Package,模式识别包:PRTools:OCR Matlab例子:,人脸检测,OpenCV库:C+face detection library:,印刷线路板缺陷检测,利用机器视觉、图像处理等技术,对印刷线路板上的诸如短路、断路、线距过窄过宽等各种缺陷进行自动检测。,类

18、比,数位化,Binary,图像获取,CCD,类比,EIC,类比转数位资料线路A/D,数位化(Gray level),图象处理卡,数位转换二进位资料线路,二进位图象(0 或 1),(Pixels):,铜箔,基材,CurrentScanline,检测缺点方式:,设计规范(DRC)检查,标准母板(REF)比较法,1.Golden Board:以量产板择一当作标准板,记录板上所有 Feature位置,检测时与其它电路板比对 藉以发现短断路之缺点.,优点:Feature 位置与其它电路板几乎相同,故假缺点较少.,缺点:共同性缺点几乎无法测得.,短路,母板(REF)生成方式与优缺点,于DRC检查时:如板上包含许多SMD区域则所有SMD Pad 将报 告为断路.(1)如缺点数 100则使用者可检视缺点后发现真 正断路缺点.(2)如缺点数过多则使用者将因耗时而多放弃检视 所有缺点,此时真正断路缺点将被遗漏.而于生 成母板后该断路将被视为正常.,断路,母板(REF)生成方式与优缺点(续),透过Skeleton演算方式决定所有Feature位置,Open,Junction,Open,母板(REF)逻辑比较方式,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号