I have an image, and two points coordinates (x1,y1)/(x2,y2).
1- I want to know the intensity value of all pixels lying in a line between these two points (my end goal will be to fit these intensities with gaussian functions...) 
2- I want to add the intensities of all pixels lying "transversly" in the vicinity (width sigma) of this pathline. (some kind of binning?). 
In both cases the end result would be a list or plot looking like this : 
It seems to me that there should be a straightforward way to do this, though I didn't find any ! Do you have any idea of how to efficiently implement this ? Any hint is welcome for any which one of the two questions.
Thank you.
EDIT : Thank you all, what I was basically looking for is the bresenham algorithm, I encourage interested people to take a look at the links posted by @C.E.
PixelValues along a straight Line Line Intensity Profile From Image Line Intensity Profile From Image







