I have a binary image that is the Canny output of an image containing some objects and my goal is to learn to recognise the corners of the objects and measure the perimeters. Example: 
The goal is to identify the upper edge of the laptop, and to measure the length (in pixel length within the photo). I want to be able to do this on images that contain the laptop in arbitrary positions and distances.
I tried writing a basic UNet type of layer to do image segmentation, but it did not give me satisfactory results. Is there a simple algorithm that does this?
I also tried using an object detection pre-trained model to detect the bounding box for the laptop, but it does not give the actual corners, it simply gives a large rectangle that circumscribes the object.