why the coordinates start from 800. want it to start from 0 . and the origin point in the left down like usual.

조회 수: 1(최근 30일)
Mustafa Alhandhali
Mustafa Alhandhali 2019년 3월 11일
댓글: Mustafa Alhandhali 2019년 3월 24일
this the code i use
%load the image called test1
rgbImage = imread('test1.JPG');
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows, columns, numberOfColorBands] = size(rgbImage);
% Display the original color image.
subplot(2, 2, 1);
axis on; grid on
title('Original Color Image');

채택된 답변

Adam Danz
Adam Danz 2019년 3월 11일
The funtion imshow() flips the y axis. To make the y-axis normal again.
ax = gca;
ax.YDir = 'normal';
However, your image will also flip its y direction.
  댓글 수: 6

댓글을 달려면 로그인하십시오.

추가 답변(1개)

dpb 2019년 3월 11일
편집: dpb 2019년 3월 11일
imshow by default uses size() of the image x- and y- dimensions +/-0.5 as the axis x- and y-limits. The data are plotted on the axes from 1:Nx and 1:Ny so If you actually make the limits to be 0, you'll have a little background area outside the actual image data.
And, it always shows images with origin at top left. You can flip the axes, but unless you also flip() the image data in the y-direction, the image will be displayed upside down.
imshow(flipud(rgbImage)) % show the image in reversed y-direction
hAx=gca; % the parent axes handle
hAx.YDir='normal'; % invert the axis to go from bottom up so is displayed right side up


Community Treasure Hunt

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

Start Hunting!

Translated by