Spaces:
Sleeping
Sleeping
Update utils/measure_utils.py
Browse files- utils/measure_utils.py +3 -2
utils/measure_utils.py
CHANGED
@@ -32,7 +32,7 @@ class ContourAnalyzer:
|
|
32 |
return max_width, thickest_section, thickest_points, distance_transforms
|
33 |
|
34 |
def find_contours(self, binary_image):
|
35 |
-
contours, _ = cv2.findContours(binary_image, cv2.RETR_EXTERNAL, cv2.
|
36 |
|
37 |
# for debugging
|
38 |
print("Number of contours:", len(contours))
|
@@ -43,7 +43,8 @@ class ContourAnalyzer:
|
|
43 |
|
44 |
@staticmethod
|
45 |
def calculate_width(y, x, pixel_width, calibration_factor, distance):
|
46 |
-
angle = math.atan2(y, x)
|
|
|
47 |
width = angle * pixel_width * distance * calibration_factor
|
48 |
return width
|
49 |
|
|
|
32 |
return max_width, thickest_section, thickest_points, distance_transforms
|
33 |
|
34 |
def find_contours(self, binary_image):
|
35 |
+
contours, _ = cv2.findContours(binary_image, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
|
36 |
|
37 |
# for debugging
|
38 |
print("Number of contours:", len(contours))
|
|
|
43 |
|
44 |
@staticmethod
|
45 |
def calculate_width(y, x, pixel_width, calibration_factor, distance):
|
46 |
+
# angle = math.atan2(y, x)
|
47 |
+
angle=1
|
48 |
width = angle * pixel_width * distance * calibration_factor
|
49 |
return width
|
50 |
|