I load images in matlab and work with them as double matrices.
Now I want to extract the data values across a straight line from one point of the image to another. This line however does not equal to a column or row (that would be easy).
How can I do that with matlab?
A line obeys the eq of the line
y=a*x+b. Here x and y are coordiantes of the image. So if you want a line defined by two points(x1,y1) -> (x2,y2), the slopeais(y2-y1)/(x2-x1)andb=y1-a*x1. So next , select points in the matrix the obey the eq of the line as follows:Create data and end points:
calculate ew of line parameters:
define the line:
select the proper matrix elements using linear indexing:
plot: