rotate and crop image but get error (Subscript indices must either be real positive integers or logicals)
Afficher commentaires plus anciens
I'm crop the picture using this code
v=~im2bw(img,0.7);
[rows, columns] = find(v);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
cropped = img(row1:row2, col1:col2);
figure, imshow(cropped);title('crop Image');
[p3, p4] = size(cropped);
pp=p4/4; % finde quarter of image width
q1 = p4-pp; % size of the crop box
i3_start = floor((p3-q1)/2); % or round instead of floor; using neither gives warning
i3_stop = i3_start + q1;
i4_start = floor((p4-q1)/2);
i4_stop = i4_start + q1;
I1 = cropped(i3_start:i3_stop, i4_start:i4_stop, :);
figure ,imshow(I1);
and then I rotated the image and tried to crop it with the same code but I got this error
Subscript indices must either be real positive integers or logicals.
Error in Try (line 47)
I1 = croppedImage(i3_start:i3_stop, i4_start:i4_stop, :);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!