Real time processing on snapshot image from USB-camera on GUI

1 回表示 (過去 30 日間)
Issara Laosuwan
Issara Laosuwan 2016 年 7 月 4 日
コメント済み: Image Analyst 2016 年 7 月 5 日
I have manged to write a GUI code that acquired real time snapshot from the captured USB camera.
guidata(hObject, handles);
handles.output = hObject;
axes(handles.axes1);
vid = videoinput('winvideo',1,'YUY2_640x480');
hImage = image(zeros(640,480,3),'parent',handles.axes1);
preview(vid,hImage);
DC = 'imgDC';
if(exist(DC,'dir')~=7)
mkdir(DC);
end
cnt = 1;
while(true)
data = getsnapshot(vid);
fname = sprintf('%04d.jpg',cnt);
ffn = fullfile(DC,fname);
cnt = cnt +1;
imwrite(data,ffn);
imshow(data)
pause(0.1)
end
Now, I would like to processed these snapshot images into binary images and displayed it on GUI as well. I completely have no idea how to that. Any advice from MATLAB Mates?
Thank you in advance!!!

回答 (1 件)

Image Analyst
Image Analyst 2016 年 7 月 4 日
Just create your binary image and then use imshow() to display it in a different axes.
binaryImage = whatever......
axes(handles.axes2); % Switch to other axes
imshow(binaryImage);
drawnow;
axes(handles.axes1); % Switch to the live video axes
  2 件のコメント
Issara Laosuwan
Issara Laosuwan 2016 年 7 月 5 日
Thank! I try your method as well as edit my format. However it doesn't seem to work. I have created axes2, but nothing happend
Image Analyst
Image Analyst 2016 年 7 月 5 日
You're not making it easy to help you. Please give me something I can actually work with or comment on.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by