Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -119,16 +119,16 @@ def homography_all_detectors(flat_file, persp_file, json_file, xml_file):
|
|
| 119 |
# 2. Perspective with Homography ROI
|
| 120 |
roi_corners_persp = cv2.perspectiveTransform(roi_corners_flat.reshape(-1,1,2),H).reshape(-1,2)
|
| 121 |
persp_roi = persp_img.copy()
|
| 122 |
-
cv2.polylines(persp_roi,[roi_corners_persp.astype(int)],True,(0,0
|
| 123 |
for px,py in roi_corners_persp:
|
| 124 |
-
cv2.circle(persp_roi,(int(px),int(py)),5,(
|
| 125 |
|
| 126 |
# 3. Perspective with GT ROI (from XML)
|
| 127 |
xml_gt_img = persp_img.copy()
|
| 128 |
ordered_pts = ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft']
|
| 129 |
xml_polygon = [xml_points[pt] for pt in ordered_pts]
|
| 130 |
pts = np.array(xml_polygon, np.int32).reshape((-1,1,2))
|
| 131 |
-
cv2.polylines(xml_gt_img,[pts],isClosed=True,color=(255,0
|
| 132 |
|
| 133 |
# Convert to RGB + resize + add headings
|
| 134 |
flat_rgb = add_heading(fit_to_box(cv2.cvtColor(flat_with_roi,cv2.COLOR_BGR2RGB),600,600), "Flat Image with ROI")
|
|
|
|
| 119 |
# 2. Perspective with Homography ROI
|
| 120 |
roi_corners_persp = cv2.perspectiveTransform(roi_corners_flat.reshape(-1,1,2),H).reshape(-1,2)
|
| 121 |
persp_roi = persp_img.copy()
|
| 122 |
+
cv2.polylines(persp_roi,[roi_corners_persp.astype(int)],True,(0,255,0),5) #--------------------thicknes------------------------------------
|
| 123 |
for px,py in roi_corners_persp:
|
| 124 |
+
cv2.circle(persp_roi,(int(px),int(py)),5,(255,0,0),5)
|
| 125 |
|
| 126 |
# 3. Perspective with GT ROI (from XML)
|
| 127 |
xml_gt_img = persp_img.copy()
|
| 128 |
ordered_pts = ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft']
|
| 129 |
xml_polygon = [xml_points[pt] for pt in ordered_pts]
|
| 130 |
pts = np.array(xml_polygon, np.int32).reshape((-1,1,2))
|
| 131 |
+
cv2.polylines(xml_gt_img,[pts],isClosed=True,color=(0,255,0),thickness=5)
|
| 132 |
|
| 133 |
# Convert to RGB + resize + add headings
|
| 134 |
flat_rgb = add_heading(fit_to_box(cv2.cvtColor(flat_with_roi,cv2.COLOR_BGR2RGB),600,600), "Flat Image with ROI")
|