I segmented image 1 to obtain to obtain image 2 (refer to the attachements). However I would like to connect the broken edges to obtain image no. 3 (connected edges are exemplified in red). Would you kindly have any suggestion? In case it may be of your interest, I also have the possibility to segment image 1 to obtain image 4.
Besides this, if you have any idea to fit the white edges into lines, it would be more than welcome!