Matlab下常用图像、视频处理函数

显示RGB三通道的图像


I = imread('..\data\player2.jpg');
figure(1),clf
ax(1)=subplot(2,4,1);imshow(I);
ax(2)=subplot(2,4,2);imshow(I(:,:,1));
ax(3)=subplot(2,4,3);imshow(I(:,:,2));
ax(4)=subplot(2,4,4);imshow(I(:,:,3));
linkaxes(ax);

图像基本处理函数


write

imwrite(f,'filename');

不同通道

im2bw(image)
rgb2hsv(rgbimage)
rgb2ycbcr(rgbimage)
rgb2gray(rgbimage)

直方图

imhist(I); %I为gray图

过滤器

imfilter(I,h);

kernel

 h=fspecial('average',hsize)

 h=fspecial('gaussian',hsize,sigma)

 medfilt2   %good for salt and pepper noise;

Spatial transformation

imrotate(I,angle)  %rotation
imcrop(img,[xmin,ymin,width,height]) %region of interest  

Arithmetic operation

sum  J=imadd(I,50)
subtractions  z=imsubtract(x,y)
multiplication  z=immultiply(x,y)
z=imdivide(x,y)  %division

Edge(边缘)

 BW=edge(I,'sobel')%image,method
 BW=edge(I,'sobel',Theresh,Direction)

Communication with Camera on windows

(Windows下与摄像头连接)


video input object

vid=videoinput('winvideo',1);   %视频输入设备 
preview(vid)          %查看视频
stoppreview(vid)  %暂停
closepreview(vid)
delete(vid);  %release memory,at the end

Acquiring Images(camera)

 frame=getsnapshot(vid);  %Acquiring a frame

 pixel=frame(2,3)    % Accessing pixel information  1 channel

 pixel=frame(2,3,2)  3 chennels

 size(frame)   %size of the image

 imtool(frame) %Display Images

 imshow(frame(:,:,2));

“`

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值