storing a cropped image into a variable and saving the image using imwrite()

I have another question. I created a GUI that takes photo using a webcam and from there allows the user to crop the image to the size of their choosing. However I want to store that cropped image into a variable but when I set it equal to a variable, MATLAB says that the variable is empty. Here is the code I used:
handles.output = hObject;
clc
axes(handles.axes1);
vid = videoinput('winvideo',1,'YUY2_320x240');
start(vid);
vid.ReturnedColorspace = 'rgb';
im = getdata(vid,1);
tb = rgb2gray(im);
croppedImage = imcrop(tb);
figure, imshow(croppedImage);
imwrite(croppedImage, 'standardImage.tif');
axis off;

답변 (1개)

create the cropped image by double-clicking the left mouse button or by choosing Crop Image from the context menu.
?

댓글 수: 1

The user crops the image by choosing the range and by double clicking with the left mouse button.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

태그

질문:

Bob
2012년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by