`
lovnet
  • 浏览: 6712865 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

matlab读取摄像头

 
阅读更多

MATLAB采集摄像头程序的

source.vid = videoinput('winvideo', 1,'YUY2_640x480');

set(source.vid,'ReturnedColorSpace','grayscale');
vidRes = get(source.vid, 'VideoResolution');
nBands = get(source.vid, 'NumberOfBands');
hImage = image( zeros(vidRes(2), vidRes(1), nBands) );
%white = image( ones(vidRes(2), vidRes(1), nBands) );
%preview(source.vid, hImage);
a=getsnapshot(source.vid);
b=getsnapshot(source.vid);
c=a-b;
imshow(adapthisteq((256.-c.*20)))

其中preview是直接显示,getsnapshot是进行快照,这里采用连续拍照做差值从而进行图像处理。

拍摄结果(这里使用USB显微镜拍得)


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics