how to find rectangles in image    
   hello, I need find the rectangle in the follow image:

i try to use Canny to find the edge, here is the result:

we can clearly see the rectange, my meth is:
1) find the top line: from up to down, get the first 255 point in edge image to make a point set, and to use RANSAC line fit methed to fit the line, if the line fabs(min(dx, dy)/max(dx, dy))<0.3, i sure find a horizon line or vertcal line, if the line is not horizon or vertcal, i think of it noise, i draw the noise line with dark line in edge, so the the noise is erased, and next, i try the same methed untill to find a horizon line.
2)to find other line, i try similer method.
3)finaly, i find the rectanle:
but, i  not satisfy my method, do you have other idear to solve this problem.
here is the src image:
C:\fakepath\src.jpg
 
What languages? You can't do rectangle. Recommendly, used
polyline. I speak python 3.5 and OpenCV 3.4.0 for raspberry pi 3.I use C++, no matter recrtangle or polyine, i should find the corners first