MATLAB: How to set custom origin point

digital image processingimageMATLABplot

Hello,
I can't manage to find any solution to this problem (do I have to precise I am a complete novice with matlab):
Lets say I have an image named "image" and I show it on screen with axis. By default, my axis will be, from one border to another, zero to end (number of the last column).
But I have a point in "image" that I want to be zero, the origin. I know that point from a mouse input. How do I explain to matlab that I want this point to be the origin of the axis?
Ps: does the following script do something good? (I found it in "How to change the default origin of the axis of rotation in 3d plot matlab") – I don't have matlab today to try that one… But I am not sure if it can even work with my problem.
origin = [13 58]
If you want some details about the contexte of this problem, here it is:
I am currently working in engineering and I have to do some experiments. In these experiments, I have to take two pictures of a burner: one with the burner cold and a graduated metal rod in it to make the mire (although I don't know if the term exist in english), the other picture is of the burner functionning. The mire help me to transform the image in matlab and know the distances, then I apply the same transformation in the second picture and I can have the flame length simply by mesuring from a point to another.To simplify the operation, I want the origin at the exit of the burner, so that I have directly the distance from the exit when I select a point on the flame. If I am not clear enough, let me know, please.
Thank you for your time and patience
E.L.

Best Answer

Try this:
grayImage = imread('cameraman.tif');
[rows, columns, numberOfColorChannels] = size(grayImage);
origin = [13, 58]; % Assume x, y, NOT row, column
xdata = -origin(1) : columns - origin(1);
ydata = -origin(2) : columns - origin(2);
imshow(grayImage, 'XData', xdata, 'YData', ydata);
axis on;
hp = impixelinfo
grid on;
Related Question