문제

I'm printing an image like this :

img = imread('path/to/image.jpg');
image(img);

this is fine, but when I do

img = imread('path/to/image.jpg');
hold on;
image(img);

image is rotated 180 degrees. Any ideas why, and how to fix this ?

Why am I doing hold on ? Because I'm trying to draw something else on the picture.

Thanks for any help!

The Exact Problem

Image was rotated 180 degrees around center point, and then another 180 degrees around y axis.

The Answer :

Thanks to @lennon310, I have updated my code to this :

img = imread(filename);
img = flipdim(img,1);
do_vlfeat_things(img);
hold on;
image(img);

Now it works correctly.

도움이 되었습니까?

해결책

The rows of an image are stored from top to bottom, you may use

hold on,image([1 size(img,1)],[size(img,2) 1],img)

to reverse the image along y-axis.

To reverse the loaded matrix at the beginning, use (row reverse)

img1 = flipdim(img,1);

다른 팁

Display the image first, then use hold:

image(img);
hold on;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top