MATLAB图像处理相关函数

合集下载

matlab模糊函数代码

matlab模糊函数代码

matlab模糊函数代码在数学和图像处理领域中,模糊函数是一种常用的工具,用于对图像进行模糊处理以达到一定的效果。

Matlab提供了一些内置函数来实现图像的模糊处理,本文将介绍如何使用Matlab编写模糊函数代码。

Matlab中有多种不同类型的模糊函数,例如高斯模糊、均值模糊和运动模糊等。

下面将逐一介绍这些模糊函数代码的实现方式。

1. 高斯模糊:高斯模糊是最常用的模糊算法之一,它通过卷积图像与一个高斯核来实现。

以下是Matlab中实现高斯模糊的代码示例:```matlabfunction blurredImage = gaussianBlur(image, sigma)kernelSize = 2 * ceil(3 * sigma) + 1; % 根据sigma计算高斯核大小kernel = fspecial('gaussian', [kernelSize kernelSize], sigma); % 生成高斯核blurredImage = imfilter(image, kernel, 'conv'); % 对图像进行卷积操作end```2. 均值模糊:均值模糊是一种简单但常用的模糊算法,它通过计算邻域像素的平均值来实现。

以下是Matlab中实现均值模糊的代码示例:```matlabfunction blurredImage = meanBlur(image, kernelSize)kernel = ones(kernelSize) / (kernelSize^2); % 生成均值核blurredImage = imfilter(image, kernel, 'conv'); % 对图像进行卷积操作end```3. 运动模糊:运动模糊是一种模糊算法,它通过模拟相机快门打开时的移动效果来实现。

以下是Matlab中实现运动模糊的代码示例:```matlabfunction blurredImage = motionBlur(image, angle, distance)PSF = fspecial('motion', distance, angle); % 生成运动模糊核blurredImage = imfilter(image, PSF, 'conv'); % 对图像进行卷积操作end```以上是几种常见的模糊函数的Matlab代码实现。

matlab image函数用法

matlab image函数用法

matlab image函数用法MATLAB Image函数用法Image函数是Matlab的一个基本的图像处理函数,可以用来读取、显示和储存各种格式的图像,并且可以进行基本的图像矩阵变换,是Matlab中常用的图像处理方法。

以下将详细介绍如何使用Image函数:第一步:载入图片如果要对某个图片进行处理,首先需要将其载入Matlab环境中,可以使用Image函数来实现。

可以通过下面的代码来完成:A = imread('path_to_image');其中path_to_image指定了图片的位置,读取后会自动填充到变量A 中,这样就可以用A来进行后续的处理。

第二步:显示载入的图片载入完图片以后,我们可以使用下面的命令来显示该图片:imshow(A);这步骤完成后,就可以在Matlab环境中看到载入的图片。

第三步:图像矩阵变换如果要对载入的图片进行像素矩阵的变换,比如反转、镜像等等,可以使用以下代码来实现:B = imrotate(A, 90); //旋转90度C = flipud(A); //上下翻转D = fliplr(A); //左右翻转这些操作会对载入的图片进行像素矩阵变换,变换后的图像就会储存到相应变量中,例如旋转后的图像就会储存在B中,上下翻转后的图像就会储存在C中,左右翻转后的图像就会储存在D中,之后可以使用imshow函数来查看这些变换后的图片。

第四步:存储变换后的图片如果想对变换后的图片进行存储,可以使用Image函数中提供的imwrite函数来实现,可以使用如下代码:imwrite(B,'rotated.jpg'); //保存旋转后的图片imwrite(C,'Vertical_flip.jpg'); //保存上下翻转后的图片imwrite(D,'Horizontal_flip.jpg'); //保存左右翻转后的图片其中,括号内的参数指定图片的存储路径和名称,执行完上述代码,就可以在指定位置看到三张变换后的图片。

matlab图像处理之image和imagesc函数

matlab图像处理之image和imagesc函数

matlab图像处理之image和imagesc函数imshow主要⽤于调⽤图像索引,⽐如:imshow(X,map)其功能等同于:image(X) colormap(map)但是,imshow的功能要强⼤⼀些,⽐如⽤于灰度图像,RGB图像,⼆进制图像,都可以应⽤。

imagesc属于图像缩放函数具体说⼀些例⼦:要显⽰⼀副灰度图像,可以调⽤函数 imshow 或 imagesc (即imagescale,图像缩放函数)(1) imshow 函数显⽰灰度图像使⽤ imshow(I) 或使⽤明确指定的灰度级书⽬:imshow(I,32)由于Matlab⾃动对灰度图像进⾏标度以适合调⾊板的范围,因⽽可以使⽤⾃定义⼤⼩的调⾊板。

其调⽤格式如下:imshow(I,[low,high])其中,low 和 high 分别为数据数组的最⼩值和最⼤值。

(2) imagesc 函数显⽰灰度图像下⾯的代码是具有两个输⼊参数的 imagesc 函数显⽰⼀副灰度图像imagesc(1,[0,1]);colormap(gray);imagesc 函数中的第⼆个参数确定灰度范围。

灰度范围中的第⼀个值(通常是0),对应于颜⾊映象表中的第⼀个值(颜⾊),第⼆个值(通常是1)则对应与颜⾊映象表中的最后⼀个值(颜⾊)。

灰度范围中间的值则线型对应与颜⾊映象表中剩余的值(颜⾊)。

在调⽤ imagesc 函数时,若只使⽤⼀个参数,可以⽤任意灰度范围显⽰图像。

在该调⽤⽅式下,数据矩阵中的最⼩值对应于颜⾊映象表中的第⼀个颜⾊值,数据矩阵中的最⼤值对应于颜⾊映象表中的最后⼀个颜⾊值。

5.3 RGB 图像及其显⽰(1) image(RGB)不管RGB图像的类型是double浮点型,还是 uint8 或 uint16 ⽆符号整数型,Matlab都能通过 image 函数将其正确显⽰出来。

RGB8 = uint8(round(RGB64×255)); %将 double 浮点型转换为 uint8 ⽆符号整型RGB64 = double(RGB8)/255; %将 uint8 ⽆符号整型转换为 double 浮点型RGB16 = uint16(round(RGB64×65535)); %将 double 浮点型转换为 uint16 ⽆符号整型RGB64 = double(RGB16)/65535; %将 uint16 ⽆符号整型转换为 double 浮点型(2) imshow(RGB) 参数是⼀个 m×n×3 的数组5.4 ⼆进制图像及其显⽰(1) imshow(BW)在 Matlab 7.0 中,⼆进制图像是⼀个逻辑类,仅包括 0 和 1 两个数值。

matlab数字图像处理函数大全

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的histeq函数

matlab的histeq函数

matlab的histeq函数
Matlab的histeq函数是一种直方图均衡化方法,通过将图像的像素
值重新分布来增强图像的对比度和亮度。

它可以用于改善图像的质量,使其更易于分析和处理。

在使用histeq函数之前,需要对图像进行预处理,将其转换为灰度图像。

然后,可以使用以下代码调用histeq函数:
```
I = imread('image.jpg'); % 读取图像
gray = rgb2gray(I); % 转换为灰度图像
J = histeq(gray); % 对灰度图像进行直方图均衡化
```
这段代码首先使用imread函数读取一张图像,然后使用rgb2gray函数将其转换为灰度图像。

最后,使用histeq函数对灰度图像进行直方图均衡化,并将结果保存在J中。

histeq函数的实现基于以下两个步骤:
1. 计算图像的直方图。

直方图是一种描述像素值分布的图表,它统计
了每个像素值出现的次数。

2. 重新分布像素值。

根据直方图信息,将像素值重新分布,使其更加均匀分布,从而增强图像的对比度和亮度。

在实际应用中,histeq函数可以用于图像增强、图像比较、色彩显著性分析等领域。

例如,在医疗图像中,直方图均衡化可以使图像的细节更明显,从而更易于诊断。

需要注意的是,histeq函数可能会导致图像出现过度增强和失真。

因此,在使用histeq函数之前,应该先对图像进行适当的调整,以确保结果符合需要。

总之,Matlab的histeq函数是一个常用的图像处理工具,可以帮助我们快速、方便地增强图像的对比度和亮度,提高图像的质量和可分析性。

MATLAB图像处理函数大全

MATLAB图像处理函数大全

Matlab数字数字图像处理函数汇总:1、数字数字图像的变换①fft2:fft2函数用于数字数字图像的二维傅立叶变换,如:i=imread('104_8.tif'); j=fft2(i);②ifft2::ifft2函数用于数字数字图像的二维傅立叶反变换,如:i=imread('104_8.tif');j=fft2(i);k=ifft2(j);2、模拟噪声生成函数和预定义滤波器①imnoise:用于对数字数字图像生成模拟噪声,如:i=imread('104_8.tif');j=imnoise(i,'gaussian',0,0.02);%模拟高斯噪声②fspecial:用于产生预定义滤波器,如:h=fspecial('sobel');%sobel水平边缘增强滤波器h=fspecial('gaussian');%高斯低通滤波器h=fspecial('laplacian');%拉普拉斯滤波器h=fspecial('log');%高斯拉普拉斯(LoG)滤波器h=fspecial('average');%均值滤波器2、数字数字图像的增强①直方图:imhist函数用于数字数字图像的直方图显示,如:i=imread('104_8.tif');imhist(i);②直方图均化:histeq函数用于数字数字图像的直方图均化,如:i=imread('104_8.tif');j=histeq(i);③对比度调整:imadjust函数用于数字数字图像的对比度调整,如:i=imread('104_8.tif');j=imadjust(i,[0.3,0.7],[]);④对数变换:log函数用于数字数字图像的对数变换,如:i=imread('104_8.tif');j=double(i);k=log(j);⑤基于卷积的数字数字图像滤波函数:filter2函数用于数字数字图像滤波,如:i=imread('104_8.tif');h=[1,2,1;0,0,0;-1,-2,-1];j=filter2(h,i);⑥线性滤波:利用二维卷积conv2滤波, 如:i=imread('104_8.tif');h=[1,1,1;1,1,1;1,1,1];h=h/9;j=conv2(i,h);⑦中值滤波:medfilt2函数用于数字数字图像的中值滤波,如:i=imread('104_8.tif');j=medfilt2(i);⑧锐化(1)利用Sobel算子锐化数字数字图像, 如:i=imread('104_8.tif');h=[1,2,1;0,0,0;-1,-2,-1];%Sobel算子j=filter2(h,i);(2)利用拉氏算子锐化数字数字图像, 如:i=imread('104_8.tif');j=double(i);h=[0,1,0;1,-4,0;0,1,0];%拉氏算子k=conv2(j,h,'same');m=j-k;3、数字数字图像边缘检测①sobel算子如:i=imread('104_8.tif');如有帮助,欢迎支持。

MATLAB 图像处理命令使用

MATLAB 图像处理命令使用

MATLAB 图像处理命令使用1.MATLAB中图像处理的一些简单函数A、imreadimread函数用于读入各种图像文件,其一般的用法为[X,MAP]=imread(‘filename’,‘fmt’)其中,X,MAP分别为读出的图像数据和颜色表数据,fmt为图像的格式,filename为读取的图像文件(可以加上文件的路径)。

例:[X,MAP]=imread(’flowers.tif’,’tif’);比较读取二值图像,灰度图像,索引图像,彩色图像的X和MAP的特点,可以利用size 函数用来显示数组的维数,了解数据的特点。

B=size(a) 返回数组a 的维数。

B、imwriteimwrite函数用于输出图像,其语法格式为:imwrite(X,map,filename,fmt)imwrite(X,map,filename,fmt)按照fmt指定的格式将图像数据矩阵X和调色板map写入文件filename。

C、imfinfoimfinfo函数用于读取图像文件的有关信息,其语法格式为imfinfo(filename,fmt)imfinfo函数返回一个结构info,它反映了该图像的各方面信息,其主要数据包括:文件名(路径)、文件格式、文件格式版本号、文件的修改时间、文件的大小、文件的长度、文件的宽度、每个像素的位数、图像的类型等。

2.MATLAB中图像文件的显示imshowimshow函数是最常用的显示各种图像的函数,其语法如下:imshow(X,map)其中X是图像数据矩阵,map是其对应的颜色矩阵,若进行图像处理后不知道图像数据的值域可以用[]代替map。

(1)二进制(二值)图像显示方法,在MATLAB中一幅二值图像是uint8或双精度的,该矩阵仅包含0和1。

如果希望工具箱中的函数能将图像理解为二进制的,那么所有数据都要是逻辑数据,必须对其进行设置(将所有数据标志均设置on).可以对数据利用“~”取反操作实现图像逆转即黑白反色。

Matlab中图像处理常用函数的用法

Matlab中图像处理常用函数的用法

Matlab中常见函数的用法1 size()函数1)s=size(A),当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时矩阵的行数,第二个元素是矩阵的列数。

2)[r,c]=size(A),当有两个输出参数时,size函数将矩阵的行数返回到第一个输出变量r,将矩阵的列数返回到第二个输出变量c。

3)size(A,n)如果在size函数的输入参数中再添加一项n,并用1、2或者3为n赋值,则 size将返回矩阵的行数或列数。

其中r=size(A,1)该语句返回的时矩阵A的行数, c=size(A,2) 该语句返回的时矩阵A的列数。

如果A为一个二维数组,则可以将其看成一个第三维为1的数组,即size(A,3)的返回值为1。

2 padarray()函数B = padarray(A,padsize,padval,direction)A为输入图像,B为填充后的图像,padsize给出了给出了填充的行数和列数,通常用[r c]来表示。

padval和direction分别表示填充方法和方向。

它们的具体值和描述如下:Padval选项:'symmetric'表示图像大小通过围绕边界进行镜像反射来扩展;'replicate'表示图像大小通过复制外边界中的值来扩展;'circular'图像大小通过将图像看成是一个二维周期函数的一个周期来进行扩展。

Direction选项:'pre'表示在每一维的第一个元素前填充;'post'表示在每一维的最后一个元素后填充;'both'表示在每一维的第一个元素前和最后一个元素后填充,此项为默认值。

若参量中不包括direction,则默认值为'both';若参量中不包含padval,则默认用0来填充。

若参量中不包括任何参数,则默认填充为零且方向为'both'。

matlab中imread函数的用法

matlab中imread函数的用法

matlab中imread函数的用法MATLAB中imread函数的用法MATLAB是一款强大的数学工具,用于矩阵计算、数据分析、绘图和图像处理。

imread 函数是用于读入图像文件的函数之一。

读入的图像可以是常见的各种格式,比如BMP、GIF、JPEG、PNG等。

语法格式:```img = imread(filename)img = imread(filename, fmt)```filename为图像所在路径和文件名,fmt为文件格式(可选)。

如果fmt省略,则MATLAB会自动检测图像文件的格式。

函数返回值:img:读入的图像矩阵imread函数的常见用法1. 读入 RGB 彩色图像RGB彩色图像保存为三通道的图像,分别是红、绿、蓝三个颜色通道,每个通道的值范围是 [0,255]。

读入RGB图像:```img = imread('example.jpg');```2. 读入灰度图像灰度图像只有一个通道,通道数为1,每个像素点的值在[0,255]之间。

读入灰度图像:```img = imread('example_gray.jpg');3. 指定图像格式如果图像文件的格式不支持自动检测,可以使用fmt参数来指定图像文件的格式,如JPEG格式:```img = imread('example.jpg', 'jpg');```4. 读入部分图像使用imread函数可以读入部分图像,只需要指定图像文件中某一部分的范围即可,例如:```img = imread('example.jpg','PixelRegion',{[1 10],[1 10],[]});```使用PixelRegion选项,可以选择只读入图像的某一区域,前两个参数指定所选区域的行和列的范围,第三个参数指定通道范围(如果是灰度图像则省略)。

MATLAB图像处理函数大全

MATLAB图像处理函数大全

Matlab图像处理函数大全(一)图像增强1. 直方图均衡化的Matlab 实现1.1 imhist 函数功能:计算和显示图像的色彩直方图格式:imhist(I,n)imhist(X,map)说明:imhist(I,n) 其中,n 为指定的灰度级数目,缺省值为256;imhist(X,map) 就算和显示索引色图像X 的直方图,map 为调色板。

用stem(x,counts) 同样可以显示直方图。

1.2 imcontour 函数功能:显示图像的等灰度值图格式:imcontour(I,n),imcontour(I,v)说明:n 为灰度级的个数,v 是有用户指定所选的等灰度级向量。

1.3 imadjust 函数功能:通过直方图变换调整对比度格式:J=imadjust(I,[low high],[bottom top],gamma)newmap=imadjust(map,[low high],[bottom top],gamma)说明:J=imadjust(I,[low high],[bottom top],gamma) 其中,gamma 为校正量r,[low high] 为原图像中要变换的灰度范围,[bottom top] 指定了变换后的灰度范围;newmap=imadjust(map,[low high],[bottom top],gamma) 调整索引色图像的调色板map 。

此时若[low high] 和[bottom top] 都为2×3的矩阵,则分别调整R、G、B 3个分量。

1.4 histeq 函数功能:直方图均衡化格式:J=histeq(I,hgram)J=histeq(I,n)[J,T]=histeq(I,...)newmap=histeq(X,map,hgram)newmap=histeq(X,map)[new,T]=histeq(X,...)说明:J=histeq(I,hgram) 实现了所谓“直方图规定化”,即将原是图象I 的直方图变换成用户指定的向量hgram 。

matlab图像处理函数大全

matlab图像处理函数大全

matlab图像处理函数大全Matlab是一种强大的科学计算软件,广泛应用于各个领域,包括图像处理。

在Matlab中,有许多内置的图像处理函数,可以帮助我们实现各种图像处理任务。

本文将介绍一些常用的Matlab图像处理函数,帮助您更好地理解和运用这些函数。

1. imread函数imread函数用于读取图像文件,并将其存储为Matlab的图像矩阵。

它可以读取多种图像格式,如JPEG、PNG、BMP等。

例如,可以使用以下代码读取名为"image.jpg"的图像文件:```matlabimage = imread('image.jpg');```2. imshow函数imshow函数用于显示图像。

它可以接受一个图像矩阵作为输入,并将其显示在Matlab的图像窗口中。

例如,可以使用以下代码显示之前读取的图像:```matlabimshow(image);```3. imresize函数imresize函数用于调整图像的大小。

它可以接受一个图像矩阵和目标大小作为输入,并返回调整大小后的图像矩阵。

例如,可以使用以下代码将图像调整为200x200的大小:```matlabresized_image = imresize(image, [200, 200]);```4. rgb2gray函数rgb2gray函数用于将彩色图像转换为灰度图像。

它可以接受一个彩色图像矩阵作为输入,并返回一个灰度图像矩阵。

例如,可以使用以下代码将彩色图像转换为灰度图像:```matlabgray_image = rgb2gray(image);```5. imadjust函数imadjust函数用于调整图像的对比度和亮度。

它可以接受一个灰度图像矩阵和目标对比度和亮度范围作为输入,并返回调整后的图像矩阵。

例如,可以使用以下代码增加图像的对比度和亮度:```matlabadjusted_image = imadjust(gray_image, [0.2, 0.8], [0, 1]);```6. imfilter函数imfilter函数用于对图像进行滤波操作。

matlab中images函数

matlab中images函数

1. 图像处理在科学研究和工程领域中具有重要作用,而MATLAB作为一种强大的科学计算软件,拥有丰富的图像处理功能。

其中,images 函数是MATLAB中用于图像处理的重要函数之一。

2. images函数是MATLAB中一个用于创建图像的函数。

它可以在MATLAB中生成各种类型和大小的图像,包括灰度图像、彩色图像以及各种特定形状和大小的图像。

images函数的基本语法如下所示: ```matlabimg = images('PropertyName', 'PropertyValue', ...)```其中,img是生成的图像对象,'PropertyName'和'PropertyValue'是用于指定图像属性的参数。

3. images函数可以用来创建各种类型的图像,包括灰度图像和彩色图像。

对于灰度图像,可以通过指定图像的大小和灰度值来创建。

下面的代码创建了一个大小为256x256的灰度图像,灰度值为128:```matlabimg = images('CData', ones(256,256)*128);```对于彩色图像,可以通过指定图像的大小和RGB值来创建。

下面的代码创建了一个大小为256x256的彩色图像,颜色为红色:```matlabimg = images('CData', cat(3, ones(256,256), zeros(256,256),zeros(256,256)));```4. images函数还可以用来创建特定形状和大小的图像。

通过指定图像的大小和形状参数,可以轻松地创建各种形状的图像,如矩形、圆形和椭圆形。

下面的代码创建了一个大小为256x256的红色矩形图像: ```matlabimg = images('CData', cat(3, ones(256,256), zeros(256,256), zeros(256,256)), 'XData', [0 10], 'YData', [0 10]);```5. images函数还可以用来处理图像的显示和调整。

matlabimread,imshow,subplot,figure,imwrite的用法

matlabimread,imshow,subplot,figure,imwrite的用法

matlabimread,imshow,subplot,figure,imwrite的用法1. imread:这个函数用于从文件中读取图像。

它的语法如下:```A = imread(filename)```其中,`filename`是字符串类型的参数,表示要读取的图像文件名。

`A`是一个矩阵,表示读取到的图像。

2. imshow:imshow函数用于显示图像。

它的语法如下:```imshow(A)```其中,`A`是一个矩阵,表示要显示的图像。

3. subplot:subplot函数用于在一个图形窗口中创建一个均匀的子图网格,并指定当前操作的子图。

它的语法如下:```subplot(m,n,p)```其中,`m`表示子图网格的行数,`n`表示子图网格的列数,`p`表示当前要操作的子图的位置。

4. figure:figure函数用于创建一个新的图形窗口。

它的语法如下:```figure```这个函数调用时不带参数,只创建一个新的图形窗口。

5. imwrite:imwrite函数用于将图像保存到一个文件中。

它的语法如下:```imwrite(A,filename)```其中,`A`是一个矩阵,表示要保存的图像,`filename`是保存图像的文件名。

这些函数在MATLAB中经常被用于图像处理和分析领域。

在具体使用时,我们可以结合其他函数一起使用,来完成一些复杂的图像处理任务。

例如,我们可以使用imread读取一张图像,然后使用imshow显示该图像:```A = imread('image.jpg');imshow(A);```我们也可以创建一个带有多个子图的图形窗口,并在不同的子图中显示不同的图像:```figure;subplot(2,2,1);imshow(A);subplot(2,2,2);imshow(B);subplot(2,2,3);imshow(C);subplot(2,2,4);imshow(D);```最后,我们还可以对处理后的图像使用imwrite保存到文件中:```C = someImageProcessingFunction(A);imwrite(C,'processed_image.jpg');```这些函数都是MATLAB中图像处理和分析的基本操作,通过它们的灵活使用,可以实现各种不同的图像处理任务。

Matlab 图像处理相关函数命令大全

Matlab 图像处理相关函数命令大全

Matlab 图像处理相关函数命令大全一、通用函数:colorbar显示彩色条语法:colorbar \ colorbar('vert') \ colorbar('horiz') \ colorbar(h) \ h=colorbar(...) \colorbar(...,'peer',axes_handle)getimage 从坐标轴取得图像数据语法:A=getimage(h) \ [x,y,A]=getimage(h) \ [...,A,flag]=getimage(h) \ [...]=getimageimshow显示图像语法:imshow(I,n) \ imshow(I,[low high]) \ imshow(BW) \ imshow(X,map) \ imshow(RGB)\ imshow(...,display_option) \ imshow(x,y,A,...) \ imshow filename \ h=imshow(...)montage在矩形框中同时显示多幅图像语法:montage(I) \ montage(BW) \ montage(X,map) \ montage(RGB) \ h=montage(...)i mmovie创建多帧索引图的电影动画语法:mov=immovie(X,map) \ mov=immovie(RGB)subimage在一副图中显示多个图像语法:subimage(X,map) \ subimage(I) \ subimage(BW) \ subimage(RGB) \subimage(x,y,...) \ subimage(...)truesize调整图像显示尺寸语法:truesize(fig,[mrows mcols]) \ truesize(fig)warp将图像显示到纹理映射表面语法:warp(X,map) \ warp(I ,n) \ warp(z,...) warp(x,y,z,...) \ h=warp(...)zoom 缩放图像语法:zoom on \ zoom off \ zoom out \ zoom reset \ zoom \ zoom xon \ zoom yon\zoom(factor) \ zoom(fig,option)二、图像文件I/O函数命令imfinfo返回图形图像文件信息语法:info=imfinfo(filename,fmt) \ info=imfinfo(filename)imread 从图像文件中读取(载入)图像语法:A=imread(filename,fmt) \ [X,map]=imread(filename,fmt) \ [...]=imread(filename) \ [...]=imread(URL,...) \ [...]=imread(...,idx) (CUR,ICO,and TIFF only) \[...]=imread(...,'frames',idx) (GIF only) \ [...]=imread(...,ref) (HDF only) \[...]=imread(...,'BackgroundColor',BG) (PNG only) \ [A,map,alpha] =imread(...) (ICO,CUR,PNG only)imwrite把图像写入(保存)图像文件中语法:imwrite(A,filename,fmt) \ imwrite(X,map,filename,fmt) \ imwrite(...,filename) \ imwite(...,Param1,Val1,Param2,Val2...)imcrop剪切图像语法:I2=imcrop(I) \ X2=imcrop(X,map) \ RGB2=imcrop(RGB) \ I2=imcrop(I,rect) \X2=imcrop(RGB,rect) \ [...]=imcrop(x,y,...) \ [A,rect]=imcrop(...) \ [x,y,A,rect]=imcrop(...)imresize 改变图像大小语法:B=imresize(A,m,method)imrotate 旋转图像语法:B=imrotate(A,angle,method) \ B=imrotate(A,angle,method,'crop')三、像素和统计处理函数corr2 计算两个矩形的二维相关系数语法:r=corr2(A,B)imcontour创建图像数据的轮廓图语法:imcontour(I,n) \ imcontour(I,v) \ imcontour(x,y,...) \ imcontour(...,LineSpec) \ [C,h] =imcontour(...)imfeature 计算图像区域的特征尺寸语法:stats=imfeature(L,measurements) \ stats=imfeature(L,measurements,n)imbist 显示图像数据的柱状图impixel 确定像素颜色值语法:P=impixel(I) \ P=impixel(X,map) \ P=impixel(RGB) \ P=impixel(I,c,r) \P=impixel(X,map,c,r) \ P=impixel(RGB,c,r) \ [c,r,P]=impixel(...) \ P=impixel(x,y,I,xi,yi) \ P=impixel(x,y,RGB,xi,yi) \ P=impixel(x,y,X,map,xi,yi) \[xi,yi,P]=impixel(x,y,...)improfile沿线段计算剖面图的像素值语法:c=improfile \ c=improfile(n) \ c=improfile(I,xi,yi) \ c=improfile(I,xi,yi,n)\ [cx,cy,c]=improfile(...) \ [cx,cy,c,xi,yi]=improfile(...) \ [...]=improfile(x,y,I,xi,yi)\ [...]=improfile(x,y,I,xi,yi,n) \ [...]=improfile(...,method)mean2计算矩阵元素的平均值语法:B=mean2(A)pixval显示图像像素信息语法:pixval onstd2 计算矩阵元素的标准偏移语法:b=std2(A)四、图像分析函数:edge 图像边缘检测语法:BW=edge(I,'sobel') \ BW=edge(I,'sobel',thresh) \ BW=edge(I,'sobel',thresh,direction) \ [BW,thresh]=edge(I,'sobel',...) \ BW=edge(I,'prewitt') \ BW=edge(I,'prewitt',thresh) \BW=edge(I,'prewitt',thresh,direction) \[BW,thresh]=edge(I,'prewitt',...) \ BW=edge(I,'roberts') \ BW=edge(I,'roberts',thresh)\ [BW,thresh]=edge(I,'roberts',...) \ BW=edge(I,'log') \ BW=edge(I,'log',thresh) \BW=edge(I,'log',thresh,sigma) \ [BW,threshold]=edge(I,'log',...) \BW=edge(I,'zerocross',thresh,h) \ [BW,thresh]=edge(I,'zerocross',...) \BW=edge(I,'canny') \ BW=edge(I,'canny',thresh) \ BW=edge(I,'canny',thresh,sigma) \ [BW,threshold]=edge(I,'canny',...)qtgetblk 获取四叉树分解的块值语法:[vals,r,c]=qtgetblk(I,S,dim) \ [vals,idx]=qtgetblk(I,S,dim)qtsetblk 设置四叉树分解中的块值语法:J=qtsetblk(I,S,dim,vals)五、图像增强函数histeq 用柱状图均等化增强对比语法:J=histeq(I,hgram) \ J=histeq(I,n) \ [J,T]=histeq(I,...) \ newmap=histeq(X,map,hgram) \ newmap=histeq(X,map)imadjust 调整图像灰度值或颜色映像表语法:J=imadjust(I,[low_in ,high_in]),[low_out ,high_out],gamma) \newmap=imadjust(map,[low_in ,high_in]),[low_out ,high_out],gamma) \RGB2=imadjust(RGB1,...)imnoise 增强图像的渲染效果语法:J=imnoise(I,type) \ J=imnoise(I,type,parameters)medfilt2 进行二维中值过滤语法:B=medfilt2(A,[m n]) \ B=medfilt2(A) \ B=medfilt2(A,'indexed',...)ordfilt2 进行二维统计顺序过滤语法:B=ordfilt2(A,order,domain) \ B=ordfilt2(A,order,domain,S) \ B=ordfilt2(...,padopt)wiener2进行二维适应性去噪过滤处理语法:J=wiener2(I,[m n],noise) \ [J,noise]=wiener2(I,[m n])六、线性滤波函数conv2 进行二维卷积操作语法:C=conv2(A,B) \ C=conv2(hcol,hrow,A) \ C=conv2(...,'shape')convmtx2 计算二维卷积矩阵语法:T=convmtx2(H,m,n) \ T=convmtx2(H,[m n])convn 计算n维卷积语法:C=convn(A,B) \ C=convn(A,B,'shape')filter2进行二维线性过滤操作语法:Y=filter2(h,X) \ Y=filter2(h,X,shape)fspecial创建预定义过滤器语法:h=fspecial(type) \ h=fspecial(type,parameters)七、线性二维滤波设计函数freqspace 确定二维频率响应的频率空间语法:[f1,f2]=freqspace(n) \ [f1,f2]=freqspace([m n]) \ [x1 ,y1]=freqspace(...,'meshgrid') \ f=freqspace(N) \ f=freqspace(N,'whole')freqz2 计算二维频率响应语法:[H,f1,f2]=freqz2(h,n1,n2) \ [H,fi,f2]]=freqz2(h,[n2,n1]) \ [H,fi,f2]]=freqz2(h,f1,f2]) \ [H,fi,f2]]=freqz2(h) \[...]=freqz2(h,...,[dx dy]) \ [...]=freqz2(h,...,dx) \ freqz2(...)fsamp2 用频率采样法设计二维FIR过滤器语法:h=fsamp2(Hd) \ h=fsamp2(f1,f2,Hd,[m n])ftrans2 通过频率转换设计二维FIR过滤器语法:h=ftrans2(b,t) \ h=ftrans2(b)fwind1 用一维窗口方法设计二维FIR过滤器语法:h=fwind1(Hd,win) \ h=fwind1(Hd,win1,win2) \ h=fwind1(f1,f2,Hd,...)fwind2 用二维窗口方法设计二维FIR过滤器语法:h=fwind2(Hd,win) \ h=fwind2(f1,f2,Hd,win)八、图像变换函数dct2进行二维离散余弦变换(反余弦变换用idct2)语法:B=dct2(A) \ B=dct2(A,m.n) \ B=dct2(A,[m n])dctmtx 计算离散余弦傅立叶变换语法:D=dctmtx(n)fft2 进行二维快速傅立叶变换(反变换用ifft2)语法:Y=fft2(X) \ Y=fft2(X,m,n)fftn 进行n维快速傅立叶变换(反变换用ifftn)语法:Y=ffn(X) \ Y=fftn(X,siz)fftshift 快速傅立叶变换的DC组件移到光谱中心语法:Y=fftshift(X) \ Y=fftshift(X,dim)iradon 进行反radon变换语法:I=iradon(P,theta) \ I=iradon(P,theta,interp,filter,d,n) \ [I,h]=iradon(...)phantom产生一个头部幻影图像语法:P=phantom(def,n) \ P=phantom(E,n) \ [P,E]=phantom(...)r adon 计算radon变换语法:R=radon(I,theta) \ [R,xp]=radon(...)九、边沿和块处理函数bestblk 确定进行块操作的块大小语法:siz=bestblk([m n],k) \ [mb,nb]=bestblk([m n],k)blkproc实现图像的显示块操作语法:B=blkproc(A,[m n]),fun) \ B=blkproc(A,[m n],fun,P1,P2,...) \ B=blkproc(A,[m n],[mborder nborder],fun,...)col2im 将矩阵的列重新组织到块中语法:A=col2im(B,[m n],[mm nn],block_type) \ A=col2im(B,[m n],[mm nn])colfilt 利用列相关函数进行边沿操作语法:B=colfilt(A,[m n],block_type,fun) \ B=colfilt(A,[m n],block_type,fun,P1,P2,...) \B=colfilt(A,[m n],[mblock nblock],...) \ B=colfilt(A,'indexed',...)im2col 重调图像块为列语法:B=im2col(A,[m n],block_type) \ B=im2col(A,[m n]) \ B=im2col(A,'indexed',...)nlfilter进行边沿操作语法:B=nlfilter(A,[m n],fun) \ B=nlfilter(A,[m n],fun,P1,P2,...) \ B=nlfilter(A,'indexed',...)十、二进制图像操作函数applylut 在二进制图像中利用lookup表进行行边沿操作语法:A=applylut(BW,LUT)bwarea 计算二进制图像对象的面积语法:total=bwarea(BW)bweuler 计算二进制图像的欧拉数语法:eul=bweuler(BW)bwfill 填充二进制图像的背景色语法:BW2=bwfill(BW1,c,r,n) \ BW2=bwfill(BW1,n) \ [BW2,idx]=bwfill(...) \BW2=bwfill(x,y,BW1,xi,yi,n) \ [x,y,BW2,idx,xi,yi]=bwfill(...)\ [BW2,idx]=bwfill(BW1,'holes',n)bwlabel标注二进制图像中已连接的部分语法:L=bwlabel(BW,n) \ [L,num]=bwlabel(BW,n)bwmorph提取二进制图像的轮廓语法:BW2=bwmorph(BW1,operation) \ BW2=bwmorph(BW1,operation,n)bwperim 计算二进制图像中对象的周长语法:BW2=bwperim(BW1) \ BW2=bwperim(BW1,CONN)bwselect 在二进制图像中选择对象语法:BW2=bwselect(BW1,c,r,n) \ BW2=bwselect(BW1,n) \ [BW2,idx]=bwselect(...) \ BW2=bwselect(x,y,BW1,xi,yi,n) \ [x,y,BW2,idx,xi,yi]=bwselect(...)dilate 放大二进制图像语法:BW2=dilate(BW1,SE) \ BW2=dilate(BW1,SE,alg) \ BW2=dilate(BW1,SE,...,n)erode弱化二进制图像的边界语法:BW2=erode(BW1,SE) \BW2=erode(BW1,SE,alg) \ BW2=erode(BW1,SE,...,n)makelut 创建一个用于applylut函数的lookup表语法:lut=makelut(fun,n) \ lut=makelut(fun,n,P1,P2,...)十一、区域处理函数roicolor 选择感兴趣的颜色区语法:BW=roicolor(A,low,high) \ BW=rocicolor(A,v)roifill 在图像的任意区域中进行平滑插补语法:J=roifill(I,c,r) \ J=roifill(I) \ J=roifill(I,BW) \ [J,BW]=roifill(...) \ J=roifill(x,y,I,xi,yi) \ [x,y,J,BW,xi,yi]=roifill(...)roifilt2 过滤敏感区域语法:J=roifilt2(h,I,BW) \ J=roifilt2(I,BW,fun) \ J=roifilt2(I,BW,fun,P1,P2,...)roipoly 选择一个敏感的多边形区域语法:BW=roipoly(I,c,r) \ BW=roipoly(I) \ BW=roipoly(x,y,I,xi,yi) \ [BW,xi,yi]=roipoly(...) \ [x,y,BW,xi,yi]=roipoly(...)十二、颜色映像处理函数brighten增加或降低颜色映像表的亮度语法:brighten(beta) \ brighten(h,beta) \ newmap=brighten(beta) \newmap=brighten(cmap,beta)cmpermute 调整颜色映像表中的颜色语法:[Y,newmap]=cmpermute(X,map) \ [Y,newmap]=cmpermute(X,map,index)cmunigue 查找颜色映像表中特定的颜色及相应的图像语法:[Y,newmap]=cmunigue(X,map) \ [Y,newmap]=cmunigue(RGB) \[Y,newmap]=cmunique(I)imapprox 对索引图像进行近似处理语法:[Y,newmap]=imapprox(X,map,n) \ [Y,newmap]=imapprox(X,map,tol) \ Y=imapprox(X,map,newmap) \[...]=imapprox(...,dither_option)rgbplot 划分颜色映像表语法:rgbplot(cmap)十三、颜色空间转换函数hsv2rgb转换HSV值为RGB颜色空间:M=hsv2rgb(H)ntsc2rgb 转换NTSC值为RGB颜色空间:rgbmap=ntsc2rgb(yiqmap) \RGB=ntsc2rgb(YIQ)rgb2hsv 转换RGB值为HSV颜色空间:cmap=rgb2hsv(M)rgb2ntsc转换RGB值为NTSC颜色空间:yiqmap=rgb2ntsc(rgbmap) \YIQ=rgb2ntsc(RGB)rgb2ycbcr 转换RGB值为YCbCr颜色空间:ycbcrmap=rgb2ycbcr(rgbmap) \ YCBCR=rgb2ycbcr(RGB)ycbcr2rgb 转化YCbCr值为RGB颜色空间:rgbmap=ycbcr2rgb(ycbcrmap) \ RGB=ycbcr2rgb(YCBCR)十四、图像类型和类型转换函数dither 通过抖动增加外观颜色分辨率转换图像语法:X=dither(RGB,map) \ BW=dither(I)gray2ind转换灰度图像为索引图像语法:[X,map]=gray2ind(I,n) \ [X,map]=gray2ind(BW,n)grayslice 从灰度图像为索引图像语法:X=grayslice(I,n) \ X=grayslice(I,v)im2bw转换图像为二进制图像语法:BW=im2bw(I,level) \ BW=im2bw(X,map,level) \ BW=im2bw(RGB,level) im2double 转换图像矩阵为双精度型语法:I2=im2double(I1) \ RGB2=im2double(RGB1) \ I=im2double(BW) \X2=im2double(X1,'indexed')double 转换数据为双精度型语法:double(X)unit8 、unit16转换数据为8位、16位无符号整型:i=unit8(x) \ i=unit16(x) im2unit8转换图像阵列为8位无符号整型语法:I2=im2unit8(I1) \ RGB2=im2unit8(RGB1) \ I=im2unit8(BW) \X2=im2unit8(X1,'indexed')im2unit16 转换图像阵列为16位无符号整型语法:I2=im2unit16(I1) \ RGB2=im2unit16(RGB1) \ I=im2unit16(BW) \X2=im2unit16(X1,'indexed')ind2gray 把检索图像转化为灰度图像语法:I=ind2gray(X,map)ind2rgb 转化索引图像为RGB真彩图像语法:RGB=ind2rgb(X,map)isbw 判断是否为二进制图像语法:flag=isbw(A)isgray判断是否为灰度图像语法:flag=isgray(A)isind 判断是否为索引图像语法:flag=isind(A)isrgb 判断是否为RGB真彩色图像语法:flag=isrgb(A)mat2gray 转换矩阵为灰度图像语法:I=mat2gray(A,[amin amax]) \ I=mat2gray(A)rgb2gray转换RGB图像或颜色映像表为灰度图像语法:I=rgb2gray(RGB) \ newmap=rgb2gray(map)rgb2ind 转换RGB图像为索引图像语法:[X,map]=rgb2ind(RGB,tol) \ [X,map]=rgb2ind(RGB,n) \ X=rgb2ind(RGB,map) \ [...]=rgb2ind(...,dither_option)十五、新增图像处理工具箱函数adapthisteq 限制对比度直方图均衡化: J=adapthisteq(I) \J=adapthisteq(I,param1,val1,param2,val2...)applycform 用于颜色空间变换out=applyform(I,C)bwboundaries描绘二进制图像边界语法: B=bwboundaries(BW) \ B=bwboundaries(BW,CONN) \B=bwboundaries(BW,CONN,options) [BW,CONN,options] \ [BL]=bwboundaries(...) \ [BLNA]=bwboundaries()bwtraceboundary 描述二进制图像中的物体B=bwtraceboundary(BW,P,fstep) \ B=bwtraceboundary(BW,P,fstep,CONN) \B=bwtraceboundary(...N,dir)decorrstrech 对多通道图像进行去相关处理语法:S=decorrstretch(I) \ S=decorrstretch(I,TOL)dicomdict 获取或读取DICOM文件语法:dicomdict('set',dictionary) \ dictionary=dicomdict('get')getline用鼠标选择ployline语法:[x,y]=getline(fig) \ [x,y]=getline(ax) \ [x,y]=getline \ [x,y]=getline(...,'closed') getpts用鼠标选择像素点语法:[x,y]=getpts(fig) \ [x,y]=getpts(ax) \ [x,y]=getptsgetrect 用鼠标选择矩阵语法:rect=getrect(fig) \ rect=getrect(ax) \ rect=getrect(fig)iccread 读取ICC剖面语法:P=iccread(filename)im2java2d 将图像转换为Java缓冲图像语法:jimage=im2java2d(I) \ jimage=im2java2d(X,MAP)imview 在图像与蓝旗中显示图像语法:imview(I) \ imview(RGB) \ imview(X,map) \imview(I,range) \ imview(filename) \ imview(....'InitialMagnification',initial_mag) \ h=imview(...) \ imview close allippl 检查IPPL的存在语法:TF=ippl \ [TF B]=ippliptdemos显示图像处理工具箱中的索引图像lab2double、lab2unit16、lab2unit8 将L*a*b数据分别转换为双精度、16位数据、8位数据makecform 创造一个色彩转换结构poly2mask 把多边形区域转换成mask区域语法:BW=poly2mask(x,y,m,n)unitlut 查找表中A像素值语法:B=unitlut(A,LUT)xyz2double、xyz2unit16 将颜色数据从XYZ转换到双精度、16进制。

MATLAB图像处理函数汇总(二)

MATLAB图像处理函数汇总(二)

MATLAB图像处理函数汇总(⼆)60.imnoise功能:增加图像的渲染效果.语法:J = imnoise(I,type)J = imnoise(I,type,parameters)举例I = imread('eight.tif');J = imnoise(I,'salt & pepper',0.02);imshow(I)figure, imshow(J)相关命令:rand61.impixel功能:确定像素颜⾊值.语法:MATLAB⾼级应⽤——图形及影像处理 348P = impixel(I)P = impixel(X,map)P = impixel(RGB)P = impixel(Incur)P = impixel(X,map,c,r)P = impixel(RGB,c,r)[carp] = impixel(...)P = impixel(x,y,I,xi,yi)P = impixel(x,y,X,map,xi,yi)P = impixel(x,y,RGB,xi,yi)[xi,yi,P] = impixel(x,y,...)举例RGB = imread('flowers.tif');c = [12 146 410];r = [104 156 129];pixels = impixel(RGB,c,r)pixels =61 59 101253 240 0237 37 44相关命令:improfile, pixval62.improfile功能:沿线段计算剖⾯图的像素值.语法:c = improfilec = improfile(n)c = improfile(I,xi,yi)c = improfile(I,xi,yi,n)[cx,cy,c] = improfile(...)[cx,cy,c,xi,yi] = improfile(...)[...] = improfile(x,y,I,xi,yi)[...] = improfile(x,y,I,xi,yi,n)附录 MATLAB图像处理命令 349[...] = improfile(...,method)举例I = imread('alumgrns.tif');x = [35 338 346 103];y = [253 250 17 148];improfile(I,x,y), grid on相关命令:impixel, pixval63.imread功能:从图形⽂件中读取图像.语法:A = imread(filename,fmt)[X,map] = imread(filename,fmt)[...] = imread(filename)[...] = imread(...,idx) (TIFF only)[...] = imread(...,ref) (HDF only)[...] = imread(...,'BackgroundColor',BG) (PNG only) [A,map,alpha] = imread(...) (PNG only)举例[X,map] = imread('flowers.tif',6);info = imfinfo('skull.hdf');[X,map] = imread('skull.hdf',info(4).Reference);bg = [255 0 0];A = imread('image.png','BackgroundColor',bg); MATLAB⾼级应⽤——图形及影像处理 350 [A,map,alpha] = imread('image.png');相关命令:imfinfo, imwrite,fread,double,uint8,uint1664.imresize功能:改变图像⼤⼩.语法:B = imresize(A,m,method)B = imresize(A,[mrows ncols],method)B = imresize(...,method,n)B = imresize(...,method,h)65.imrotate功能:旋转图像.语法:B = imrotate(A,angle,method)B = imrotate(A,angle,method,'crop')举例I = imread('ic.tif');J = imrotate(I,-4,'bilinear','crop');imshow(I)figure, imshow(J)相关命令:imcrop, imresize66.imshow功能:显⽰图像.语法:附录 MATLAB图像处理命令 351imshow(I,n)imshow(I,[low high])imshow(BW)imshow(X,map)imshow(RGB)imshow(...,display_option)imshow(x,y,A,...)imshow filenameh = imshow(...)相关命令:getimage, imread, iptgetpref, iptsetpref, subimage, truesize, warp 67.imwrite功能:把图像写⼊图形⽂件中.语法:imwrite(A,filename,fmt)imwrite(X,map,filename,fmt)imwrite(...,filename)imwrite(...,Param1,Val1,Param2,Val2...)举例imwrite(X,map,'flowers.hdf','Compression','none',... 'WriteMode','append')相关命令:imfinfo, imread68.ind2gray功能:把检索图像转化为灰度图像.语法:I = ind2gray(X,map)举例load treesI = ind2gray(X,map);imshow(X,map)figure,imshow(I)MATLAB⾼级应⽤——图形及影像处理 352相关命令:gray2ind, imshow, rgb2ntsc69.ind2rgb功能:转化索引图像为RGB真彩图像.语法:RGB = ind2rgb(X,map)相关命令:ind2gray, rgb2ind70.iptgetpref功能:获取图像处理⼯具箱参数设置.语法:value = iptgetpref(prefname)举例value = iptgetpref('ImshowAxesVisible')value =off相关命令:imshow, iptsetpref71.iptsetpref功能:设置图像处理⼯具箱参数.语法:iptsetpref(prefname,value)举例iptsetpref('ImshowBorder','tight')相关命令:imshow, iptgetpref, truesize72.iradon附录 MATLAB图像处理命令 353功能:进⾏反Radon变换.语法:I = iradon(P,theta)I = iradon(P,theta,interp,filter,d,n)[I,h] = iradon(...)举例P = phantom(128);R = radon(P,0:179);I = iradon(R,0:179,'nearest','Hann'); imshow(P)figure, imshow(I)相关命令:radon, phantom73.isbw功能:判断是否为⼆进制图像.语法:flag = isbw(A)相关命令:isind, isgray, isrgb74.isgray功能:判断是否为灰度图像.语法:flag = isgray(A)相关命令:isbw, isind, isrgb75.isindMATLAB⾼级应⽤——图形及影像处理 354功能:判断是否为索引图像.语法:flag = isind(A)相关命令:isbw, isgray, isrgb76.isrgb功能:判读是否为RGB真彩图像.语法:flag = isrgb(A)相关命令:isbw, isgray, isind77.makelut功能:创建⼀个⽤于applylut函数的lookup表.语法:lut = makelut(fun,n)lut = makelut(fun,n,P1,P2,...)举例f = inline('sum(x(:)) >= 2');lut = makelut(f,2)lut =111111111附录 MATLAB图像处理命令 35511相关命令:applylut78.mat2gray功能:转化矩阵为灰度图像.语法:I = mat2gray(A,[amin amax])I = mat2gray(A)举例I = imread('rice.tif');J = filter2(fspecial('sobel'),I);K = mat2gray(J);imshow(I)figure, imshow(K)相关命令:gray2ind79.mean2功能:计算矩阵元素的平均值.语法:b = mean2(A)相关命令:std2, mean, std80.medfilt2功能:进⾏⼆维中值过滤.语法:MATLAB⾼级应⽤——图形及影像处理 356 B = medfilt2(A,[m n])B = medfilt2(A)B = medfilt2(A,'indexed',...)举例I = imread('eight.tif');J = imnoise(I,'salt & pepper',0.02);K = medfilt2(J);imshow(J)figure, imshow(K)相关命令:filter2, ordfilt2, wiener281.montage功能:在矩形框中同时显⽰多幅图像.语法:montage(I)montage(BW)montage(X,map)montage(RGB)h = montage(...)举例montage(D,map)附录 MATLAB图像处理命令 357相关命令:immovie82.nlfilter功能:进⾏边沿操作.语法:B = nlfilter(A,[m n],fun)B = nlfilter(A,[m n],fun,P1,P2,...)B = nlfilter(A,'indexed',...)举例B = nlfilter(A,[3 3],'median(x(:))');相关命令:blkproc, colfilt83.ntsc2rgb功能: 转换NTSC的值为RGB颜⾊空间.语法:rgbmap = ntsc2rgb(yiqmap)RGB = ntsc2rgb(YIQ)相关命令:rgb2ntsc, rgb2ind, ind2rgb, ind2gray84.ordfilt2功能:进⾏⼆维统计顺序过滤.语法:B = ordfilt2(A,order,domain)B = ordfilt2(A,order,domain,S)MATLAB⾼级应⽤——图形及影像处理 358 B = ordfilt2(...,padopt)相关命令:medfilt285.phantom功能:产⽣⼀个头部幻影图像.语法:P = phantom(def,n)P = phantom(E,n)[P,E] = phantom(...)举例P = phantom('Modified Shepp-Logan',200);相关命令:radon, iradon86.pixval功能:显⽰图像像素信息.语法:pixval onpixval offpixvalpixval(fig,option)相关命令:impixel, improfile87.qtdecomp功能:进⾏四叉树分解.附录 MATLAB图像处理命令 359语法:S = qtdecomp(I)S = qtdecomp(I,threshold)S = qtdecomp(I,threshold,mindim)S = qtdecomp(I,threshold,[mindim maxdim]) S = qtdecomp(I,fun)S = qtdecomp(I,fun,P1,P2,...)举例I = [1 1 1 1 2 3 6 61 12 1 4 5 6 81 1 1 1 10 15 7 71 1 1 1 20 25 7 720 22 20 22 1 2 3 420 22 22 20 5 6 7 820 22 20 20 9 10 11 1222 22 20 20 13 14 15 16];S = qtdecomp(I,5);full(S)ans =4 0 0 0 2 0 2 00 0 0 0 0 0 0 00 0 0 0 1 1 2 00 0 0 0 1 1 0 04 0 0 0 2 0 2 00 0 0 0 2 0 2 00 0 0 0 0 0 0 0相关命令:qtgetblk, qtsetblk88.qtgetblk功能:获取四叉树分解中的块值.语法:[vals,r,c] = qtgetblk(I,S,dim)MATLAB⾼级应⽤——图形及影像处理 360 [vals,idx] = qtgetblk(I,S,dim)举例[vals,r,c] = qtgetblk(I,S,4)vals(:,:,1) =1 1 1 11 12 11 1 1 11 1 1 1vals(:,:,2) =20 22 20 2220 22 22 2020 22 20 2022 22 20 20r =15c =11相关命令:qtdecomp, qtsetblk89.qtsetblk功能:设置四叉树分解中的块值.语法:J = qtsetblk(I,S,dim,vals)举例newvals = cat(3,zeros(4),ones(4));J = qtsetblk(I,S,4,newvals)J =0 0 0 0 2 3 6 60 0 0 0 4 5 6 80 0 0 0 10 15 7 7附录 MATLAB图像处理命令 3610 0 0 0 20 25 7 71 1 1 1 123 41 1 1 1 5 6 7 81 1 1 1 9 10 11 121 1 1 1 13 14 15 16相关命令:qtdecomp, qtgetblk90.radon功能: 计算Radon变换.语法:R = radon(I,theta)R = radon(I,theta,n)[R,xp] = radon(...)举例iptsetpref('ImshowAxesVisible','on')I = zeros(100,100);I(25:75,25:75) = 1;theta = 0:180;[R,xp] = radon(I,theta);imshow(theta,xp,R,[]), colormap(hot), colorbar 相关命令:iradon, phantom91.rgb2gray功能: 转换RGB图像或颜⾊映像表为灰度图像.语法:I = rgb2gray(RGB)newmap = rgb2gray(map)相关命令:MATLAB⾼级应⽤——图形及影像处理 362 ind2gray, ntsc2rgb, rgb2ind, rgb2ntsc92.rgb2hsv功能: 转化RGB值为HSV颜⾊空间.语法:hsvmap = rgb2hsv(rgbmap)HSV = rgb2hsv(RGB)相关命令:hsv2rgb, rgbplot93.rgb2ind功能: 转化RGB图像为索引图像.语法:[X,map] = rgb2ind(RGB,tol)[X,map] = rgb2ind(RGB,n)X = rgb2ind(RGB,map)[...] = rgb2ind(...,dither_option)举例RGB = imread('flowers.tif');[X,map] = rgb2ind(RGB,128);imshow(X,map)相关命令:cmunique, dither, imapprox, ind2rgb, rgb2gray 94.rgb2ntsc功能: 转化RGB的值为NTSC颜⾊空间.语法:yiqmap = rgb2ntsc(rgbmap)YIQ = rgb2ntsc(RGB)附录 MATLAB图像处理命令 363相关命令:ntsc2rgb, rgb2ind, ind2rgb, ind2gray95.rgb2ycbcr功能: 转化RGB的值为YcbCr颜⾊空间.语法:ycbcrmap = rgb2ycbcr(rgbmap)YCBCR = rgb2ycbcr(RGB)相关命令:ntsc2rgb, rgb2ntsc, ycbcr2rgb96.rgbplot功能:划分颜⾊映像表.语法:rgbplot(map)举例rgbplot(jet)相关命令:colormap97.roicolor功能:选择感兴趣的颜⾊区.语法:BW = roicolor(A,low,high)BW = roicolor(A,v)举例I = imread('rice.tif');BW = roicolor(I,128,255);imshow(I);MATLAB⾼级应⽤——图形及影像处理 364 figure, imshow(BW)相关命令:roifilt2, roipoly98.roifill功能:在图像的任意区域中进⾏平滑插补.语法:J = roifill(Incur)J = roifill(I)J = roifill(I,BW)[J,BW] = roifill(...)J = roifill(x,y,I,xi,yi)[x,y,J,BW,xi,yi] = roifill(...)举例I = imread('eight.tif');c = [222 272 300 270 221 194];r = [21 21 75 121 121 75];J = roifill(Incur);imshow(I)figure, imshow(J)附录 MATLAB图像处理命令 365相关命令:roifilt2, roipoly99.roifilt2功能:过滤敏感区域.语法:J = roifilt2(h,I,BW)J = roifilt2(I,BW,fun)J = roifilt2(I,BW,fun,P1,P2,...)举例h = fspecial('unsharp');J = roifilt2(h,I,BW);imshow(J)相关命令:filter2, roipoly100.roipoly功能:选择⼀个敏感的多边形区域.语法:BW = roipoly(Incur)BW = roipoly(I)BW = roipoly(x,y,I,xi,yi)[BW,xi,yi] = roipoly(...)[x,y,BW,xi,yi] = roipoly(...)举例I = imread('eight.tif');c = [222 272 300 270 221 194];r = [21 21 75 121 121 75];BW = roipoly(Incur);imshow(I)MATLAB⾼级应⽤——图形及影像处理 366 figure, imshow(BW)相关命令:roifilt2, roicolor, roifill101.std2功能:计算矩阵元素的标准偏移.语法:b = std2(A)相关命令:corr2, mean2102.subimage功能:在⼀幅图中显⽰多个图像.语法:subimage(X,map)subimage(I)subimage(BW)subimage(RGB)subimage(x,y,...)h = subimage(...)举例load trees[X2,map2] = imread('forest.tif');subplot(1,2,1), subimage(X,map)subplot(1,2,2), subimage(X2,map2)相关命令:附录 MATLAB图像处理命令 367103.truesize功能:调整图像显⽰尺⼨.语法:truesize(fig,[mrows mcols])truesize(fig)相关命令:imshow, iptsetpref, iptgetpref104.uint8功能:转换数据为8位⽆符号整型.语法:B = uint8(A)举例a = [1 3 5];b = uint8(a);whosName Size Bytes Classa 1x3 24 doublearrayb 1x3 3 uint8 array相关命令:double, im2double, im2uint8105.uint16功能:转换数据为16位⽆符号整型.语法:I = uint16(X)MATLAB⾼级应⽤——图形及影像处理 368举例a = [1 3 5];b = uint16(a);whosName Size Bytes Classa 1x3 24 double arrayb 1x3 6 uint16 array相关命令:double, datatypes, uint8, uint32, int8, int16, int32.106.warp功能:将图像显⽰到纹理映射表⾯.语法:warp(X,map)warp(I,n)warp(BW)warp(RGB)warp(z,...)warp(x,y,z,...)h = warp(...)举例[x,y,z] = cylinder;I = imread('testpat1.tif');warp(x,y,z,I);相关命令:imshow附录 MATLAB图像处理命令 369 107.wiener2功能:进⾏⼆维适应性去噪过滤处理.语法:J = wiener2(I,[m n],noise)[J,noise] = wiener2(I,[m n])举例I = imread('saturn.tif');J = imnoise(I,'gaussian',0,0.005);K = wiener2(J,[5 5]);imshow(J)figure, imshow(K)相关命令:filter2, medfilt2108.ycbcr2rgb功能: 转化YcbCr值为RGB颜⾊空间.语法:rgbmap = ycbcr2rgb(ycbcrmap) RGB = ycbcr2rgb(YCBCR)相关命令:ntsc2rgb, rgb2ntsc, rgb2ycbcr 109.zoom功能:缩放图像.语法:zoom onzoom offzoom outMATLAB⾼级应⽤——图形及影像处理 370 zoom resetzoomzoom xonzoom yonzoom(factor)zoom(fig,option)相关命令:imcrop。

MATLAB中图像函数大全 详解及例子

MATLAB中图像函数大全 详解及例子

图像处理函数详解——strel功能:用于膨胀腐蚀及开闭运算等操作的结构元素对象(本论坛随即对膨胀腐蚀等操作进行讲解)。

用法:SE = strel(shape,parameters)创建由指定形状shape对应的结构元素。

其中shape的种类有arbitrary''pair''diamond''periodicline''disk''rectangle''line''square''octagon参数parameters一般控制SE的大小。

例子:se1 = strel('square',6)% 创建6*6的正方形se2 = strel('line',10,45)% 创建直线长度10,角度45se3 = strel('disk',15)% 创建圆盘半径15se4 = strel('ball',15,5)% 创建椭圆体,半径15,高度5图像处理函数详解——roipoly功能:用于选择图像中的多边形区域。

用法:BW = roipoly(I,c,r)BW = roipoly(I)BW = roipoly(x,y,I,xi,yi)[BW,xi,yi] = roipoly(...)[x,y,BW,xi,yi] = roipoly(...)BW = roipoly(I,c,r)表示用向量c、r指定多边形各点的X、Y坐标。

BW选中的区域为1,其他部分的值为0.BW = roipoly(I)表示建立交互式的处理界面。

BW = roipoly(x,y,I,xi,yi)表示向量x和y建立非默认的坐标系,然后在指定的坐标系下选择由向量xi,yi指定的多边形区域。

例子:I = imread('eight.tif');c = [222 272 300 270 221 194];r = [21 21 75 121 121 75];BW = roipoly(I,c,r);imshow(I)figure, imshow(BW)图像处理函数详解——roifilt2功能:用于对一个区域进行滤波。

matlab工具箱中关于数学形态学运算的函数

matlab工具箱中关于数学形态学运算的函数

matlab工具箱中关于数学形态学运算的函数Matlab中的Image Processing Toolbox提供了丰富的数学形态学函数,用于处理图像和二值图像。

以下是一些常用的数学形态学函数:1.膨胀:-函数:`imdilate`-作用:对二值图像中的白色区域进行膨胀操作,增加区域的大小。

2.腐蚀:-函数:`imerode`-作用:对二值图像中的白色区域进行腐蚀操作,减小区域的大小。

3.开运算:-函数:`imopen`-作用:先腐蚀后膨胀,用于去除小对象并平滑物体边缘。

4.闭运算:-函数:`imclose`-作用:先膨胀后腐蚀,用于填充小孔并平滑物体边缘。

5.击中击不中变换:-函数:`bwhitmiss`-作用:应用击中和击不中的结构元素来寻找特定的图像模式。

6.骨架提取:-函数:`bwmorph`中的`skel`-作用:提取二值图像中的骨架。

7.断裂点连接:-函数:`bwmorph`中的`breakpoints`-作用:连接断裂的骨架。

8.区域填充:-函数:`imfill`-作用:填充图像中的孔洞,将连通区域标记为白色。

9.区域标记:-函数:`bwlabel`、`bwconncomp`-作用:标记二值图像中的连通区域,分配不同的标签。

10.区域属性分析:-函数:`regionprops`-作用:计算和分析图像中的区域属性,如面积、周长、中心位置等。

这些函数在图像处理中起着重要作用,帮助用户进行形态学操作,提取图像特征,进行对象分析等。

你可以通过Matlab的帮助文档详细了解每个函数的使用方法和参数。

Matlab图像处理工具箱中部分函数用法

Matlab图像处理工具箱中部分函数用法

1. blkproc( )用法blkproc功能:对图像进行分块处理调用形式: B = blkproc(A,[m n],fun, parameter1, parameter2, ...)B = blkproc(A,[m n],[mborder nborder],fun,...)B = blkproc(A,'indexed',...)参数解释:[m n] :图像以m*n为分块单位,对图像进行处理(如8像素*8像素)Fun:应用此函数对分别对每个m*n分块的像素进行处理parameter1, parameter2:要传给fun函数的参数mborder nborder:对每个m*n块上下进行mborder个单位的扩充,左右进行nborder个单位的扩充,扩充的像素值为0,fun函数对整个扩充后的分块进行处理。

这里:fun='P1*x*P2',fun的参数P1,P2,将T,T'传递给fun的参数,即:P1= T,P2=T'.2.dwt2( )用法d wt2功能:单级二维离散小波变换调用格式: [cA,cH,cV,cD] = dwt2(X,'wname')[cA,cH,cV,cD] = dwt2(X,Lo_D,Hi_D)其意义为使用指定的小波基函数'wname'对二维信号X进行二维离散小波变换。

cA,cH,cV,cD分别为近似细节分量、水平细节分量、垂直细节分量和对角细节分量。

3.wavedec2( )用法waveder2功能:二维信号的多层小波分解调用格式:[C,S] = wavedec2(X,N,'wname')[C,S] = wavedec2(X,N,Lo_D,Hi_D)其意义为使用小波基函数'wname'对二维信号X进行N层分解。

4.idwt2( )用法idwt2功能:单级二维离散小波反变换调用格式:X = idwt2(cA,cH,cV,cD,'wname')X = idwt2(cA,cH,cV,cD,Lo_R,Hi_R)X = idwt2(cA,cH,cV,cD,'wname',S)X = idwt2(cA,cH,cV,cD,Lo_R,Hi_R,S)X = idwt2(...,'mode',MODE)其意义为由信号小波分解的近似信号cA和细节信号cH,cV,cD经小波反变换重构原信号X。

使用Matlab进行图像处理的常用函数介绍

使用Matlab进行图像处理的常用函数介绍

使用Matlab进行图像处理的常用函数介绍引言:图像处理是计算机科学和电子工程领域中的重要分支,它利用数字技术对图像进行各种操作和改变,以实现图像的增强、分割、恢复等目标。

而Matlab作为一种功能强大的科学计算软件,被广泛应用于图像处理领域。

本文将介绍几个常用的Matlab图像处理函数,并结合实例进行详解。

一、图像读取与显示函数1. imread函数imread函数是Matlab中用于读取图像的函数,它可以读取各种图像格式(如JPEG、PNG、BMP等)的图像文件,并将其转换为Matlab中的矩阵形式。

示例:```img = imread('image.jpg');```2. imshow函数imshow函数用于在Matlab中显示图像,它可以接受矩阵形式的图像作为输入,并在新窗口中显示出来。

此外,imshow函数还可以对显示的图像进行一些调整,如调整图像的亮度、对比度等参数。

示例:```imshow(img); % 显示读取的图像```二、图像增强函数1. imadjust函数imadjust函数可以调整图像的亮度和对比度,以增强图像的视觉效果。

它通过对图像的像素值进行映射,将原始图像灰度值的范围进行调整,从而使图像的显示效果更好。

示例:```img_adjusted = imadjust(img, [0.2 0.8], [0 1]);```2. histeq函数histeq函数可以进行直方图均衡化处理,使图像的像素值在不同灰度级之间更均匀分布,从而增强图像的对比度和细节。

示例:```img_equalized = histeq(img);```三、图像滤波函数1. imfilter函数imfilter函数实现了不同类型的图像滤波算法,包括平滑滤波、锐化滤波等。

它可以对图像的每个像素点进行卷积运算,以消除噪声、增强边缘等。

示例:```filter = fspecial('average', [5 5]); % 创建一个平滑滤波器img_filtered = imfilter(img, filter); % 对图像进行平滑滤波```2. medfilt2函数medfilt2函数是一种中值滤波算法,它可以有效地去除图像中的椒盐噪声、脉冲噪声等。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一、通用函数:colorbar显示彩色条语法:colorbar \ colorbar('vert') \ colorbar('horiz') \ colorbar(h) \ h=colorbar(...) \ colorbar(...,'peer',axes_handle)getimage 从坐标轴取得图像数据语法:A=getimage(h) \ [x,y,A]=getimage(h) \ [...,A,flag]=getimage(h) \ [...]=getimageimshow 显示图像语法:imshow(I,n) \ imshow(I,[low high]) \ imshow(BW) \ imshow(X,map) \ imshow(RGB)\ imshow(...,display_option) \ imshow(x,y,A,...) \ imshow filename \ h=imshow(...)montage 在矩形框中同时显示多幅图像语法:montage(I) \ montage(BW) \ montage(X,map) \ montage(RGB) \ h=montage(...)immovie 创建多帧索引图的电影动画语法:mov=immovie(X,map) \ mov=immovie(RGB)subimage 在一副图中显示多个图像语法:subimage(X,map) \ subimage(I) \ subimage(BW) \ subimage(RGB) \ subimage(x,y,...) \ subimage(...)truesize 调整图像显示尺寸语法:truesize(fig,[mrows mcols]) \ truesize(fig)warp 将图像显示到纹理映射表面语法:warp(X,map) \ warp(I ,n) \ warp(z,...) warp(x,y,z,...) \ h=warp(...) zoom 缩放图像语法:zoom on \ zoom off \ zoom out \ zoom reset \ zoom \ zoom xon \ zoom yon\ zoom(factor) \ zoom(fig,option)二、图像文件I/O函数命令imfinfo 返回图形图像文件信息语法:info=imfinfo(filename,fmt) \ info=imfinfo(filename)imread 从图像文件中读取(载入)图像语法:A=imread(filename,fmt) \ [X,map]=imread(filename,fmt) \[...]=imread(filename) \ [...]=imread(URL,...) \ [...]=imread(...,idx) (CUR,ICO,and TIFF only) \ [...]=imread(...,'frames',idx) (GIF only) \ [...]=imread(...,ref) (HDF only) \ [...]=imread(...,'BackgroundColor',BG) (PNG only) \ [A,map,alpha] =imread(...) (ICO,CUR,PNG only)imwrite 把图像写入(保存)图像文件中语法:imwrite(A,filename,fmt) \ imwrite(X,map,filename,fmt) \ imwrite(...,filename) \ imwite(...,Param1,Val1,Param2,Val2...)imcrop 剪切图像语法:I2=imcrop(I) \ X2=imcrop(X,map) \ RGB2=imcrop(RGB) \ I2=imcrop(I,rect) \ X2=imcrop(RGB,rect) \ [...]=imcrop(x,y,...) \ [A,rect]=imcrop(...) \ [x,y,A,rect]=imcrop(...)imresize 改变图像大小语法:B=imresize(A,m,method)imrotate 旋转图像语法:B=imrotate(A,angle,method) \ B=imrotate(A,angle,method,'crop')三、像素和统计处理函数corr2 计算两个矩形的二维相关系数语法:r=corr2(A,B)imcontour 创建图像数据的轮廓图语法:imcontour(I,n) \ imcontour(I,v) \ imcontour(x,y,...) \ imcontour(...,LineSpec) \ [C,h] =imcontour(...)imfeature 计算图像区域的特征尺寸语法:stats=imfeature(L,measurements) \ stats=imfeature(L,measurements,n)imbist 显示图像数据的柱状图impixel 确定像素颜色值语法:P=impixel(I) \ P=impixel(X,map) \ P=impixel(RGB) \ P=impixel(I,c,r) \ P=impixel(X,map,c,r) \ P=impixel(RGB,c,r) \ [c,r,P]=impixel(...) \ P=impixel(x,y,I,xi,yi) \ P=impixel(x,y,RGB,xi,yi) \ P=impixel(x,y,X,map,xi,yi) \[xi,yi,P]=impixel(x,y,...)improfile 沿线段计算剖面图的像素值语法:c=improfile \ c=improfile(n) \ c=improfile(I,xi,yi) \ c=improfile(I,xi,yi,n) \ [cx,cy,c]=improfile(...) \ [cx,cy,c,xi,yi]=improfile(...) \ [...]=improfile(x,y,I,xi,yi) \ [...]=improfile(x,y,I,xi,yi,n) \ [...]=improfile(...,method)mean2 计算矩阵元素的平均值语法:B=mean2(A)pixval 显示图像像素信息语法:pixval onstd2 计算矩阵元素的标准偏移语法:b=std2(A)四、图像分析函数:edge 图像边缘检测语法:BW=edge(I,'sobel') \ BW=edge(I,'sobel',thresh) \ BW=edge(I,'sobel',thresh,direction) \ [BW,thresh]=edge(I,'sobel',...) \ BW=edge(I,'prewitt') \ BW=edge(I,'prewitt',thresh) \ BW=edge(I,'prewitt',thresh,direction) \[BW,thresh]=edge(I,'prewitt',...) \ BW=edge(I,'roberts') \ BW=edge(I,'roberts',thresh) \ [BW,thresh]=edge(I,'roberts',...) \ BW=edge(I,'log') \ BW=edge(I,'log',thresh) \ BW=edge(I,'log',thresh,sigma) \ [BW,threshold]=edge(I,'log',...) \ BW=edge(I,'zerocross',thresh,h) \ [BW,thresh]=edge(I,'zerocross',...) \ BW=edge(I,'canny') \ BW=edge(I,'canny',thresh) \ BW=edge(I,'canny',thresh,sigma) \ [BW,threshold]=edge(I,'canny',...) qtgetblk 获取四叉树分解的块值语法:[vals,r,c]=qtgetblk(I,S,dim) \ [vals,idx]=qtgetblk(I,S,dim) qtsetblk 设置四叉树分解中的块值语法:J=qtsetblk(I,S,dim,vals)五、图像增强函数histeq 用柱状图均等化增强对比语法:J=histeq(I,hgram) \ J=histeq(I,n) \ [J,T]=histeq(I,...) \ newmap=histeq(X,map,hgram) \ newmap=histeq(X,map)imadjust 调整图像灰度值或颜色映像表语法:J=imadjust(I,[low_in ,high_in]),[low_out ,high_out],gamma) \ newmap=imadjust(map,[low_in ,high_in]),[low_out ,high_out],gamma) \ RGB2=imadjust(RGB1,...)imnoise 增强图像的渲染效果语法:J=imnoise(I,type) \ J=imnoise(I,type,parameters)medfilt2 进行二维中值过滤语法:B=medfilt2(A,[m n]) \ B=medfilt2(A) \ B=medfilt2(A,'indexed',...) ordfilt2 进行二维统计顺序过滤语法:B=ordfilt2(A,order,domain) \ B=ordfilt2(A,order,domain,S) \ B=ordfilt2(...,padopt)wiener2 进行二维适应性去噪过滤处理语法:J=wiener2(I,[m n],noise) \ [J,noise]=wiener2(I,[m n])六、线性滤波函数conv2 进行二维卷积操作语法:C=conv2(A,B) \ C=conv2(hcol,hrow,A) \ C=conv2(...,'shape') convmtx2 计算二维卷积矩阵语法:T=convmtx2(H,m,n) \ T=convmtx2(H,[m n])convn 计算n维卷积语法:C=convn(A,B) \ C=convn(A,B,'shape')filter2 进行二维线性过滤操作语法:Y=filter2(h,X) \ Y=filter2(h,X,shape)fspecial 创建预定义过滤器语法:h=fspecial(type) \ h=fspecial(type,parameters)七、线性二维滤波设计函数freqspace 确定二维频率响应的频率空间语法:[f1,f2]=freqspace(n) \ [f1,f2]=freqspace([m n]) \ [x1 ,y1]=freqspace(...,'meshgrid') \ f=freqspace(N) \ f=freqspace(N,'whole') freqz2 计算二维频率响应语法:[H,f1,f2]=freqz2(h,n1,n2) \ [H,fi,f2]]=freqz2(h,[n2,n1]) \[H,fi,f2]]=freqz2(h,f1,f2]) \ [H,fi,f2]]=freqz2(h) \[...]=freqz2(h,...,[dx dy]) \ [...]=freqz2(h,...,dx) \ freqz2(...)fsamp2 用频率采样法设计二维FIR过滤器语法:h=fsamp2(Hd) \ h=fsamp2(f1,f2,Hd,[m n])ftrans2 通过频率转换设计二维FIR过滤器语法:h=ftrans2(b,t) \ h=ftrans2(b)fwind1 用一维窗口方法设计二维FIR过滤器语法:h=fwind1(Hd,win) \ h=fwind1(Hd,win1,win2) \ h=fwind1(f1,f2,Hd,...)fwind2 用二维窗口方法设计二维FIR过滤器语法:h=fwind2(Hd,win) \ h=fwind2(f1,f2,Hd,win)八、图像变换函数dct2 进行二维离散余弦变换(反余弦变换用idct2)语法:B=dct2(A) \ B=dct2(A,m.n) \ B=dct2(A,[m n])dctmtx 计算离散余弦傅立叶变换语法:D=dctmtx(n)fft2 进行二维快速傅立叶变换(反变换用ifft2)语法:Y=fft2(X) \ Y=fft2(X,m,n)fftn 进行n维快速傅立叶变换(反变换用ifftn)语法:Y=ffn(X) \ Y=fftn(X,siz)fftshift 快速傅立叶变换的DC组件移到光谱中心语法:Y=fftshift(X) \ Y=fftshift(X,dim)iradon 进行反radon变换语法:I=iradon(P,theta) \ I=iradon(P,theta,interp,filter,d,n) \ [I,h]=iradon(...)phantom 产生一个头部幻影图像语法:P=phantom(def,n) \ P=phantom(E,n) \ [P,E]=phantom(...) radon 计算radon变换语法:R=radon(I,theta) \ [R,xp]=radon(...)九、边沿和块处理函数bestblk 确定进行块操作的块大小语法:siz=bestblk([m n],k) \ [mb,nb]=bestblk([m n],k)blkproc 实现图像的显示块操作语法:B=blkproc(A,[m n]),fun) \ B=blkproc(A,[m n],fun,P1,P2,...) \ B=blkproc(A,[m n],[mborder nborder],fun,...)col2im 将矩阵的列重新组织到块中语法:A=col2im(B,[m n],[mm nn],block_type) \ A=col2im(B,[m n],[mm nn])colfilt 利用列相关函数进行边沿操作语法:B=colfilt(A,[m n],block_type,fun) \ B=colfilt(A,[m n],block_type,fun,P1,P2,...) \ B=colfilt(A,[m n],[mblock nblock],...) \ B=colfilt(A,'indexed',...)im2col 重调图像块为列语法:B=im2col(A,[m n],block_type) \ B=im2col(A,[m n]) \ B=im2col(A,'indexed',...)nlfilter 进行边沿操作语法:B=nlfilter(A,[m n],fun) \ B=nlfilter(A,[m n],fun,P1,P2,...) \ B=nlfilter(A,'indexed',...)十、二进制图像操作函数applylut 在二进制图像中利用lookup表进行行边沿操作语法:A=applylut(BW,LUT)bwarea 计算二进制图像对象的面积语法:total=bwarea(BW)bweuler 计算二进制图像的欧拉数语法:eul=bweuler(BW)bwfill 填充二进制图像的背景色语法:BW2=bwfill(BW1,c,r,n) \ BW2=bwfill(BW1,n) \ [BW2,idx]=bwfill(...) \ BW2=bwfill(x,y,BW1,xi,yi,n) \ [x,y,BW2,idx,xi,yi]=bwfill(...) \ [BW2,idx]=bwfill(BW1,'holes',n)bwlabel 标注二进制图像中已连接的部分语法:L=bwlabel(BW,n) \ [L,num]=bwlabel(BW,n)bwmorph 提取二进制图像的轮廓语法:BW2=bwmorph(BW1,operation) \ BW2=bwmorph(BW1,operation,n)bwperim 计算二进制图像中对象的周长语法:BW2=bwperim(BW1) \ BW2=bwperim(BW1,CONN)bwselect 在二进制图像中选择对象语法:BW2=bwselect(BW1,c,r,n) \ BW2=bwselect(BW1,n) \ [BW2,idx]=bwselect(...) \ BW2=bwselect(x,y,BW1,xi,yi,n) \ [x,y,BW2,idx,xi,yi]=bwselect(...)dilate 放大二进制图像语法:BW2=dilate(BW1,SE) \ BW2=dilate(BW1,SE,alg) \ BW2=dilate(BW1,SE,...,n)erode 弱化二进制图像的边界语法:BW2=erode(BW1,SE) \BW2=erode(BW1,SE,alg) \ BW2=erode(BW1,SE,...,n)makelut 创建一个用于applylut函数的lookup表语法:lut=makelut(fun,n) \ lut=makelut(fun,n,P1,P2,...)十一、区域处理函数roicolor 选择感兴趣的颜色区语法:BW=roicolor(A,low,high) \ BW=rocicolor(A,v)roifill 在图像的任意区域中进行平滑插补语法:J=roifill(I,c,r) \ J=roifill(I) \ J=roifill(I,BW) \ [J,BW]=roifill(...) \ J=roifill(x,y,I,xi,yi) \ [x,y,J,BW,xi,yi]=roifill(...)roifilt2 过滤敏感区域语法:J=roifilt2(h,I,BW) \ J=roifilt2(I,BW,fun) \ J=roifilt2(I,BW,fun,P1,P2,...)roipoly 选择一个敏感的多边形区域语法:BW=roipoly(I,c,r) \ BW=roipoly(I) \ BW=roipoly(x,y,I,xi,yi) \ [BW,xi,yi]=roipoly(...) \ [x,y,BW,xi,yi]=roipoly(...)十二、颜色映像处理函数brighten 增加或降低颜色映像表的亮度语法:brighten(beta) \ brighten(h,beta) \ newmap=brighten(beta) \ newmap=brighten(cmap,beta)cmpermute 调整颜色映像表中的颜色语法:[Y,newmap]=cmpermute(X,map) \ [Y,newmap]=cmpermute(X,map,index)cmunigue 查找颜色映像表中特定的颜色及相应的图像语法:[Y,newmap]=cmunigue(X,map) \ [Y,newmap]=cmunigue(RGB) \ [Y,newmap]=cmunique(I)imapprox 对索引图像进行近似处理语法:[Y,newmap]=imapprox(X,map,n) \ [Y,newmap]=imapprox(X,map,tol) \ Y=imapprox(X,map,newmap) \ [...]=imapprox(...,dither_option)rgbplot 划分颜色映像表语法:rgbplot(cmap)十三、颜色空间转换函数hsv2rgb 转换HSV值为RGB颜色空间:M=hsv2rgb(H)ntsc2rgb 转换NTSC值为RGB颜色空间:rgbmap=ntsc2rgb(yiqmap) \ RGB=ntsc2rgb(YIQ)rgb2hsv 转换RGB值为HSV颜色空间:cmap=rgb2hsv(M)rgb2ntsc 转换RGB值为NTSC颜色空间:yiqmap=rgb2ntsc(rgbmap) \ YIQ=rgb2ntsc(RGB)rgb2ycbcr 转换RGB值为YCbCr颜色空间:ycbcrmap=rgb2ycbcr(rgbmap) \ YCBCR=rgb2ycbcr(RGB)ycbcr2rgb 转化YCbCr值为RGB颜色空间:rgbmap=ycbcr2rgb(ycbcrmap) \ RGB=ycbcr2rgb(YCBCR)十四、图像类型和类型转换函数dither 通过抖动增加外观颜色分辨率转换图像语法:X=dither(RGB,map) \ BW=dither(I)gray2ind 转换灰度图像为索引图像语法:[X,map]=gray2ind(I,n) \ [X,map]=gray2ind(BW,n)grayslice 从灰度图像为索引图像语法:X=grayslice(I,n) \ X=grayslice(I,v)im2bw 转换图像为二进制图像语法:BW=im2bw(I,level) \ BW=im2bw(X,map,level) \ BW=im2bw(RGB,level)im2double 转换图像矩阵为双精度型语法:I2=im2double(I1) \ RGB2=im2double(RGB1) \ I=im2double(BW) \ X2=im2double(X1,'indexed')double 转换数据为双精度型语法:double(X)unit8 、unit16转换数据为8位、16位无符号整型:i=unit8(x) \ i=unit16(x)im2unit8 转换图像阵列为8位无符号整型语法:I2=im2unit8(I1) \ RGB2=im2unit8(RGB1) \ I=im2unit8(BW) \ X2=im2unit8(X1,'indexed')im2unit16 转换图像阵列为16位无符号整型语法:I2=im2unit16(I1) \ RGB2=im2unit16(RGB1) \ I=im2unit16(BW) \ X2=im2unit16(X1,'indexed')ind2gray 把检索图像转化为灰度图像语法:I=ind2gray(X,map)ind2rgb 转化索引图像为RGB真彩图像语法:RGB=ind2rgb(X,map)isbw 判断是否为二进制图像语法:flag=isbw(A)isgray 判断是否为灰度图像语法:flag=isgray(A)isind 判断是否为索引图像语法:flag=isind(A)isrgb 判断是否为RGB真彩色图像语法:flag=isrgb(A)mat2gray 转换矩阵为灰度图像语法:I=mat2gray(A,[amin amax]) \ I=mat2gray(A)rgb2gray 转换RGB图像或颜色映像表为灰度图像语法:I=rgb2gray(RGB) \ newmap=rgb2gray(map)rgb2ind 转换RGB图像为索引图像语法:[X,map]=rgb2ind(RGB,tol) \ [X,map]=rgb2ind(RGB,n) \ X=rgb2ind(RGB,map) \ [...]=rgb2ind(...,dither_option)十五、新增图像处理工具箱函数adapthisteq 限制对比度直方图均衡化: J=adapthisteq(I) \ J=adapthisteq(I,param1,val1,param2,val2...)applycform 用于颜色空间变换 out=applyform(I,C)bwboundaries 描绘二进制图像边界语法:B=bwboundaries(BW) \ B=bwboundaries(BW,CONN) \ B=bwboundaries(BW,CONN,options) [BW,CONN,options] \ [BL]=bwboundaries(...) \ [BLNA]=bwboundaries()bwtraceboundary 描述二进制图像中的物体B=bwtraceboundary(BW,P,fstep) \ B=bwtraceboundary(BW,P,fstep,CONN) \ B=bwtraceboundary(...N,dir) decorrstrech 对多通道图像进行去相关处理语法:S=decorrstretch(I) \ S=decorrstretch(I,TOL)dicomdict 获取或读取DICOM文件语法:dicomdict('set',dictionary) \ dictionary=dicomdict('get')getline 用鼠标选择ployline语法:[x,y]=getline(fig) \ [x,y]=getline(ax) \ [x,y]=getline \ [x,y]=getline(...,'closed')getpts 用鼠标选择像素点语法:[x,y]=getpts(fig) \ [x,y]=getpts(ax) \ [x,y]=getptsgetrect 用鼠标选择矩阵语法:rect=getrect(fig) \ rect=getrect(ax) \ rect=getrect(fig)iccread 读取ICC剖面语法:P=iccread(filename)im2java2d 将图像转换为Java缓冲图像语法:jimage=im2java2d(I) \ jimage=im2java2d(X,MAP)imview 在图像与蓝旗中显示图像语法:imview(I) \ imview(RGB) \ imview(X,map) \imview(I,range) \ imview(filename) \ imview(....'InitialMagnification',initial_mag) \ h=imview(...) \ imview close allippl 检查IPPL的存在语法:TF=ippl \ [TF B]=ippliptdemos 显示图像处理工具箱中的索引图像lab2double、lab2unit16、lab2unit8 将L*a*b数据分别转换为双精度、16位数据、8位数据makecform 创造一个色彩转换结构poly2mask 把多边形区域转换成mask区域语法:BW=poly2mask(x,y,m,n)unitlut 查找表中A像素值语法:B=unitlut(A,LUT)xyz2double、xyz2unit16 将颜色数据从XYZ转换到双精度、16进制。

相关文档
最新文档