matlab数字图像处理源代码
MATLAB图像处理

附2
MATLAB的数字图像处理
●所谓数字图像处理(digital image processing),就是 利用计算机对图像进行去除噪声、增强、恢复、分割、
提取特征等的理论、方法和技术。
1 数字图像的基本概念
● 图像分辨率 清晰度 绝对清晰度 视觉效果
● Resolution (分辨率)单位
dpi (display pixels / inch)
汉王指纹考勤机
指纹识别系统
纹形(箕形、斗形、弓形) 模式区 全局特征(描述了 指纹的总体结构) 核心点 三角点
指纹的基本特征
纹数
局部特征(指指纹纹乱上的节点的特征,这 些特征提供了指纹唯一性的确认信息)
指纹识别系统
纹形可以分为箕形、弓形、斗形,如下图所示。其他的 指纹图案都是基于这三种基本图案
箕形纹
●
位图
用matlab数字图像处理四个实验

数字图像处理实验指导书目录实验一MATLAB数字图像处理初步实验二图像的代数运算实验三图像增强-空间滤波实验四图像分割3实验一 MATLAB数字图像处理初步一、实验目的与要求1.熟悉及掌握在MATLAB中能够处理哪些格式图像。
2.熟练掌握在MATLAB中如何读取图像。
3.掌握如何利用MATLAB来获取图像的大小、颜色、高度、宽度等等相关信息。
4.掌握如何在MATLAB中按照指定要求存储一幅图像的方法。
5.图像间如何转化。
二、实验原理及知识点1、数字图像的表示和类别一幅图像可以被定义为一个二维函数f(x,y),其中x和y是空间(平面)坐标,f 在任何坐标处(x,y)处的振幅称为图像在该点的亮度。
灰度是用来表示黑白图像亮度的一个术语,而彩色图像是由单个二维图像组合形成的。
例如,在RGB彩色系统中,一幅彩色图像是由三幅独立的分量图像(红、绿、蓝)组成的。
因此,许多为黑白图像处理开发的技术适用于彩色图像处理,方法是分别处理三副独立的分量图像即可。
图像关于x和y坐标以及振幅连续。
要将这样的一幅图像转化为数字形式,就要求数字化坐标和振幅。
将坐标值数字化成为取样;将振幅数字化成为量化。
采样和量化的过程如图1所示。
因此,当f的x、y分量和振幅都是有限且离散的量时,称该图像为数字图像。
作为MATLAB基本数据类型的数值数组本身十分适于表达图像,矩阵的元素和图像的像素之间有着十分自然的对应关系。
图1 图像的采样和量化根据图像数据矩阵解释方法的不同,MA TLAB把其处理为4类:➢亮度图像(Intensity images)➢二值图像(Binary images)➢索引图像(Indexed images)➢RGB图像(RGB images)(1) 亮度图像一幅亮度图像是一个数据矩阵,其归一化的取值表示亮度。
若亮度图像的像素都是uint8类或uint16类,则它们的整数值范围分别是[0,255]和[0,65536]。
若图像是double类,则像素取值就是浮点数。
基于MATLAB的数字图像处理的设计与实现

基于MATLAB的数字图像处理的设计与实现摘要数字图像处理是一门新兴技术,随着计算机硬件的发展,数字图像的实时处理已经成可能,由于数字图像处理的各种算法的出现,使得其处理速度越来越快,能更好的为人们服务。
数字图像处理是一种通过计算机采用一定的算法对图形图像进行处理的技术。
目的:改善医学图像质量,使图像得到增强。
方法:利用Matlab工具箱函数,采用灰度直方图均衡化和高通滤波的方法对一幅X线图像进行增强处理。
结果:用直方图均衡化的算法,将原始图像密集的灰度分布变得比较稀疏,处理后的图像视觉效果得以改善。
高通滤波对于局部细节增强显著,高通滤波后使不易观察到的细节变得清晰。
结论:使用Matlab工具箱大大简化了编程工作,为医学图像处理提供了一种技术平台。
经过直方图均衡化和高通滤波处理后的医学图像,视觉效果得到改善。
关键词:MATLAB;直方图均衡化;高通滤波;图像增强AbstractDigital image processing is an emerging technology, with the development of computer hardware, real—time digital image processing has become possible due to digital image processing algorithms to appear,making it faster and faster processing speed,better for people services .Digital image processing is used by some algorithms computer graphics image pro cessing technology. Objective:To improve the quality of medical image by enhancing the details。
matlab数字图像处理函数大全

Import, Export, and ConversionDisplay and ExplorationGeometric Transformation, Spatial ReferencingImage EnhancementImage AnalysisRead image from graphics fileWrite image to graphics fileInformation about graphics fileRead metadata from National Imagery Transmission Format (NITF) file Read image from NITF fileRead metadata from DPX fileRead DPX imageRead metadata from header file of Analyze 7.5 data setRead image data from image file of Analyze 7.5 data setRead metadata from Interfile fileRead images in Interfile formatAnonymize DICOM fileGet or set active DICOM data dictionaryDisplay DICOM file structureRead metadata from DICOM messageFind attribute in DICOM data dictionaryRead DICOM imageGenerate DICOM unique identifierWrite images as DICOM filesRead high dynamic range (HDR) imageWrite Radiance high dynamic range (HDR) image fileCreate high dynamic range imageRender high dynamic range image for viewingInterface for image I/OCheck if file is R-SetOpen R-Set fileCreate reduced resolution data set from image fileConvert grayscale or binary image to indexed imageConvert indexed image to grayscale imageConvert matrix to grayscale imageConvert RGB image or colormap to grayscaleConvert indexed image to RGB imageConvert label matrix into RGB imageConvert Bayer pattern encoded image to truecolor imageBinarize image by thresholdingQuantize image using specified quantization levels and output values Multilevel image thresholds using Otsu's methodAdaptive image threshold using local first-order statisticsGlobal histogram threshold using Otsu's methodConvert image to binary image, based on thresholdGlobal image threshold using Otsu's methodConvert grayscale image to indexed image using multilevel thresholdingConvert image to double precisionConvert image to 16-bit signed integersConvert image to Java buffered imageConvert image to single precisionConvert image to 16-bit unsigned integersConvert image to 8-bit unsigned integersCreate checkerboard imageCreate head phantom imageAdd noise to imageDisplay imageDisplay multiple image frames as rectangular montage Display multiple images in single figureMake movie from multiframe imagePlay movies, videos, or image sequencesDisplay image as texture-mapped surfaceGet values of Image Processing Toolbox preferencesDisplay Image Processing Toolbox Preferences dialog boxSet Image Processing Toolbox preferences or display valid values Image Viewer appImage Information toolAdjust Contrast toolDisplay Range toolDistance toolPixel Information toolPixel Information tool without text labelPixel Region toolMagnification box for scroll panelOverview tool for image displayed in scroll panelGet values of Image Processing Toolbox preferencesDisplay Image Processing Toolbox Preferences dialog boxSet Image Processing Toolbox preferences or display valid values Image Information toolChoose Colormap toolAdjust Contrast toolCrop imageDisplay Range toolDistance toolPixel Information toolPixel Information tool without text labelPixel Region toolPixel Region tool panelMagnification box for scroll panelOverview tool for image displayed in scroll panelOverview tool panel for image displayed in scroll panelSave Image ToolScroll panel for interactive image navigationCreate draggable ellipseCreate draggable freehand regionCreate draggable, resizable lineCreate draggable pointCreate draggable, resizable polygonCreate draggable rectangleRegion-of-interest (ROI) base classSelect polyline with mouseSpecify points with mouseSpecify rectangle with mouseImage data from axesImage model object from image objectImage Model objectConvert axes coordinates to pixel coordinatesInformation about image attributesGet handle to current axes containing imageGet handle to current figure containing imageOpen Image dialog boxGet all image handlesAdd function handle to callback listCheck validity of handleGet Application Programmer Interface (API) for handleRetrieve pointer behavior from HG objectDirectories containing IPT and MATLAB iconsCreate pointer manager in figureDelete function handle from callback listStore pointer behavior structure in Handle Graphics object Align figure windowsCreate rectangularly bounded drag constraint functionAdjust display size of imagencing, and Image RegistrationCrop imageResize imageRotate imageTranslate imageImage pyramid reduction and expansionApply geometric transformation to imageFit geometric transformation to control point pairsApply 2-D spatial transformation to imageFind output bounds for spatial transformationFlip input and output roles of TFORM structureCreate resampling structureCreate spatial transformation structure (TFORM)Apply spatial transformation to N-D arrayApply forward spatial transformationApply inverse spatial transformationCreate checkerboard image2-D Affine Geometric Transformation3-D Affine Geometric Transformation2-D Projective Geometric Transformation2-D piecewise linear geometric transformation2-D Polynomial Geometric Transformation2-D Local Weighted Mean Geometric TransformationApply geometric transformation to imageIntensity-based image registrationEstimate geometric transformation that aligns two 2-D or 3-D images Display imageCompare differences between imagesComposite of two imagesReference 2-D image to world coordinatesReference 3-D image to world coordinatesIntensity-based image registrationConfigurations for intensity-based registrationEstimate geometric transformation that aligns two 2-D or 3-D images Estimates geometric transformation that aligns two 2-D images using phase Estimate displacement field that aligns two 2-D or 3-D images Composite of two imagesCompare differences between imagesMattes mutual information metric configuration objectMean square error metric configuration objectRegular step gradient descent optimizer configuration objectOne-plus-one evolutionary optimizer configuration objectControl Point Selection ToolFit geometric transformation to control point pairsTune control-point locations using cross correlationConvert CPSTRUCT to valid pairs of control pointsNormalized 2-D cross-correlationInfer spatial transformation from control point pairsAdjust image intensity values or colormapAdjust Contrast toolSharpen image using unsharp maskingEnhance contrast using histogram equalizationContrast-limited adaptive histogram equalization (CLAHE)Adjust histogram of image to match N-bin histogram of reference image Apply decorrelation stretch to multichannel imageFind limits to contrast stretch imageConvert integer values using lookup tableAdd noise to imageN-D filtering of multidimensional images2-D Gaussian filtering of images3-D Gaussian filtering of 3-D imagesCreate predefined 2-D filterGuided filtering of imagesNormalized 2-D cross-correlation2-D adaptive noise-removal filtering2-D median filtering2-D order-statistic filteringLocal standard deviation of imageLocal range of imageLocal entropy of grayscale imageGeneral sliding-neighborhood operationsCreate Gabor filter or Gabor filter bankApply Gabor filter or set of filters to 2-D image2-D box filtering of images3-D box filtering of 3-D imagesCalculate integral imageCalculate 3-D integral image2-D box filtering of integral images3-D box filtering of 3-D integral imagesExtract objects from binary image by sizeExtract objects from binary image using properties Pad array2-D frequency response2-D FIR filter using frequency sampling2-D FIR filter using frequency transformation2-D FIR filter using 1-D window method2-D FIR filter using 2-D window method2-D convolution matrixBinary hit-miss operationMorphological operations on binary images Ultimate erosionRemove small objects from binary imageBottom-hat filteringSuppress light structures connected to image border Morphologically close imageDilate imageErode imageExtended-maxima transformExtended-minima transformFill image regions and holesH-maxima transformH-minima transformImpose minimaMorphologically open imageMorphological reconstructionRegional maximaRegional minimaTop-hat filteringWatershed transformCreate connectivity arrayCheck validity of connectivity argumentNeighborhood operations on binary images using lookup tables Nonlinear filtering using lookup tablesCreate lookup table for use with bwlookupMorphological structuring elementMorphological offset structuring elementDeblur image using blind deconvolutionDeblur image using Lucy-Richardson methodDeblur image using regularized filterDeblur image using Wiener filterTaper discontinuities along image edgesConvert optical transfer function to point-spread function Convert point-spread function to optical transfer functionPad arraySpecify polygonal region of interest (ROI)Convert region of interest (ROI) polygon to region maskFill in specified regions in image using inward interpolation Select region of interest (ROI) based on colorFilter region of interest (ROI) in imageCreate draggable ellipseCreate draggable freehand regionCreate draggable, resizable polygonCreate draggable rectangleRegion-of-interest (ROI) base classInterface for image I/ODistinct block processing for imageDetermine optimal block size for block processingGeneral sliding-neighborhood operationsRearrange matrix columns into blocksColumnwise neighborhood operationsRearrange image blocks into columnsAbsolute difference of two imagesAdd two images or add constant to imageLinear combination of color channelsComplement imageDivide one image into another or divide image by constant Linear combination of imagesMultiply two images or multiply image by constantSubtract one image from another or subtract constant from image Trace region boundaries in binary imageTrace object in binary imagePlot region boundariesFind edges in intensity imageFind circles using circular Hough transformCreate circleGradient magnitude and direction of an imageDirectional gradients of an imageFind 3-D gradient magnitude and direction of imagesFind the directional gradients of a 3-D imageHough transformExtract line segments based on Hough transformIdentify peaks in Hough transformQuadtree decompositionBlock values in quadtree decompositionSet block values in quadtree decompositionMeasure properties of image regionsArea of objects in binary imageExtract objects from binary image by sizeFind connected components in binary imageGenerate convex hull image from binary imageDistance transform of binary imageGeodesic distance transform of binary imageEuler number of binary imageFind perimeter of objects in binary imageExtract objects from binary image using propertiesSelect objects in binary imageGray-weighted distance transform of grayscale imageCreate contour plot of image dataHistogram of image dataPixel color valuesPixel-value cross-sections along line segments2-D correlation coefficientAverage or mean of matrix elementsStandard deviation of matrix elementsLabel connected components in 2-D binary imageLabel connected components in binary imageCreate label matrix from bwconncomp structurePack binary imageUnpack binary imageEntropy of grayscale imageLocal entropy of grayscale imageLocal range of imageLocal standard deviation of imageCreate gray-level co-occurrence matrix from imageProperties of gray-level co-occurrence matrixMean-squared errorPeak Signal-to-Noise Ratio (PSNR)Structural Similarity Index (SSIM) for measuring image qualitySegment image into foreground and background using active contour Binary image segmentation using Fast Marching MethodSegment image into two or three regions using geodesic distance-based colorCalculate weights for image pixels based on image gradient Calculate weights for image pixels based on grayscale intensity difference Select contiguous image region with similar gray valuesGlobal image threshold using Otsu's methodMultilevel image thresholds using Otsu's methodGlobal histogram threshold using Otsu's methodAdaptive image threshold using local first-order statisticsFind region boundaries of segmentation2-D superpixel oversegmentation of imagesBurn binary mask into 2-D imageConvert label matrix to cell array of linear indicesDistance transform of binary imageGeodesic distance transform of binary imageGray-weighted distance transform of grayscale imageHough transform2-D discrete cosine transformDiscrete cosine transform matrixConvert fan-beam projections to parallel-beamFan-beam transform2-D inverse discrete cosine transformInverse fan-beam transformInverse Radon transformConvert parallel-beam projections to fan-beamRadon transform2-D fast Fourier transformShift zero-frequency component to center of spectrum2-D inverse fast Fourier transformInverse FFT shiftConvert RGB to CIE 1976 L*a*b*Convert RGB color values to NTSC color spaceConvert RGB to CIE 1931 XYZConvert RGB color values to YCbCr color spaceConvert CIE 1976 L*a*b* to RGBConvert CIE 1976 L*a*b* to CIE 1931 XYZConvert CIE 1931 XYZ to CIE 1976 L*a*b*Convert CIE 1931 XYZ to RGBConvert YCbCr color values to RGB color spaceConvert NTSC values to RGB color spaceConvert L*a*b* data to doubleConvert L*a*b* data to uint16Convert L*a*b* data to uint8Convert XYZ color values to doubleConvert XYZ color values to uint16Search for ICC profilesRead ICC profileFind system default ICC profile repositoryWrite ICC color profile to disk fileTrue for valid ICC color profileCreate color transformation structureApply device-independent color space transformation Approximate indexed image by reducing number of colors XYZ color values of standard illuminantsAdaptive image threshold using local first-order statistics Find region boundaries of segmentationRemove small objects from binary imageTrace region boundaries in binary imageFind connected components in binary imageDistance transform of binary imageEuler number of binary imageLabel connected components in 2-D binary image Nonlinear filtering using lookup tables Morphological operations on binary imagesPack binary imageFind perimeter of objects in binary imageSelect objects in binary imageTrace object in binary imageUnpack binary imageCreate connectivity arrayConvert Bayer pattern encoded image to truecolor image Find edges in intensity imageFit geometric transformation to control point pairs Create predefined 2-D filterDefault display range of image based on its classSelect contiguous image region with similar gray values Enhance contrast using histogram equalizationHough transformExtract line segments based on Hough transform Identify peaks in Hough transformConvert HSV colormap to RGB colormapConvert image to double precisionConvert image to 16-bit signed integersConvert image to single precisionConvert image to 16-bit unsigned integersConvert image to 8-bit unsigned integersAbsolute difference of two imagesAdjust image intensity values or colormapBinarize image by thresholdingBottom-hat filtering2-D box filtering of imagesSuppress light structures connected to image border Morphologically close imageComplement imageCrop imageDilate imageErode imageExtended-maxima transformExtended-minima transformFill image regions and holesN-D filtering of multidimensional imagesFind circles using circular Hough transformApply Gabor filter or set of filters to 2-D image2-D Gaussian filtering of imagesFind 3-D gradient magnitude and direction of imagesFind the directional gradients of a 3-D imageHistogram of image dataH-maxima transformH-minima transformLinear combination of imagesMean-squared errorMorphologically open imageBurn binary mask into 2-D imageImage pyramid reduction and expansionQuantize image using specified quantization levels and output values Read image from graphics fileMorphological reconstructionRegional maximaRegional minimaResize imageRotate imageTop-hat filteringTranslate imageApply geometric transformation to image2-D box filtering of integral imagesCalculate integral imageConvert integer values using lookup tableCheck validity of colormapCheck validity of connectivity argumentConvert CIE 1976 L*a*b* to RGBConvert label matrix into RGB imageConvert label matrix to cell array of linear indicesAverage or mean of matrix elements2-D median filteringMultilevel image thresholds using Otsu's method2-D order-statistic filteringGlobal histogram threshold using Otsu's methodPad arrayPeak Signal-to-Noise Ratio (PSNR)Measure properties of image regionsConvert RGB image or colormap to grayscaleConvert RGB colormap to HSV colormapConvert RGB to CIE 1976 L*a*b*Convert RGB color values to YCbCr color spaceFind limits to contrast stretch image2-D superpixel oversegmentation of imagesWatershed transformConvert YCbCr color values to RGB color spaceReference 2-D image to world coordinatesReference 3-D image to world coordinates2-D Affine Geometric Transformation2-D Projective Geometric TransformationMorphological structuring elementMorphological offset structuring elementDistance transform of binary imageLabel connected components in 2-D binary image Nonlinear filtering using lookup tablesMorphological operations on binary images2-D correlation coefficientFind edges in intensity imageEnhance contrast using histogram equalizationConvert image to double precisionConvert image to single precisionConvert image to 8-bit unsigned integersConvert image to 16-bit unsigned integersAbsolute difference of two imagesAdjust image intensity values or colormapBottom-hat filteringMorphologically close imageComplement imageDilate imageErode imageFill image regions and holesN-D filtering of multidimensional imagesGradient magnitude and direction of an image Directional gradients of an imageHistogram of image dataLinear combination of imagesAdd noise to imageConvert YCbCr color values to RGB color space Morphologically open imageMorphological reconstructionEstimate displacement field that aligns two 2-D or 3-D images Resize imageRotate imageDisplay imageTop-hat filteringInverse Radon transformConvert matrix to grayscale imageAverage or mean of matrix elements2-D median filteringNormalized 2-D cross-correlationPad arrayRadon transformMeasure properties of image regionsConvert RGB image or colormap to grayscaleConvert RGB color values to YCbCr color spaceStandard deviation of matrix elementsLocal standard deviation of imageFind limits to contrast stretch image从图形文件读取图像写入图像到图形文件关于图形文件的信息从国家图像传输格式的元数据(NITF)文件从NITF文件读取图像读取DPX文件元数据读取DPX图像从分析7.5数据集的头文件读取元数据从分析7.5数据集的图像文件中读取图像数据从归档文件元数据在内部文件格式读取图像匿名DICOM文件获取或设置活动DICOM数据字典显示DICOM文件结构读取DICOM消息元数据发现在DICOM数据字典属性读取DICOM图像生成DICOM的唯一标识符写图像的DICOM文件读高动态范围(HDR)图像写下光辉的高动态范围(HDR)图像文件创建高动态范围图像用于观看的高动态范围图像图像I / O接口检查文件是否存在与r-组开放与r-组文件从图像文件创建减少的分辨率数据集将灰度或二值图像转换为索引图像将索引图像转换为灰度图像转换矩阵到灰度图像将RGB图像的灰度或颜色表索引图像的RGB图像转换转换成RGB图像标签矩阵Bayer编码图像转换为彩色图像二值化图像的阈值分割量化图像使用指定的量化电平和输出值采用多级图像阈值Otsu方法采用局部一阶统计的自适应图像阈值使用全局直方图阈值Otsu方法基于阈值的图像转换成二值图像使用全局阈值Otsu方法采用多层阈值化方法将灰度图像转换为索引图像将图像转换为双精度将图像转换为16位有符号整数将图像转换成java缓冲图像将图像转换为单精度将图像转换为16位无符号整数将图像转换为8位无符号整数创建棋盘格图像创建头部影像添加噪声到图像显示图像显示多个图像帧矩形蒙太奇在单个图形中显示多个图像从多帧图像的电影播放电影、视频或图像序列显示图像作为纹理映射的表面获取图像处理工具箱的首选项显示图像处理工具箱首选项对话框设置图像处理工具箱的首选项或显示有效值图像查看器应用程序图像信息的工具对比度调整工具显示范围的工具距离工具像素信息的工具无文本标签的像素信息工具像素区域的工具用于滚动面板的放大盒在滚动面板中显示的图像的概述工具获取图像处理工具箱的首选项显示图像处理工具箱首选项对话框设置图像处理工具箱的首选项或显示有效值图像信息的工具选择映射工具对比度调整工具作物图像显示范围的工具距离工具像素信息的工具无文本标签的像素信息工具像素区域的工具像素区域工具面板用于滚动面板的放大盒在滚动面板中显示的图像的概述工具滚动面板中显示的图像的工具面板保存图像的工具用于交互式图像导航的滚动面板创建可拖动椭圆创建可拖动自由区域创建可拖动,可调整大小的线创建可拖动点创建可拖动,可调整大小的多边形创建可拖动矩形感兴趣区域(感兴趣区域)基类用鼠标选择多段线用鼠标指定点用鼠标指定矩形从轴的图像数据图像对象的图像模型对象图像模型对象将坐标轴转换为像素坐标关于图像属性的信息获取当前包含图像的轴的句柄获取当前图像包含图像的句柄打开图像对话框获取所有图像处理添加函数句柄到回调列表检查处理的有效性获取处理的应用程序程序员接口(接口)从汞对象检索指针行为目录包含了IPT和Matlab的图标创建图形中的指针管理器从回调列表中删除函数句柄句柄图形对象中的存储指针行为结构排列图的窗口创建矩形拖动约束函数有界调整图像的显示大小作物图像调整图像大小旋转图像转换图像图像金字塔的还原与扩展将几何变换应用于图像拟合控制点对的几何变换二维空间变换在图像中的应用查找空间变换的输出范围输入和输出翻转平台结构的作用创建重采样结构创造空间转换结构(平台)将空间变换N-D数组应用前向空间变换应用逆空间变换创建棋盘格图像二维仿射几何变换三维仿射几何变换二维射影几何变换二维分段线性几何变换二维多项式几何变换二维局部加权平均几何变换将几何变换应用于图像基于强度的图像配准估计对齐两个二维或三维图像的几何变换显示图像比较图像之间的差异两幅图像的复合参考二维图像到世界坐标参考三维图像到世界坐标基于强度的图像配准基于强度的注册的配置估计对齐两个二维或三维图像的几何变换使用相位相关的两个二维图像的几何变换估计估计对齐两个二维或三维图像的位移场两幅图像的复合比较图像之间的差异Mattes互信息度量的配置对象均方误差度量配置对象正规步长梯度下降优化配置对象一加一进化优化配置对象控制点选择工具拟合控制点对的几何变换使用交叉相关的调整控制点位置cpstruct转换控制点的有效对标准化二维互相关从控制点对的空间变换调整图像的灰度值或颜色表对比度调整工具利用反锐化掩模图像锐化采用直方图均衡化增强对比度对比度自适应直方图均衡化(CLAHE)调整直方图的图像与参考图像n-bin直方图申请去相关拉伸的多通道图像查找对比度拉伸图像的限制使用查找表转换整数值添加噪声到图像N维的多维图像滤波二维图像的二维高斯滤波三维图像的三维高斯滤波创建预定义的二维滤波器图像引导滤波标准化二维互相关二维自适应噪声滤除二维中值滤波二维阶统计滤波图像局部标准偏差局部图像范围灰度图像局部熵一般滑动邻域运算Gabor滤波器和Gabor滤波器组的创建应用Gabor滤波器或滤波器组二维图像二维图像的二维图像滤波三维图像的三维盒滤波计算积分图像计算三维积分图像积分图像的二维箱滤波三维整体图像的三维箱滤波通过大小从二值图像中提取对象使用属性从二值图像中提取对象焊盘阵列二维频率响应采用频率采样的二维滤波器采用频率变换的二维滤波器二维FIR滤波器采用一维窗口的方法采用二维窗法的二维二维滤波器二维卷积矩阵二进制命中错误操作二值图像的形态学运算终极侵蚀从二值图像中删除小对象帽子底部过滤抑制连接到图像边缘的光结构形态接近的图像放大图像腐蚀图像扩展极大值变换扩展最小变换填充图像区域和孔h-maxima变换利用H-minima变换强制最小形态上打开的图像形态重构区域极值局部极小顶帽滤波分水岭变换创建连接的阵列检查连通性参数的有效性使用查找表的二值图像的邻域运算使用查找表的非线性滤波创建bwlookup使用查找表形态学结构元素形态学偏移结构元素利用盲反卷积去模糊图像用露西理查德森的方法去模糊图像利用正则化滤波复原图像使用维纳滤波复原图像沿图像边缘的锥度不连续性将光学传递函数转换为点扩散函数转换点扩展函数到光传输函数焊盘阵列指定感兴趣区域(投资回报率)将感兴趣区域(感兴趣区域)的多边形转换为区域掩模用内插法填充图像中的指定区域基于颜色的选择感兴趣区域(感兴趣区域)图像中的感兴趣区域(感兴趣区域)创建可拖动椭圆创建可拖动自由区域创建可拖动,可调整大小的多边形创建可拖动矩形感兴趣区域(感兴趣区域)基类图像I / O接口图像的不同块处理确定块处理的最佳块大小一般滑动邻域运算将矩阵列重新排列成块纵列邻域操作将图像块重新排列成列两幅图像的绝对差添加两个图像或添加常量到图像彩色通道的线性组合补充图像用常数将一幅图像分割成另一幅图像图像的线性组合用常数相乘的两幅图像或多幅图像从另一个或减去一个图像减去一个图像二元图像中的迹区域边界二进制图像中的跟踪对象绘图区域的边界在强度图像中查找边缘发现使用Hough变换圆创建圈子图像的梯度幅值和方向图像的方向梯度查找图像的三维梯度幅值和方向查找三维图像的方向梯度Hough变换基于Hough变换提取直线段确定峰Hough变换四叉树分解在四叉树分解块值在四叉树分解模块设置的值图像区域的测量特性二值图像中的对象区域通过大小从二值图像中提取对象查找二进制图像中的连接组件从二值图像生成凸壳图像二值图像的距离变换二值图像的测地距离变换二值图像的欧拉数在二值图像中查找对象的周长使用属性从二值图像中提取对象在二值图像中选择对象灰度图像的灰度加权距离变换创建图像数据的等高线图图像数据直方图像素的颜色值沿线段的像素值的横截面二维相关系数矩阵元素的平均值或平均值矩阵元素的标准偏差二维二值图像中的标签连接部件二值图像中的标签连接组件从bwconncomp创建标签矩阵结构包的二进制图像打开二进制图像灰度图像熵灰度图像局部熵局部图像范围图像局部标准偏差从图像创建灰度共生矩阵灰度共生矩阵的性质均方误差峰值信噪比(PSNR)结构相似性指数(SSIM)测量图像质量用主动轮廓分割成前景和背景的图像采用快速行进法的二值图像分割用基于测地距离的彩色分割的两个或三个区域的分割图像基于图像梯度的图像像素权重计算基于灰度强度差的图像像素权重计算选择具有相似灰度值的连续图像区域使用全局阈值Otsu方法采用多级图像阈值Otsu方法使用全局直方图阈值Otsu方法采用局部一阶统计的自适应图像阈值查找区域边界的分割二维超像素oversegmentation的图像将二元掩模烧成二维图像将标签矩阵转换为线性指标的单元阵列图像变换二值图像的距离变换二值图像的测地距离变换灰度图像的灰度加权距离变换Hough变换二维离散余弦变换离散余弦变换矩阵将扇形束投影转换成平行光束扇束变换二维逆离散余弦变换逆扇形束变换逆Radon变换将平行光束投影转换成扇形光束Radon变换二维快速傅立叶变换将零频分量移到光谱中心二维逆快速傅立叶变换逆FFT转换颜色转换转换RGB与CIE 1976 L*a*b*将RGB颜色值的NTSC色彩空间转换RGB与CIE 1931 XYZ转换到YCbCr色彩空间RGB颜色值1976将CIE L*a*b*到RGB1976将CIE L*a*b*到CIE 1931 XYZ将CIE 1931 XYZ CIE 1976 L*a*b*CIE 1931 XYZ到RGB的转换YCbCr颜色值转换到RGB颜色空间转换成NTSC值RGB颜色空间将L * A * B *数据转换为双将L*a*b*数据uint16将L*a*b*数据卡片XYZ颜色值转换为双将XYZ颜色值uint16搜索国际商会简介读的ICC配置文件查找系统默认的国际刑事法院配置文件库将颜色配置文件写入磁盘文件真正的有效的国际刑事法院颜色配置文件创建颜色转换结构应用设备独立的颜色空间变换通过减少颜色数的近似索引图像标准照明体XYZ颜色值generation采用局部一阶统计的自适应图像阈值查找区域边界的分割从二值图像中删除小对象二元图像中的迹区域边界查找二进制图像中的连接组件二值图像的距离变换二值图像的欧拉数二维二值图像中的标签连接部件使用查找表的非线性滤波二值图像的形态学运算包的二进制图像在二值图像中查找对象的周长在二值图像中选择对象二进制图像中的跟踪对象打开二进制图像创建连接的阵列Bayer编码图像转换为彩色图像在强度图像中查找边缘拟合控制点对的几何变换创建预定义的二维滤波器基于它的类的图像的默认显示范围选择具有相似灰度值的连续图像区域采用直方图均衡化增强对比度Hough变换基于Hough变换提取直线段确定峰Hough变换转换到RGB的色度HSV颜色图将图像转换为双精度将图像转换为16位有符号整数将图像转换为单精度将图像转换为16位无符号整数将图像转换为8位无符号整数两幅图像的绝对差调整图像的灰度值或颜色表二值化图像的阈值分割帽子底部过滤二维图像的二维图像滤波抑制连接到图像边缘的光结构形态接近的图像补充图像作物图像放大图像腐蚀图像扩展极大值变换扩展最小变换填充图像区域和孔N维的多维图像滤波发现使用Hough变换圆应用Gabor滤波器或滤波器组二维图像二维图像的二维高斯滤波查找图像的三维梯度幅值和方向查找三维图像的方向梯度图像数据直方图h-maxima变换利用H-minima变换图像的线性组合均方误差形态上打开的图像将二元掩模烧成二维图像图像金字塔的还原与扩展量化图像使用指定的量化电平和输出值从图形文件读取图像形态重构区域极值局部极小调整图像大小旋转图像顶帽滤波转换图像将几何变换应用于图像积分图像的二维箱滤波计算积分图像使用查找表转换整数值检查的有效性信息检查连通性参数的有效性1976将CIE L*a*b*到RGB转换成RGB图像标签矩阵将标签矩阵转换为线性指标的单元阵列矩阵元素的平均值或平均值二维中值滤波采用多级图像阈值Otsu方法二维阶统计滤波使用全局直方图阈值Otsu方法焊盘阵列峰值信噪比(PSNR)图像区域的测量特性将RGB图像的灰度或颜色表将RGB颜色表HSV色图转换RGB与CIE 1976 L*a*b*转换到YCbCr色彩空间RGB颜色值查找对比度拉伸图像的限制二维超像素oversegmentation的图像分水岭变换YCbCr颜色值转换到RGB颜色空间参考二维图像到世界坐标参考三维图像到世界坐标二维仿射几何变换二维射影几何变换形态学结构元素形态学偏移结构元素GPU 计算二值图像的距离变换二维二值图像中的标签连接部件使用查找表的非线性滤波二值图像的形态学运算二维相关系数在强度图像中查找边缘采用直方图均衡化增强对比度将图像转换为双精度将图像转换为单精度将图像转换为8位无符号整数将图像转换为16位无符号整数两幅图像的绝对差调整图像的灰度值或颜色表帽子底部过滤形态接近的图像补充图像放大图像腐蚀图像填充图像区域和孔N维的多维图像滤波图像的梯度幅值和方向图像的方向梯度图像数据直方图图像的线性组合添加噪声到图像YCbCr颜色值转换到RGB颜色空间形态上打开的图像形态重构估计对齐两个二维或三维图像的位移场调整图像大小旋转图像显示图像顶帽滤波逆Radon变换转换矩阵到灰度图像矩阵元素的平均值或平均值二维中值滤波标准化二维互相关焊盘阵列Radon变换图像区域的测量特性将RGB图像的灰度或颜色表转换到YCbCr色彩空间RGB颜色值矩阵元素的标准偏差图像局部标准偏差查找对比度拉伸图像的限制。
基于MatLab的数字图像清晰化方法

直方图的分布,使得直方图移向暗区,可以看出图像的视觉效
·62·
Computer Era No. 4 2008
基于 Web 的授课质量评价系统的研究与实践
刘利俊 1,吴达胜 2 (1. 杭州广播电视大学网络中心,浙江 杭州 310012;2. 浙江林学院信息工程学院)
g1 和 g2 分别为门限阈值(g1<g2)。当噪声较小时,它对小波
系数的增益较大;当噪声较大时,对小波系数的增益较小。该算
法达到了自适应增强的效果。在 MatLab 中使用自适应阈值增
强方法的代码如下。
[x,ma p]=imre a d‘( 中值滤波后图像.tif’); %读取原图像
x=double (x);
直方图均衡化是较好的直方图修正方法,它生成了自适应 的变换函数,它是以已知图像的直方图为基础的。然而,一旦一 幅图像的变换函数计算完毕,它将不再改动,除非直方图有变 动。直方图均衡化通过扩展输入图像的灰度级到较宽亮度尺度 的范围来实现图像的增强,但这种方法并不总能得到成功的结 果。在 MatLab 中使用如下代码实现直方图匹配增强对比度,相 应的图像与图像直方图示于图 5 及图 6。
指标体系的适应性原则。 系统运行的性能和分布与集中处理。由于整个学校学生
人数众多,同时用户可能会很多,有时也许会多达几千个,因 而系统运行的性能是非常关键的,系统应该具有分布与集中 处理功能。
系统的安全性。为了尽量避免报复现象的产生,系统的安 全保密工作应该规定不同的用户具有不同的操作权限。系统用 户可以分成四个群体:学生、教师、领导、专家。安全性问题主要 考虑以下几点:①学生群体只能对当前任课教师进行评价;② 教师群体只能看到他人(学生、同时、领导、专家)对自己的评价 结果,而看不到具体的评价者情况,以免教师对他人实行报复; 同时教师可以对同行进行评价,这些同行必须是与评价者在同 一 学 院(系)的 ,否 则 代 表 性 不 强 ;③ 领 导 群 体 只 能 对 本 学 院 (系)教师进行评价;④专家群体可以评价学校的全体教师。同 时系统还要能够对一些不负责任的学生进行监督控制,需要设 置专门的超级用户可查看学生对教师的评价细节(包括学生学 号、姓名、班级、评价分数等信息)。
MATLAB实验一:图像的输入与输出

MATLAB实验一:图像的输入与输出实验目的本实验的目的是学习如何在MATLAB中进行图像的读取、显示和保存等基本操作,了解不同图像格式的特点和使用场景。
实验内容图像读取与显示在MATLAB中,可以通过imread()函数读取图像。
例如,读取一张名为“lena.png”的图像:lena = imread('lena.png');读取的图像将以矩阵的形式存储在lena变量中,可以通过imshow()函数将其显示:imshow(lena);执行以上代码,会打开一个名为“lena”的窗口,显示读取的图像。
除了常见的PNG格式外,MATLAB还支持读取JPG、BMP、TIFF等多种图像格式。
对于不同的格式,imread()函数可能需要不同的参数设置。
例如,对于JPG 格式的图像,可以通过指定“jpg”字符串来读取:lena_jpg = imread('lena.jpg', 'jpg');图像保存在MATLAB中,可以通过imwrite()函数将图像保存到文件中。
例如,将lena变量保存为PNG格式的文件:imwrite(lena, 'lena_copy.png');执行以上代码,会在当前文件夹生成一个名为“lena_copy.png”的文件,其中包含了lena变量所表示的图像。
与imread()函数类似,imwrite()函数也支持多种图像格式。
例如,将lena 图像保存为JPG格式:imwrite(lena, 'lena_copy.jpg', 'jpg');图像格式转换在MATLAB中,可以使用im2double()函数将图像转换为双精度浮点数格式,方便进行后续数学计算。
例如,将lena图像转换为双精度浮点数格式:lena_double = im2double(lena);同样地,im2uint8()函数可以将图像转换为8位无符号整数格式,方便进行图像处理。
利用Matlab进行图像处理与图像识别的实例
利用Matlab进行图像处理与图像识别的实例引言:在现代科技的发展中,图像处理和图像识别成为了热门的研究领域。
利用计算机视觉技术对图像进行处理和分析,可以广泛应用于医学影像、安防监控、人脸识别等领域。
而Matlab作为一款功能强大的科学计算软件,提供了丰富的图像处理和识别工具箱,极大地便利了研究者在图像领域的工作。
本文将通过几个实例来介绍如何利用Matlab进行图像处理和图像识别。
一、Matlab中的图像处理工具箱Matlab提供了大量的图像处理函数和工具箱,方便用户进行图像的处理和分析。
其中,图像处理工具箱是最常用的一部分。
通过该工具箱,用户可以对图像进行滤波、增强、分割等操作。
例如,可以用imfilter函数进行均值滤波,用imadjust函数对图像进行直方图均衡化。
图像处理工具箱的使用非常简单,只需要调用相应的函数并传入参数即可。
二、实例1:图像滤波图像滤波是图像处理中常用的操作之一。
通过滤波可以去除图像中的噪声或者增强图像的细节。
在Matlab中,可以使用不同的滤波函数来实现不同的效果。
下面以均值滤波和中值滤波为例来介绍。
1. 均值滤波均值滤波是一种简单的线性滤波方法。
在Matlab中,可以使用imfilter函数来进行均值滤波。
例如,对一张灰度图像进行均值滤波的代码如下:```img = imread('image.jpg');h = fspecial('average', [3 3]);filtered_img = imfilter(img, h, 'replicate');```上述代码中,imread函数用于读取图像,fspecial函数用于创建一个3x3的均值滤波模板,imfilter函数用于对图像进行滤波操作。
'replicate'参数表示在边界处使用边界像素值进行补充。
2. 中值滤波中值滤波是一种非线性滤波方法,常用于去除椒盐噪声。
数字图像处理上机报告
练习一常用MATLAB图像处理命令一、练习目的1、熟悉并掌握MATLAB工具的使用;2、实现图像的读取、显示、代数运算和简单变换。
二、练习环境Windows操作系统Matlab 6.5或以上应用软件三、练习内容1、图像文件的读写(1)imread函数用来实现图像文件的读取。
输入以下程序:A=imread('文件名.扩展名');%用imread函数来读入图像注:设置路径imshow(A);%用imshow函数来显示图像得到的结果如图:(2)imfinfo函数用来查询图像文件信息。
输入以下程序:info=imfinfo('文件名.扩展名');% 用imfinfo函数查询图像文件信息得到:info =Filename: '文件名.扩展名'(4)imshow函数用来显示图像。
刚才介绍imread函数时已使用此函数。
(5)colorbar函数将颜色条添加到坐标轴对象中。
输入以下程序:RGB=imread('***');%图像读入I=rgb2gray(RGB);%把RGB图像转换成灰度图像imshow(I),colorbar('vert')% 将颜色条添加到坐标轴对象中得到如图:2、图像处理的基本操作一、图像代数运算(1)imadd函数实现两幅图像的相加或者给一幅图像加上一个常数。
给图像每个像素都增加亮度的程序如下:I=imread('***');J=imadd(I,100);%给图像增加亮度subplot(1,2,1),imshow(I) %填充subplot(1,2,2),imshow(J)结果如图5。
(2)imsubtract函数实现从一幅图像中减去一个常数。
输入以下程序实现从一幅图像中减去一个常数:(3)immultiply实现两幅图像的相乘或者一幅图像的亮度缩放(图像乘以小于1或大于1的参数,比较效果)。
数字图像处理第二章 MATLAB中图象工具箱及图象.
1.2图像显示
1.getimage函数 格式 A=GETIMAGE(H). 返回图形句柄对象 H 中
包含的第一个图像的数据.H既可以是一条曲线, 图像 , 或纹理表面 .A 等同为图像的数据。格式 [X,Y,A]=GETIMAGE(H). 返 回 图 像 的 Xdata 到 X,Ydata到Y,Xdata和Ydata是表明x轴和y轴的范 围的两元素向量。 格式 […,A,FLAG]=GETIMAGE(H) 。返回指示 图像类型的整数型标记.FLAG可为下列值:
格式 IMAGE(RGB). 用于显示真彩色图像。
格式 IMAGE(X,MAP). 显示索引图 X 及其
调色板MAP。 格式 IMSHOW(FILENAME). 显示存储于 图形文件FILENAME中的图像。 H=IMSHOW(…).返回图像对象的句柄。
5.SUBIMAGE函数
格式SUBIMAGE(X,MAP).用来显示当前坐标中
2.imwrite函数 该函数用于把图像写入图形文件中。格式
IMWRITE(A,FILENAME,FMT)把图像A写入文 件FILENAME中。FILENAME指明文件名, FMT指明文件格式。A既可以是一个灰度图,也 可以是一个真彩图像。格式 IMWRITE(X,MAP,FILENAME,FMT)把索引图 及其调色板写入FILENAME中。MAP必须为合 法的MATLAB调色板,大多数图像格式不支持 多于256色的调色板。FMT的可能取值为tif或 tiff,jpg或jpeg,bmp,png,hdf,pcx,xwd。
0 不是图像,A返回一个空矩阵。 1 索引图。 2 标准灰度图。 3非标准灰度图。 4 RGB图像。 例如在用 imshow 直接从文件中显示一个
matlab拉普拉斯算子锐化的代码
一、概述matlab是一种用于科学计算和工程设计的软件,其强大的功能使得它在图像处理领域尤为突出。
而拉普拉斯算子在图像处理中被广泛用于图像的锐化,能够突出图像的边缘和细节,从而提高图像的清晰度和质量。
在matlab中,编写拉普拉斯算子的代码能够帮助工程师和科学家实现图像的优化处理。
本文将介绍matlab中拉普拉斯算子的代码编写方法,帮助读者快速掌握图像处理的技术。
二、拉普拉斯算子原理1. 拉普拉斯算子是一种二阶偏微分算子,用于描述图像中灰度的变化程度。
在图像处理中,拉普拉斯算子可以用于检测图像中的边缘和细节,帮助图像的锐化和增强。
2. 拉普拉斯算子在二维图像中的离散形式可以表示为以下公式:Δf(x, y) = f(x+1, y) + f(x-1, y) + f(x, y+1) + f(x, y-1) - 4*f(x, y)其中,Δf(x, y)表示图像中像素点(x, y)处的拉普拉斯算子值,f(x, y)表示图像中像素点(x, y)处的灰度值。
三、matlab中拉普拉斯算子的代码编写在matlab中,可以利用内置的函数和操作符来实现拉普拉斯算子的计算和图像的锐化。
下面是一个基本的matlab代码示例:```matlab读取原始图像original_image = imread('image.jpg');将原始图像转化为灰度图gray_image = rgb2gray(original_image);使用laplacian函数计算图像的拉普拉斯算子laplacian_image = del2(double(gray_image));将计算得到的图像进行锐化处理sharpened_image = imadd(double(gray_image),laplacian_image);显示原始图像和处理后的图像subplot(1, 2, 1);imshow(gray_image);title('Original Image');subplot(1, 2, 2);imshow(sharpened_image, []);title('Sharpened Image');```上述代码首先通过imread函数读取原始图像,并利用rgb2gray函数将其转换为灰度图。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
. . 数字图像去噪典型算法及matlab实现 希望得到大家的指点和帮助 图像去噪是数字图像处理中的重要环节和步骤。去噪效果的好坏直接影响到后续的图像处理工作如图像分割、边缘检测等。图像信号在产生、传输过程中都可能会受到噪声的污染,一般数字图像系统中的常见噪声主要有:高斯噪声(主要由阻性元器件内部产生)、椒盐噪声(主要是图像切割引起的黑图像上的白点噪声或光电转换过程中产生的泊松噪声)等; 目前比较经典的图像去噪算法主要有以下三种: 均值滤波算法:也称线性滤波,主要思想为邻域平均法,即用几个像素灰度的平均值来代替每个像素的灰度。有效抑制加性噪声,但容易引起图像模糊,可以对其进行改进,主要避开对景物边缘的平滑处理。 中值滤波:基于排序统计理论的一种能有效抑制噪声的非线性平滑滤波信号处理技术。中值滤波的特点即是首先确定一个以某个像素为中心点的邻域,一般为方形邻域,也可以为圆形、十字形等等,然后将邻域中各像素的灰度值排序,取其中间值作为中心像素灰度的新值,这里领域被称为窗口,当窗口移动时,利用中值滤波可以对图像进行平滑处理。其算法简单,时间复杂度低,但其对点、线和尖顶多的图像不宜采用中值滤波。很容易自适应化。 Wiener维纳滤波:使原始图像和其恢复图像之间的均方误差最小的复原方法,是一种自适应滤波器,根据局部方差来调整滤波器效果。对于去除高斯噪声效果明显。 实验一:均值滤波对高斯噪声的效果 I=imread('C:\Documents and Settings\Administrator\桌面\1.gif');%读取图像 . . J=imnoise(I,'gaussian',0,0.005);%加入均值为0,方差为0.005的高斯噪声 subplot(2,3,1);imshow(I); title('原始图像'); subplot(2,3,2); imshow(J); title('加入高斯噪声之后的图像'); %采用MATLAB中的函数filter2对受噪声干扰的图像进行均值滤波 K1=filter2(fspecial('average',3),J)/255; %模板尺寸为3 K2=filter2(fspecial('average',5),J)/255;% 模板尺寸为5 K3=filter2(fspecial('average',7),J)/255; %模板尺寸为7 K4= filter2(fspecial('average',9),J)/255; %模板尺寸为9 subplot(2,3,3);imshow(K1); title('改进后的图像1'); subplot(2,3,4); imshow(K2); title('改进后的图像2'); subplot(2,3,5);imshow(K3); title('改进后的图像3'); subplot(2,3,6);imshow(K4); title('改进后的图像4');
PS :filter2用法:filter2用法fspecial函数用于创建预定义的滤波算子,其语法
格式为: h = fspecial(type) . . h = fspecial(type,parameters) 参数type制定算子类型,parameters指定相应的参数,具体格式为: type='average',为均值滤波,参数为n,代表模版尺寸,用向量表示,默认值为[3,3]。 type= 'gaussian',为高斯低通滤波器,参数有两个,n表示模版尺寸,默认值为[3,3],sigma表示滤波器的标准差,单位为像素,默认值为 0.5。 type= 'laplacian',为拉普拉斯算子,参数为alpha,用于控制拉普拉斯算子的形状,取值范围为[0,1],默认值为0.2。 type= 'log',为拉普拉斯高斯算子,参数有两个,n表示模版尺寸,默认值为[3,3],sigma为滤波器的标准差,单位为像素,默认值为0.5 type= 'prewitt',为prewitt算子,用于边缘增强,无参数。 type= 'sobel',为著名的sobel算子,用于边缘提取,无参数。 type= 'unsharp',为对比度增强滤波器,参数alpha用于控制滤波器的形状,范围为[0,1],默认值为0.2。
据我目测,使用均值滤波去噪(高斯噪声)效果选用的邻域半径越大效果越好,当然其代价也会更大,另外确切的去噪效果的好坏还需要用SNR等数据来度量。 实验二:二维自适应维纳滤波对高斯噪声的滤除效果 I=imread('C:\Documents and Settings\Administrator\桌面\1.gif'); %读取图像 J=imnoise(I,'gaussian',0,0.005); %加入均值为0,方差为0.005的高斯噪声 K2=wiener2(J,[3 3]); %对加噪图像进行二维自适应维纳滤波 . . K2=wiener2(J,[5 5]); %对加噪图像进行二维自适应维纳滤波 K2=wiener2(J,[7 7]); %对加噪图像进行二维自适应维纳滤波 K2=wiener2(J,[9 9]); %对加噪图像进行二维自适应维纳滤波 subplot(2,3,1);imshow(I); title('原始图像'); subplot(2,3,2);imshow(J); title('加噪图像'); subplot(2,3,3);imshow(K1); title('恢复图像1'); subplot(2,3,4);imshow(K2); title('恢复图像2'); subplot(2,3,5);imshow(K3); title('恢复图像3'); subplot(2,3,6);imshow(K4); title('恢复图像3');
PS :维纳滤波的两个函数wiener2与deconvwnr都能够完成维纳滤波的功能, deconvwnr强调图象复原方面,wiener2强调图象空间域锐化的作用,其中J=wiener2(I,[m,n])返回有噪声图像I经过wierner(维纳)滤波后的图像,[m,n]指定滤波器窗口大小为m*n,默认值为3*3,J=wiener2(I,[m,n],noise)指定噪声的功率,[J,noise]=wiener2(I,[m,n])在图像滤波的同时,返回噪声功率的估计值noise。: 维纳滤波的两个函数wiener2与deconvwnr都能够完成维纳滤波的功能, deconvwnr强调图象复原方面,wiener2强调图象空间域锐化的作用,其中J=wiener2(I,[m,n])返回有噪声图像I经过wierner(维纳)滤波后的图像,[m,n]指定滤波器窗口大小为m*n,默认值为3*3,J=wiener2(I,[m,n],noise)指定噪声的功率,[J,noise]=wiener2(I,[m,n])在图像滤波的同
时,返回噪声功率的估计值noise。imnoise的语法格式为 . . J = imnoise(I,type) J = imnoise(I,type,parameters) 其中J = imnoise(I,type)返回对原始图像I添加典型噪声的有噪图像J。 参数type和parameters用于确定噪声的类型和相应的参数。 下面的命令是对图像1.gif分别加入高斯噪声、椒盐噪声和乘性噪声,其结果
实验三:对加入椒盐噪声的图像分别作均值、中值和维纳滤波 I=imread(1.gif'); J1=imnoise(I,'gaussian',0,0.02); J2=imnoise(I,'salt & pepper',0.02); J3=imnoise(I,'speckle',0.02);
运行效果见图2 I=imread('C:\Documents and Settings\Administrator\桌面\1.gif'); J=imnoise(I,'salt & pepper',0.02); %h=ones(3,3)/9;%产生3*3的全1数组 %B=conv2(J,h);%卷积运算 K2=filter2(fspecial('average',3),J)/255; %均值滤波模板尺寸为3 K= medfilt2(J);%采用二维中值滤波函数medfilt2对受椒盐噪声干扰的图像滤波 K1=wiener2(J,[3 3]); %对加噪图像进行二维自适应维纳滤波 subplot(2,3,1);imshow(I); title('原始图像'); subplot(2,3,2);imshow(J); title('加噪图像'); . . subplot(2,3,3);imshow(K2); title('均值滤波后的图像'); subplot(2,3,4);imshow(K); title('中值滤波后的图像'); subplot(2,3,5);imshow(K1); title('维纳滤波后的图像');
PS :MATLAB中提供了卷积运算的函数命令conv2,其语法格式为: :MATLAB 中提供了卷积运算的函数命令conv2,其语法格式为:
C = conv2(A,B) C = conv2(A,B)返回矩阵A和B的二维卷积C。若A为ma×na的矩阵,B为mb×nb的矩阵,则C的大小为(ma+mb+1)×(na+nb+1)。 MATLAB图像处理工具箱提供了基于卷积的图象滤波函数filter2,filter2的语法格式为: Y = filter2(h,X) 其中Y = filter2(h,X)返回图像X经算子h滤波后的结果,默认返回图像Y与输入图像X大小相同。例如: 其实filter2和conv2是等价的。MATLAB在计算filter2时先将卷积核旋转180度,再调用conv2函数进行计算。 Fspecial函数用于创建预定义的滤波算子,其语法格式为: h = fspecial(type) h = fspecial(type,parameters)