首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

matlab 马赫带效应,matlab图像处理基础实例

·边缘检测(edge)边缘检测时先要把其他格式图像转化为灰度图像>> f=imread( lbxx.bmp );>> a=rgb2gray(f);>> [g,t]=edge(a, canny );>> imshow(g)·剪贴(imcrop)、subplot 等imfinfo colormap subimageimadd imsubtract immultiply imdivideimresize imrotate(旋转)>> a=imread( onion.png );>> b=imcrop(a,[75 68 130 112]);% I2 = IMCROP(I,RECT)% RECT is a 4-element vector with the [XMIN YMIN WIDTH HEIGHT];% subplot(121)一行两列的显示,当前显示第一个图片>> subplot(121);imshow(a);>> subplot(122);imshow(b);·roipoly选择图像中的多边形区域>> a=imread( onion.png );>> c=[200 250 278 248 199 172];>> r=[21 21 75 121 121 75];>> b=roipoly(a,c,r);>> subplot(121);imshow(a);>> subplot(122);imshow(b);·roicolor按灰度值选择的区域>> a=imread( onion.png );>> i=rgb2gray(a);>> b=roicolor(i,128,255);>> subplot(121);imshow(a);>> subplot(122);imshow(b);·转化指定的多边形区域为二值掩膜poly2mask>> x=[63 186 54 190 63];>> y=[60 60 209 204 60];>> b=poly2mask(x,y,256,256);>> imshow(b);>> holdCurrent plot held>> plot(x,y, b , LineWidth ,2)·roifilt2区域滤波a=imread( onion.png );i=rgb2gray(a);c=[200 250 278 248 199 172];r=[21 21 75 121 121 75];b=roipoly(i,c,r);h=fspecial( unsharp );j=roifilt2(h,i,b);subplot(121),imshow(i);subplot(122),imshow(j);·roifill区域填充>> a=imread( onion.png );>> i=rgb2gray(a);>> c=[200 250 278 248 199 172];>> r=[21 21 75 121 121 75];>> j=roifill(i,c,r);>> subplot(211);imshow(i);>> subplot(212);imshow(j);·FFT变换f=zeros(100,100);f(20:70,40:60)=1;imshow(f);F=fft2(f);F2=log(abs(F));imshow(F2),colorbar·补零操作和改变图像的显示象限f=zeros(100,100);f(20:70,40:60)=1;subplot(121);imshow(f);F=fft2(f,256,256);F2=fftshift(F);subplot(122);imshow(log(abs(F2))) ·离散余弦变换(dct)>> a=imread( onion.png );>> i=rgb2gray(a);>> j=dct2(i);>> subplot(131);imshow(log(abs(j))),colorbar>> j(abs(j)> k=idct2(j);>> subplot(132);imshow(i);>> subplot(133);imshow(k,[0,255]);info=imfinfo( trees.tif )%显示图像信息·edge提取图像的边缘canny prewitt sobelradon 函数用来计算指定方向上图像矩阵的投影>> a=imread( onion.png );>> i=rgb2gray(a);>> b=edge(i);>> theta=0:179;>> [r,xp]=radon(b,theta);>> figure,imagesc(theta,xp,r);colormap(hot);>> xlabel( \theta(degrees) );>> ylabel( x\prime );>> title( r_{\theta}(x\prime) );>> colorb

02
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    matlab实现图像预处理的很多方法

    RGB = imread('sy.jpg');                     % 读入图像 imshow(RGB),                                  % 显示原始图像 GRAY = rgb2gray(RGB);                          % 图像灰度转换 imshow(GRAY),                                  % 显示处理后的图像 threshold = graythresh(GRAY);                    % 阈值 BW = im2bw(GRAY, threshold);                     % 图像黑白转换 imshow(BW),                                      % 显示处理后的图像 BW = ~ BW;                                       % 图像反色 imshow(BW),                                      % 显示处理后的图像 1.图像反转 MATLAB程序实现如下: I=imread('xian.bmp'); J=double(I); J=-J+(256-1);                 %图像反转线性变换 H=uint8(J); subplot(1,2,1),imshow(I); subplot(1,2,2),imshow(H); 2.灰度线性变换 MATLAB程序实现如下: I=imread('xian.bmp'); subplot(2,2,1),imshow(I); title('原始图像'); axis([50,250,50,200]); axis on;                  %显示坐标系 I1=rgb2gray(I); subplot(2,2,2),imshow(I1); title('灰度图像'); axis([50,250,50,200]); axis on;                  %显示坐标系 J=imadjust(I1,[0.1 0.5],[]); %局部拉伸,把[0.1 0.5]内的灰度拉伸为[0 1] subplot(2,2,3),imshow(J); title('线性变换图像[0.1 0.5]'); axis([50,250,50,200]); grid on;                  %显示网格线 axis on;                  %显示坐标系 K=imadjust(I1,[0.3 0.7],[]); %局部拉伸,把[0.3 0.7]内的灰度拉伸为[0 1] subplot(2,2,4),imshow(K); title('线性变换图像[0.3 0.7]'); axis([50,250,50,200]); grid on;                  %显示网格线 axis on;                  %显示坐标系 3.非线性变换 MATLAB程序实现如下: I=imread('xian.bmp'); I1=rgb2gray(I); subplot(1,2,1),imshow(I1); title('灰度图像'); axis([50,250,50,200]); grid on;                  %显示网格线 axis on;                  %显示坐标系 J=double(I1); J=40*(log(J+1)); H=uint8(J); subplot(1,2,2),imshow(H); title('对数变换图像'); axis([50,250,50,200]); grid on;                  %显示网格线 axis on;                  %显示坐标系 4.直方图均衡化 MATLAB程序实现如下: I=imread('xian.bmp'); I=rgb2gray(I); figure; subplot(2,2,1); imshow(I); subplot(2,2,2); imhist(I); I1=histeq(I); figure; subplot(2,2,1); imshow(I1); subplot(2,2,2); imhist(I1); 5.线性平滑滤波器 用MATLAB实现领域平均法抑制噪声程序: I=im

    02

    用MATLAB实现对运动物体识别与跟踪

    不得不说MATLAB的图像处理函数有点多,但速度有时也是出奇的慢。还是想c的指针,虽然有点危险,但速度那是杠杠的。 第二个MATLAB程序,对运动物体的识别与追踪。 这里我们主要运用帧差法实现运动物体与背景图像的分离,由于视频中的物体较为简单,我们只对两帧图像取帧差(也是为了提高速度) 对于运动物体的提取我们运用了MATLAB里自带的函数bwareaopen bwareaopen(src,int),src为二值图像,int为设置的联通域的大小,是对帧差法,在转化为二值的图像进行操作,结果是将大小小于设定的int的连通域置为0; 对于第一帧与第二帧图像运动物体的坐标的提取我们用了自带的regionprops函数 regionprops(src,’‘)其中src为传入的二值图像,’‘内的为你所需要的属性 具体属性可以查看MATLAB的help

    02
    领券