欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    Matlab图像采集与处理精品资料.doc

    • 资源ID:96698118       资源大小:1.59MB        全文页数:54页
    • 资源格式: DOC        下载积分:20金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要20金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Matlab图像采集与处理精品资料.doc

    Image Acquisition and Processing by MatlabCONTENTSI、 Basic Image Acquisition ProcedureII、 图像采集工具箱重要图解III、 Image Types and Converting 图像类型及其转换IV、 Displaying and Exploring Images 图像显示V、 Spatial Transformations 图像的几何运算VI、 Image Registration 图像的对齐VII、 Designing and Implementing 2-D Linear Filters for Image Data 二维滤波器VIII、 Transforms 图像的变换IX、 Morphological Operations 形态学运算X、 Analyzing and Enhancing Images 图像分析和增强XI、 ROI-Based Processing 图像分区域处理XII、 Image Deblurring 图像复原XIII、 Color 色彩空间XIV、 Neighborhood and Block Operations 邻域运算Function Reference一、 Basic Image Acquisition ProcedureStep 1硬件安装Step 2获取信息>> imaqhwinfo InstalledAdaptors: 'coreco' 'winvideo' MATLABVersion: '7.9 (R2009b)' ToolboxName: 'Image Acquisition Toolbox' ToolboxVersion: '3.4 (R2009b)'>> imaqhwinfo('winvideo') AdaptorDllName: C:.toolboximaqimaqadaptorswin32mwwinvideoimaq.dll' AdaptorDllVersion: '3.4 (R2009b)' AdaptorName: 'winvideo' DeviceIDs: 1DeviceInfo: 1x1 struct>> imaqhwinfo('winvideo',1) DefaultFormat: 'RGB24_320x240' DeviceFileSupported: 0 DeviceName: 'USB PC Camera ' DeviceID: 1 ObjectConstructor: 'videoinput('winvideo', 1)'SupportedFormats: 1x6 cell>> dev_info.SupportedFormats'RGB24_160x120' 'RGB24_176x144' 'RGB24_320x240''RGB24_352x288' 'RGB24_640x480' 'RGB24_800x600'>> dev_info.SupportedFormats(6)'RGB24_800x600'Step 3创建video input对象>> vid = videoinput('winvideo',1,'RGB24_800x600')Summary of Video Input Object Using 'USB PC Camera '. Acquisition Source(s): input1 is available. Acquisition Parameters: Trigger Parameters: 1 'immediate' trigger(s) on START. Status: .Step 4(optional)预览视频流>> preview(vid)>> closepreview(vid)Step 5(optional)配置对象属性>> get(vid) General Settings: DeviceID = , DiskLogger = , DiskLoggerFrameCount = 0 EventLog = 1x0 struct, FrameGrabInterval = 1, FramesAcquired = 0 FramesAvailable = 0, FramesPerTrigger = 10, Logging = off LoggingMode = memory, Name = RGB24_800x600-winvideo-1 NumberOfBands = 3, Previewing = off, ROIPosition = 0 0 800 600 Running = off, Tag = , Timeout = 10, Type = videoinput, UserData = VideoFormat = RGB24_800x600, VideoResolution = 800 600 Color Space Settings: BayerSensorAlignment = grbg, ReturnedColorSpace = rgb Callback Function Settings: ErrorFcn = imaqcallback, FramesAcquiredFcn = FramesAcquiredFcnCount = 0, StartFcn = , StopFcn = , TimerFcn = TimerPeriod = 1, TriggerFcn = Trigger Settings: InitialTriggerTime = , TriggerCondition = none, TriggerFrameDelay = 0 TriggerRepeat = 0, TriggersExecuted = 0, TriggerSource = none TriggerType = immediate Acquisition Sources: SelectedSourceName = input1, Source = 1x1 videosource>> get(getselectedsource(vid) General Settings: Parent = 1x1 videoinput, Selected = on, SourceName = input1, Tag = Type = videosource Device Specific Properties: BacklightCompensation = on, Brightness = 20, ColorEnable = on, Contrast = 20 Exposure = 1, FrameRate = 30.0000, Gamma = 4, Hue = 18Saturation = 50, Sharpness = 3>> set(vid,'TriggerRepeat',Inf);>> vid.FrameGrabInterval = 5;>> vid_src = getselectedsource(vid);>> set(vid_src,'Tag','motion detection setup');Step 6获取图像数据>> start(vid) >> data=getdata(vid,6); >> stop(vid)Step 7清理>> delete(vid)>> clear>> close(gcf)二、 图像采集工具箱重要图解1. The Image Acquisition Toolbox Software Components2. Relationship of Video Input Objects and Video Source Objects3. Transitions from Running to Stopped States4. Logging State Transitions5. Overview of Data Logging6. Immediate Trigger7. Manual Trigger8. Hardware Trigger9. Specifying the Amount of Data to Log10. Impact of FrameGrabInterval on Data Logging11. Frames Available After Initial Trigger Execution12. Contents of Memory Buffer Before and After Removing Frames13. Specifying a Delay Before Data Logging Begins14. Executing Multiple Triggers15. Using wait to Block the MATLAB Command Line16. Delete a trigger's worth of image data (The frames acquired before and after the call to flushdata)17. Logging Data to a Disk File18. Overview of Image Acquisition19. getdata Blocks Until Frames Become Available20. Frames Returned by peekdata21. Format of an Individual Frame22. InitialTriggerTime Records First Trigger Execution三、 Image Types and Converting 图像类型及其转换ditherDithering(抖动)是Gif压缩中一项十分有用的技术。由于GIF 和PNG只有256种颜色,因此,在表现一些含有丰富色彩信息的照片图像或含有平缓过度色的图像时,就会出现梯田状的条形色块,这时,我们就需要用到Dithering(抖动)功能,Dithering可以模仿一些在调色板无法找到的颜色,从而使得整个图像颜色与颜色之间的过渡更为自然,不过,Dithering同样会使图像Size变大,因此,我们更多的将这项技术应用于区域压缩。demosaicConvert Bayer pattern encoded image (与相机RAW格式相关) to truecolor (RGB) image.类型转换gray2ind,grayslice,im2bw,ind2gray,ind2rgb,mat2gray,rgb2gray,rgb2indImage class 转换im2uint8, im2uint16, im2int16, im2single, or im2doubleimapprox索引图像转换可能使用,Approximate indexed image using one with fewer colorsImage Arithmetic Saturation Rules· Values that exceed the range of the integer type are saturated to that range如300à255,-45à0· Fractional values are roundedDICOMDICOM(Digitalimaging and Communications in Medicine)即数字影像和通信标准,规范医学影像及其相关信息的交换。由美国发射学会和美国国家电器制造商协会NEMA(National Electronical Manufacturers Association)制定。· 从文件格式上看,用于保存医学数据的DICOM包容的信息量大(除图像信息外,还有很多附加信息,比如患者病例档案等),格式复杂。· DICOM的压缩算法种类很多,也可以保存动画图像· DICOM的图像基本都是与医学相关的(MRI,CT等),医学图像的特点是分辨率低,特征不清晰等等。对这类图像做分割和特征提取难度较大。Mayo Analyze 7.5A file format, developed by the Mayo Clinic, for storing MRI(Magnetic Resonance Imaging核磁共振成像) data,包含两个文件.hdr和.img。Interfile为了使核医学图像和信息能在不同系统上共享,传递以前将各系统的文件转换成统一的Interfile文件格式。转换后的图像和文件,就可以在不同厂商的计算机上进行图像传递。High Dynamic Range ImagesDynamic range refers to the range of brightness levels, using 32-bit floating-point values to store each color channel. hdrread,makehdr,tonemap(HDR->RGB),hdrwrite四、 Displaying and Exploring Images 图像显示1. Displaying Images Using the imshow Function· Image Displayed in a Figure Window by imshow>> imshow('moon.tif');>> I = getimage; % assigns the image data from the figure window currently active· Specifying the Initial Image Magnification>> imshow(I, 'InitialMagnification', 150)· Image Displayed With and Without a Border>> imshow(I,'Border','tight') % 'tight'|'loose'· Displaying Each Image in a Separate Figure>> figure· Displaying Multiple Images in the Same Figure>> subplot(m,n,p)>> subplot(1,2,1), imshow(I1)2. Using imtool to Explore Images· Opening the Image Tool>> imtool('moon.tif');· Specifying the Initial Image Magnification· Specifying the Colormap· Importing Image Data from the Workspace· Exporting Image Data to the Workspace· Saving the Image Data Displayed in the Image Tool· Closing the Image Tool>> imtool close all3. Exploring Very Large Images· Create reduced resolution data set (R-Set) from image file >> rsetfile = rsetwrite(File_Name)>> rsetfile = rsetwrite(File_Name, output_filename)File_Name is a TIFF or NITF image file4. Viewing Image Sequences 查看图像序列· Viewing Image Sequences in the Movie Player>> load mristack % <256x256x21 uint8>>> implay(mristack)· Viewing Image Sequences as a Montage>> I=reshape(mristack,256 256 1 21); % repmat may be used>> montage(I)· Converting a Multiframe Image to a Movie>> I=reshape(mristack,256 256 1 21);>> mov = immovie(I);>> implay(mov)5. Displaying Different Image Types (imshow和imtool可替换)· Displaying Grayscale Images That Have Unconventional Ranges>> imshow(I,'DisplayRange',low high)>> imtool(I,'DisplayRange',);· Changing the Display Colors of a Binary Image>> imshow(BW)>> imshow(BW,1 0 0; 0 0 1)· Adding a Colorbar to a Displayed Image>> colorbar6. Setting Toolbox Preferences· Viewing and Changing Preferences Using the Preferences Dialog Boxselect Preferences > Image Processing in the File menu· Retrieving the Values of Toolbox Preferences Programmatically>> iptgetpref('ImtoolInitialMagnification')· Setting the Values of Toolbox Preferences Programmatically>> iptsetpref('ImshowBorder', 'tight');五、 Spatial Transformations 图像的几何运算1. 基本运算· Resizing>> I1 = imresize(I,1.25);>> X1 = imresize(X,100 150,'bilinear')· Rotating>> I1 = imrotate(I,35,'bilinear');· Cropping >> I1 = imcrop(I);>> I1 = imcrop(I,60 40 100 90);2. Performing General 2-D Spatial Transformations· Overview of General 2-D Spatial Transformation Process· Example: Performing a TranslationStep 1: Import the Image to Be Transformed>> I = checkerboard; % <80x80 double>Step 2: Define the Spatial Transformation>> xform = 1 0 0; 0 1 0; 40 40 1 ;Step 3: Create the TFORM Structure>> tt = maketform('affine',xform);Step 4: Perform the Transformation>> I1 x1 y1= imtransform(I,tt);Step 5: View the Output Image· Affine Transform仿射变换是一种二维坐标到二维坐标之间的线性变换,保持二维图形的“平直性”(straightness,即变换后直线还是直线不会打弯,圆弧还是圆弧)和“平行性”(parallelness,其实是指保二维图形间的相对位置关系不变,平行线还是平行线,相交直线的交角不变。)。仿射变换可以通过一系列的原子变换的复合来实现,包括:平移(Translation)、缩放(Scale)、翻转(Flip)、旋转(Rotation)和错切(Shear)。· Creating TFORM StructuresTransformation Type: 'affine','projective','box','custom','composite'· Performing N-Dimensional Spatial Transformations>> maketform>> makeresampler>> imtransform其它:fliptform,tformfwd,tforminv,findbounds,tformarray六、 Image Registration 图像的对齐1. A graphic illustration of the image registration process2. Example: Performing a registration· Step 1: Read the Images· Step 2: Choose Control Points in the Images by cpselect>> I0=imread('westconcordorthophoto.png'); % base>> I1=imread('westconcordaerial.png'); % input>> cpselect(I1, I0)· Step 3: Save the Control Point Pairs to the MATLAB Workspace点击File->Export Points to Workspace,得到base_points input_points· Step 4: Fine-Tune the Control Point Pair Placement (Optional)>> INPUT_POINTS = cpcorr(input_points,base_points,I1,I0)· Step 5: Specify the Type of Transformation and Infer Its Parameters>> mytform = cp2tform(INPUT_POINTS, base_points, 'projective')· Step 6: Transform the Unregistered Image>> Ir = imtransform(I1, mytform);· 查看对齐效果>> imshow(Ir)>> hold on>> h = imshow(I0, gray(256);>> set(h, 'AlphaData', 0.6)3. cp2tform Transformation Types'nonreflective similarity''affine''projective''polynomial''piecewise linear''lwm' (local weighted mean)七、 Designing and Implementing 2-D Linear Filters for Image Data 二维滤波器Designing and Implementing Linear Filters in the Spatial Domain1. Convolution 卷积· Step 1: Rotate the convolution kernel 180 degrees about its center element.· Step 2: Slide the center element of the convolution kernel so that it lies on top of the (2,4) element of A.· Step 3: Multiply each weight in the rotated convolution kernel by the pixel of A underneath.· Step 4: Sum the individual products2. Correlation 相关· 不旋转kernel,其余与卷积相同3. Performing Linear Filtering of Images Using imfilter>> I1 = imfilter (I0, h)· default method:相关· Boundary Padding:default(the value x=0,即zero padding), x,'replicate','symmetric','circular'· Relationship to Other Filtering Functionsfilter2二维相关,cov2二维卷积,covn-n维卷积,这些函数与imfilter在于它们的输出数据类型一定是double,并使用zero padding4. Filtering an Image with Predefined Filter Types by fspecial 'average' averaging filter 'disk' circular averaging filter 'gaussian' Gaussian lowpass filter 'laplacian' filter approximating the 2-D Laplacian operator 'log' Laplacian of Gaussian filter 'motion' motion filter 'prewitt' Prewitt horizontal edge-emphasizing filter 'sobel' Sobel horizontal edge-emphasizing filter 'unsharp' unsharp contrast enhancement filterDesigning Linear Filters in the Frequency Domain 5. FIR Filters· FIR (finite impulse response) filters have a finite extent to a single point, or impulse. All the Image Processing Toolbox filter design functions return FIR filters.6. Frequency Transformation Method· ftrans2 transforms a one-dimensional FIR filter into a two-dimensional FIR filter· default method:produces filters with nearly circular symmetry7. Frequency Sampling Method· fsamp2 returns a filter h with a frequency response that passes through the points in the input matrix Hd>> Hd = zeros(11,11); Hd(4:8,4:8) = 1; % 构造阶跃平台>> h = fsamp2(Hd); % Hd->h转换>> freqz2(h) % 显示滤波器频谱· 缺点:Ripples波纹8. Windowing Method· fwind1 designs a 2D filter by using a 2D window that it creates from one or two 1D windows that you specify. · fwind2 designs a 2D filter by using a specified 2D window directly.9. Creating the Desired Frequency Response Matrix· freqspace returns correct, evenly spaced, frequency values for any size response. >> f1,f2 = freqspace(25,'meshgrid');>> Hd = zeros(25,25); d = sqrt(f1.2 + f2.2) < 0.5;>> Hd(d) = 1;>> mesh(f1,f2,Hd)· For this frequency response, the filters produced by fsamp2, fwind1, and fwind2 are real. This result is desirable for most image processing applications.八、 Transforms 图像的变换1. Discrete Fourier Transform· 卷积的计算 ifft2(fft2(A).*fft2(B)卷积定理:两个二维连续函数在空间域中的卷积可求其相应的二个傅立叶变换乘积的反变换而得,即 f(x,y) 卷积 h(x,y) <=> F(u,v) H(u,v) 卷积满足交换律,是线性运算,还满足分配律、结合律· 相关的计算real(ifft2(fft2(bw).*fft2(rot90(a,2),256,256)与卷积的区别,Kernel图像要先旋转180度2. Discrete Cosine Transform· DCT相当于长度是它两倍的离散傅里叶变换,这个离散傅里叶变换是对一个实偶函数进行的(因为一个实偶函数的傅里叶变换仍然是一个实偶函数)· DCT经常被信号处理和图像处理使用,用于对信号和图像(JPEG和MPEG等)进行有损数据压缩。当信号具有接近Markov processes的统计特性时,DCT的去相关性接近于具有最优的去相关性的Karhunen-Loève(K-L)变换的性能。 · The DCT Transform Matrix 本方法适用于small square imputs,如8x8,16x16dctmtx makes discrete cosine transform matrixT*I*T 等价于 dct2(I) % T=dctmtx(size(I,1),I是正方形图像3. Radon Transform >> R,xp = radon(I,theta);>> IR = iradon(R,theta);4. 点光源投影变换 fanbeam和ifanbeam九、 Morphological Operations 形态学运算1. Dilation and Erosion 膨胀和腐蚀CommandOperation RulePadding Rule膨胀imdilateThe value of the output pixel is the maximum value of all the pixels in the input pixel's neighborhood. Pixels beyond the image border are assigned the minimum value afforded by the data type. Generally, these pixels are set to 0. 腐蚀imerodeThe value of the output pixel is the minimum value of all the pixels in the input pixel's neighborhood. Pixels beyond the image border are assigned the maximum value afforded by the data type. BW: set to 1. uint8 grayscale images: set to 255.· Structuring Elements: a matrix consisting of only 0's and 1's that can have any arbitrary shape and size. The pixels with values of 1 define the neighborhood.SE = strel('arbitrary', NHOOD)SE = strel('arbitrary', NHOOD, HEIGHT)SE = strel('ball', R, H, N)SE = strel('diamond', R)SE =

    注意事项

    本文(Matlab图像采集与处理精品资料.doc)为本站会员(封****n)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开