Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

problem with cropping images across 6 images

조회 수: 3 (최근 30일)
joanna
joanna 2012년 11월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
i want to crop an image and automatically crop the other 5 images instead of cropping one by one. this is the code i used but i cannot seem to make the 5 other images appear.
[I1c rect] = imcrop(handles.axes2) axes(handles.axes2); imshow(I1c);
I2c = imcrop(handles.axes3, rect)
axes(handles.axes3);
imshow(I2c);
I3c = imcrop(handles.axes4, rect)
axes(handles.axes4);
imshow(I3c);
I4c = imcrop(handles.axes5, rect)
axes(handles.axes5);
imshow(I4c);
I5c = imcrop(handles.axes9, rect)
axes(handles.axes9);
imshow(I5c);
I6c = imcrop(handles.axes10, rect)
axes(handles.axes10);
imshow(I6c);
guidata(hObject,handles)

답변 (1개)

Image Analyst
Image Analyst 2012년 11월 1일
You aren't cropping an image. You are cropping the handle to an axes control, NOT an image. Try something like this:
I2c = imcrop(I2, rect);
I3c = imcrop(I3, rect);
I4c = imcrop(I4, rect);
I5c = imcrop(I5, rect);
I6c = imcrop(I6, rect);
  댓글 수: 6
joanna
joanna 2012년 11월 2일
how do i obtain the character array if i have 2 types of arrays, an array of images captured by camera (captureButton_Callback) and an array of images loaded from folders (loadButton_Callback) ?
Image Analyst
Image Analyst 2012년 11월 2일
If you captured from a camera, they're in a variable, like
snappedImage = getsnapshot();
If you "have a type of array" where you loaded images from disk files in a folder then of course you must already have the filenames otherwise you would never have been able to "load" them, which you must have done via imread anyway, which is what you're trying to do, so that's ironic. OK, tell me this. When you "loaded an array of images loaded from folders" what lines of code did you actually use to accomplish that? Apparently you didn't use imread() because you're having trouble doing that now, so what did you do? How did you get that second type of array you mentioned - the one you loaded from folders? Did you follow the FAQ ( http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F>)? Or did you do something else? Or do you not have that second type of array yet?

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by