MATLAB: I have an image which is full black background and the image contain few of white point. How can i draw a straight line that connected most of the white point as shown in figure.

straight linetrend line

I cant find a way to draw a straight line which on a black background that contain few white point on the image.

Best Answer

To avoid confusion, this answer is based on correspondence that has since been deleted. Original poster is looking for a type of upper bound trend line that is fitted to final part of the data set. Other answers show how to connect the dots (Image Analyst) and how to perform linear regression (Rik Wisselink).
The attached script uses ischange to subdivide the data set and fit linear segments. You can experiment with the MaxNumChanges and Threshold arguments of ischange to change the nature of the line.
Related Question