Spaces:
Sleeping
Sleeping
Update scalingtestupdated.py
Browse files- scalingtestupdated.py +1 -4
scalingtestupdated.py
CHANGED
|
@@ -30,7 +30,7 @@ class ScalingSquareDetector:
|
|
| 30 |
raise ValueError("Invalid feature detector. Choose 'ORB' or 'SIFT'.")
|
| 31 |
|
| 32 |
def find_scaling_square(
|
| 33 |
-
self,
|
| 34 |
):
|
| 35 |
"""
|
| 36 |
Detect the scaling square in the target image based on the reference image.
|
|
@@ -109,7 +109,6 @@ class ScalingSquareDetector:
|
|
| 109 |
|
| 110 |
|
| 111 |
def calculate_scaling_factor(
|
| 112 |
-
reference_image_path,
|
| 113 |
target_image,
|
| 114 |
reference_obj_size_mm,
|
| 115 |
feature_detector="ORB",
|
|
@@ -121,7 +120,6 @@ def calculate_scaling_factor(
|
|
| 121 |
|
| 122 |
# Find scaling square and calculate scaling factor
|
| 123 |
scaling_factor = detector.find_scaling_square(
|
| 124 |
-
reference_image_path=reference_image_path,
|
| 125 |
target_image=target_image,
|
| 126 |
known_size_mm=reference_obj_size_mm,
|
| 127 |
roi_margin=roi_margin,
|
|
@@ -156,7 +154,6 @@ if __name__ == "__main__":
|
|
| 156 |
try:
|
| 157 |
|
| 158 |
scaling_factor = calculate_scaling_factor(
|
| 159 |
-
reference_image_path="./coin.png",
|
| 160 |
target_image=box_img,
|
| 161 |
known_square_size_mm=20,
|
| 162 |
feature_detector="ORB",
|
|
|
|
| 30 |
raise ValueError("Invalid feature detector. Choose 'ORB' or 'SIFT'.")
|
| 31 |
|
| 32 |
def find_scaling_square(
|
| 33 |
+
self, target_image, known_size_mm, roi_margin=30
|
| 34 |
):
|
| 35 |
"""
|
| 36 |
Detect the scaling square in the target image based on the reference image.
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
def calculate_scaling_factor(
|
|
|
|
| 112 |
target_image,
|
| 113 |
reference_obj_size_mm,
|
| 114 |
feature_detector="ORB",
|
|
|
|
| 120 |
|
| 121 |
# Find scaling square and calculate scaling factor
|
| 122 |
scaling_factor = detector.find_scaling_square(
|
|
|
|
| 123 |
target_image=target_image,
|
| 124 |
known_size_mm=reference_obj_size_mm,
|
| 125 |
roi_margin=roi_margin,
|
|
|
|
| 154 |
try:
|
| 155 |
|
| 156 |
scaling_factor = calculate_scaling_factor(
|
|
|
|
| 157 |
target_image=box_img,
|
| 158 |
known_square_size_mm=20,
|
| 159 |
feature_detector="ORB",
|