The detection of underwater Submerged Historical Monuments and Preservation of the vital for understanding historical civilizations. This project employs a hybrid approach combining classical computer vision (CV) techniques and modern deep learning-based detection models to identify submerged historical monuments. By integrating OpenCV for preprocessing and feature detection and YOLO for real-time object detection, the project provides a robust framework for identifying and documenting underwater structures.
Submerged historical monuments are often neglected due to the challenges of underwater detection, including poor visibility, marine growth, and high computational requirements. Advanced computer vision techniques, leveraging both classical and deep learning methods, can bridge the gap between technology and marine archaeology, facilitating.
Image Input --> Preprocessing (Classical CV) --> Feature Detection --> YOLO Detection (if available) --> Visualization
pip install opencv-python matplotlib torch ultralytics
from ultralytics import YOLO
import os
def load_yolo_model(model_path='yolo_model.pt'):
if os.path.exists(model_path):
return YOLO(model_path)
else:
print('YOLO model file not found. Proceeding with classical CV pipeline.')
return None
import cv2
def preprocess_image(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
return clahe.apply(gray)
def detect_features_cv(image):
edges = cv2.Canny(image, 50, 150)
contours, _ = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
return contours
import matplotlib.pyplot as plt
def visualize_detection(image, contours, title='Detected Features'):
overlay = image.copy()
cv2.drawContours(overlay, contours, -1, (0, 255, 0), 2)
plt.figure(figsize=(10, 6))
plt.imshow(cv2.cvtColor(overlay, cv2.COLOR_BGR2RGB))
plt.title(title)
plt.axis('off')
plt.show()
def detect_monuments(image_path, yolo_model=None):
image = cv2.imread(image_path)
if yolo_model:
results = yolo_model(image)
for result in results:
boxes = result.boxes.xyxy.cpu().numpy()
for box in boxes:
x1, y1, x2, y2 = map(int, box[:4])
cv2.rectangle(image, (x1, y1), (x2, y2), (255, 0, 0), 2)
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.title('YOLO Detection')
plt.axis('off')
plt.show()
else:
processed_image = preprocess_image(image)
contours = detect_features_cv(processed_image)
visualize_detection(image, contours)
dataset_path = '/content/drive/MyDrive/DataSet'
yolo_model_path = 'yolo_model.pt'
yolo_model = load_yolo_model(yolo_model_path)
for filename in os.listdir(dataset_path):
if filename.lower().endswith(('.jpg', '.png')):
image_path = os.path.join(dataset_path, filename)
print(f'Processing: {image_path}')
detect_monuments(image_path, yolo_model)
This project demonstrates a hybrid approach to detect submerged historical monuments using computer vision techniques. By leveraging classical CV and deep learning, we aim to provide scalable, efficient solutions to preserve our underwater heritage.
There are no models linked
There are no models linked