Indrasyach
Indrasyach

Reputation: 147

plotting is displayed upside down at MATLAB GUI

I am working on video surveillance on crowd density estimation. I am implementing a corner detection method for this project. However, I have a problem when my code is combined in GUI MATLAB, the display of plotting corner is upside down and it is not overlay on the original image. Here my code on plotting the image in GUI Matlab.

The problem is solved already and here is the correct code:

% Find row,col coords.
[r,c] = find(cim2);  

%After getting row and column coordinate, I plot them together in the original image which is
% overlay image and plotting

imshow(inFrame, 'Parent', handles.axes8);
hold on;
p1 = plot([c],[r],'r.');
set(p1, 'Parent', handles.axes8);

Thank you for @Lokesh for his suggestion.

Upvotes: 0

Views: 819

Answers (2)

Ritesh
Ritesh

Reputation: 256

The explanation of your problem is very well given by floris.But here due to lack of full your code we are not able to perform it on our system. you can aslo try for

axis ij

which is some what similar to above answer. you can also try the below code.

imshow(inFrame,'Parent',handles.axes8);
hold on;
p1 = plot([c],[r],'r.');
set(p1,'Parent',handles.axes8);

hope this works for you..let me know about the result..

Upvotes: 2

Floris
Floris

Reputation: 46375

imshow inverts the Y axis. Conventionally, in image display the top left corner of the screen is (0,0) with i (the first coordinate) running down the screen, and j (the second coordinate) from left to right.

If you want the image axis to look like a conventional plot axis you can do

axis xy

This will "invert" your image, putting 0,0 in the bottom left.

Upvotes: 1

Related Questions