How to cut an image by pixels without imcrop?
6 ビュー (過去 30 日間)
古いコメントを表示
I would like to crop the image from (1,1) to (340,562) using a "while" function. This is the code I have so far
c = I2(:,1);
d = I2(1,:);
while c <= 562
c = c+1
I3 =
while d <= 340
d = d+1
I3 =
end
end
I don't know what to put in the I3= parts to crop the image if the pixel coordinates satisfy those conditions. Also I can't use imcrop since this is an assignment and it was specified to be completed this way.
0 件のコメント
採用された回答
Image Analyst
2017 年 6 月 14 日
Initialize c and d to 1, then
c = 1;
I3 = zeros(340, 562); % Preallocate for speed.
while c <= 562
d = 1;
while d <= 340
I3(d, c) = I2(d, c);
....
....
c = c+1
....
and so on. See if you can fill in the missing lines for your homework. It's pretty close - just 3 more lines of code.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!