Fit reference line

i have been working on dividing the sample in the image into 10 parts and then finding the highest bur in each section from the lower cutting edge(reference line is drawn from where bur start) as shown in the image using opencv. the problem here is a reference line that I draw using inline() at a certain height from the X-axis fits the lower cutting edge at the middle of the sample but it does not fit at the right corner of the sample as shown in the image in the yellow circles. i am thinking about some adaptive reference line that each section has its own reference line that fits the sample in that section, to apply this idea i would need some algorithm to detect the lower cutting edge automatically and draw a reference line accordingly.
i would be grateful if someone could guide me regarding the adaptive reference line in each section or suggest some other idea!!!

Note: Burs are the outgrown parts from the sample at the lower edge.