Clear Filters
Clear Filters

Shift the origin (0,0) of the pixels in my image

13 views (last 30 days)
Hi,
As an input of my code, I need to have some positions on my picture: the positions are in pixels and the origin (0,0) is in the CORNER top left of my picture
The problem is that when I run my code which maps the positions on my picture, the origin shifts to the bottom left :
So my question is : how could I also shift my input (positions of my picture1) so that it is relevant with the code process?
Thank you for your help, Aude

Accepted Answer

Walter Roberson
Walter Roberson on 1 Feb 2017
set(gca, 'ydir', 'reverse')
  3 Comments
Image Analyst
Image Analyst on 2 Feb 2017
Edited: Image Analyst on 2 Feb 2017
No. Just put his line of code, exactly as it is , right after you call imshow(). The badly-named "a" (y values) is not used at all in the call to set().
Aude Rapet
Aude Rapet on 2 Feb 2017
Thank you Image Analyst for your comment, it is working perfectly!

Sign in to comment.

More Answers (2)

Camille Marin
Camille Marin on 13 Apr 2018
Edited: Camille Marin on 20 Apr 2018
Hello all,
With the same spirit, is it possible to assign specific coordinates to the image's origin in order to use them for an imwarp function ? For instance, I would like to click on my image via the "ginput" function, and I want to assign the X,Y values to the image origin, instead of having it at the top left (1,1).
close all
clearvars
Mire_def= imread ('Couronne_cylindrique_cylindrique_reelle.tif');
%Declaration of the polynomial (4 degree) vectors A & B. Only A has values,
since no modification ocured on the Y axe
A_tot=[- 1.5828, 0.8289, 0, 0,0.0007, 0,0, 0, - 1E-06, 0,0,0,0,3E-10,0];
B=zeros(1,15);
B(3)=1;
tform = images.geotrans.PolynomialTransformation2D(A_tot,B);
xWorldLimits = [-121 647];
yWorldLimits = [-528 240];
RA = imref2d(size(Mire_def),xWorldLimits,yWorldLimits);
Mire_corr=imwarp(Mire_def,RA,tform)

wenjie liu
wenjie liu on 5 Dec 2019
will you be able to share code on this? I found usage of finding displacement between two images as well. Thank you.

Community Treasure Hunt

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

Start Hunting!