improved point detection
This commit is contained in:
@@ -10,10 +10,12 @@ from matplotlib.patches import Rectangle
|
||||
from .extractor import DiagramExtractor
|
||||
|
||||
|
||||
def process_all_images(directory, calibration=None, prompt_axis_override=False):
|
||||
def process_all_images(
|
||||
directory, calibration=None, prompt_axis_override=False, max_points=None
|
||||
):
|
||||
"""Process all PNG images in the directory"""
|
||||
|
||||
extractor = DiagramExtractor(calibration)
|
||||
extractor = DiagramExtractor(calibration, max_points=max_points)
|
||||
all_results = {}
|
||||
|
||||
for filename in os.listdir(directory):
|
||||
@@ -201,10 +203,26 @@ def main():
|
||||
print(f" X-axis: {calibration['x_min']} to {calibration['x_max']}")
|
||||
print(f" Y-axis: {calibration['y_min']} to {calibration['y_max']}\n")
|
||||
|
||||
# Get sampling density preference
|
||||
print("SAMPLING DENSITY:")
|
||||
print("-" * 40)
|
||||
max_points_input = input("Maximum points to extract (blank for auto): ").strip()
|
||||
max_points = None
|
||||
if max_points_input:
|
||||
try:
|
||||
max_points = int(max_points_input)
|
||||
print(f"Will extract up to {max_points} points per image.\n")
|
||||
except ValueError:
|
||||
print("Invalid input. Using automatic sampling.\n")
|
||||
else:
|
||||
print("Using automatic sampling (typically 50-200 points).\n")
|
||||
|
||||
override_choice = input("Override detected axes per image? (y/n): ").strip().lower()
|
||||
prompt_axis_override = override_choice in ("y", "yes")
|
||||
|
||||
results = process_all_images(images_dir, calibration, prompt_axis_override)
|
||||
results = process_all_images(
|
||||
images_dir, calibration, prompt_axis_override, max_points
|
||||
)
|
||||
|
||||
if results:
|
||||
print("\n" + "=" * 70)
|
||||
|
||||
Reference in New Issue
Block a user