How can I determine what matrix is needed to flip an image upside down?

2 ビュー (過去 30 日間)
gm76
gm76 2013 年 10 月 27 日
コメント済み: Youssef Khmou 2013 年 10 月 28 日
I need to write a program that will flip an image upside down. This is for a linear algebra class so I am not allowed to use flipud(). I must find a transformation matrix (T) which can be multiplied by an image (X) to give the flipped image.
T*X_original = X_flipped
I'm not sure where to start with this. Thanks!

採用された回答

Image Analyst
Image Analyst 2013 年 10 月 27 日
編集済み: Image Analyst 2013 年 10 月 27 日
Try this:
flippedMatrix = originalMatrix(end:-1:1, :);
% Alternatively (less efficient) but what you want.
T = zeros(size(originalMatrix, 1)); % INitialize.
for k = 1 : size(originalMatrix, 1)
T(k, end-k+1) = 1;
end
T % Print to command window.
flippedMatrix2 = T * originalMatrix

その他の回答 (1 件)

Youssef  Khmou
Youssef Khmou 2013 年 10 月 27 日
編集済み: Youssef Khmou 2013 年 10 月 27 日
Generally that type of matrices are for euclidean space where a vector or a set of vector can be rotated with a cos and sin rotation matrix, however there might a real matrix that provide what you described , in the mean while you try this way :
X=im2double(imread('circuit.tif')); % Original image
[m n]=size(X);
Y=X(m:-1:1,n:-1:1); % flipped image upside down
% gievn T*X=Y , is T bounded operator ??????? can you answer this equation
T=Y*pinv(X); % Pseudo inverse because Y is not square .

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by