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!