To find the line of best fit through the longest axis of a figure represented as a binary image, the discussion highlights the use of the polyfit() function for linear fitting. The key challenge is that polyfit requires unique x-axis values, and the current dataset contains multiple y-values for each x-value. A suggested solution is to average the repeated x-values to create two vectors, which would allow for the application of polyfit. The use of accumarray is recommended for this averaging process. Additionally, linear regression can be calculated even with multiple y-values for the same x-value, and principal component analysis is mentioned as an alternative method for determining the best fit.