How to flip my image
古いコメントを表示
I have an image that I must flip using a nested for loop to flip the image vertically and horizontally, I have written a code that I think works but there is something wrong with it that it isn't. What have I done wrong?
%make 2d arrays values
imageData=imread('image.png');
[row, column] =size(imageData)
newImage=[]
%Use nested loops to change image mirrored
for i=[row:-1:1];
for j=[column:-1:1];
transposedMatrix(column, row) = imageData(i,j);
transposedMatrix
end
end
imshow(transposedMatrix)
5 件のコメント
Adam
2019 年 8 月 21 日
Why do you have to use a nested for loop rather than just the standard flip functions?
column and row are constant scalars in that code so assigning to
transposedMatrix( column, row )
in a loop doesn't make sense. Maybe you mean j, i instead?
Jesse Schultz
2019 年 8 月 21 日
Joel Handy
2019 年 8 月 21 日
Well that invalidates my answer. Does the image need to be rotated or flipped. There is a difference.
Jesse Schultz
2019 年 8 月 21 日
編集済み: Jesse Schultz
2019 年 8 月 21 日
Adam
2019 年 8 月 21 日
Well, a flip instruction would be more like exchanging position i with row - i and j with column - j
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!