looping variable with appended numbers
이전 댓글 표시
I have an image that I want to loop through and give each iteration an extension such as imgVNIR1, imgVNIR2,...imgVNIRn, the same applies to the imgSWIR. the count will be dependent on the number of targets in the image
prompt = 'Enter number of object ';
result = input(prompt);
this is the code I have.(things to know: The full image is 320x768x361, img is the image in which a object is selected. the image is composed of 2 sensors side by side, VNIR and SWIR. Bands 125-130 are not used)
img = imrotate(im,90, 'nearest');
%[m,n]=size(img(:,:,124));
figure; imshow(img(:,:,124));
[~ , rect]=imcrop;
rect = floor(rect);
rowstart = rect(2);
rowend = rowstart+rect(4);
colstart = rect(1);
colend = colstart+rect(3);
imgVNIR = img(rowstart:rowend,colstart:colend,115);
imgSWIR = img(rowstart:rowend,colstart:colend,138);
The goal is to select an object to crop based on the number stored in result and have 2 outputs such that my work space should look like this if i had 3 objects
- imgVNIR1
- imgSWIR1
- imgVNIR2
- imgSWIR2
- imgVNIR3
- imgSWIR3
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Hyperspectral Image Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!