Yaswanth56 commited on
Commit
60f0cf8
·
verified ·
1 Parent(s): eea2505

Update services/crack_detection_service.py

Browse files
Files changed (1) hide show
  1. services/crack_detection_service.py +10 -5
services/crack_detection_service.py CHANGED
@@ -4,10 +4,10 @@ import numpy as np
4
  # Define road boundary (ROI) for detection
5
  ROAD_BOUNDARY = (50, 50, 590, 430) # Example: x_min, y_min, x_max, y_max (adjust accordingly)
6
 
7
- def detect_cracks(frame):
8
  """
9
- Detects cracks in the given video frame.
10
- Uses edge detection and contour analysis to detect linear crack shapes.
11
  """
12
  try:
13
  # Convert frame to grayscale for crack detection
@@ -42,7 +42,12 @@ def detect_cracks(frame):
42
  'confidence': 0.95 # Simulated confidence
43
  })
44
 
45
- return cracks
 
 
 
 
 
46
  except Exception as e:
47
- print(f"Error in crack detection: {str(e)}")
48
  return []
 
4
  # Define road boundary (ROI) for detection
5
  ROAD_BOUNDARY = (50, 50, 590, 430) # Example: x_min, y_min, x_max, y_max (adjust accordingly)
6
 
7
+ def detect_cracks_and_objects(frame):
8
  """
9
+ Detects cracks and objects (potholes) in the given video frame.
10
+ Uses edge detection and contour analysis to detect cracks and objects.
11
  """
12
  try:
13
  # Convert frame to grayscale for crack detection
 
42
  'confidence': 0.95 # Simulated confidence
43
  })
44
 
45
+ # Detecting other objects (e.g., potholes) in the frame can be added here
46
+ objects = [] # Placeholder for detected objects
47
+ # Object detection logic using custom or pretrained models (e.g., DETR)
48
+ # You can add object detection for potholes here.
49
+
50
+ return cracks + objects
51
  except Exception as e:
52
+ print(f"Error in detection: {str(e)}")
53
  return []