How to set custom origin point?
102 vues (au cours des 30 derniers jours)
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
Image Analyst le 22 Juin 2018
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);
hp = impixelinfo
Plus de réponses (2)
Mark Saad le 22 Juin 2018
Modifié(e) : Mark Saad le 22 Juin 2018
I was trying to do this the other day. I could not find anything, so I just manually shifted all of my data points. Let's say you have
x = [1 2 3 4];
y = [5 6 7 8];
and you want (1,5) to be the origin. Then just do
x = x - 1;
y = y - 5;
Above is an image of the original points on the left, and the points shifted so that (2,6) is the origin on the right.