MATLAB: How to draw a best fit line based on pixels, on the image itself

digital image processingregression

I have picked certain pixel points on an image and I wanted to draw a best fit line based on the distribution of those points right on the image itself.
Edit:
My input is the white pixels you see on the image. They all deviate to a certain degree horizontally from the center of the image, being zero. So for my data set I have values that are column numbers in reference to the center. This is done for each row.
For example, first row the white pixel may be at +3, that is 3 columns to the right of the center Second row the pixel may be at -27, 27 columns to the left of the center.
This continues all the way down to the image going row by row. I want to now draw a best fit line of these points on the image itself.

Best Answer

Please post your image and annotate it to indicate which pixels the line should be drawn through and indicate if you already know their (x,y) or (row,column) locations. In the meantime, see my attached polyfit demo.
And explain what "the distribution" means to you. Is it the histogram (probability density function), or is it the spatial arrangement/layout of where the pixels are?