Spaces:
Sleeping
Sleeping
File size: 904 Bytes
6a6918c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import cv2
from draft_computation_app import calculate_draft
def create_dummy_data():
"""
Creates dummy data for testing.
"""
pose_results = np.array([
[[100, 200, 1], [100, 220, 1], [100, 240, 1], [100, 260, 1], [100, 280, 1]],
[[200, 300, 1], [200, 320, 1], [200, 340, 1], [200, 360, 1], [200, 380, 1]],
])
segment_mask = np.zeros((500, 500), dtype=np.uint8)
segment_mask[400:, :] = 1 # Water line at y=400
original_image = np.zeros((500, 500, 3), dtype=np.uint8)
return pose_results, segment_mask, original_image
if __name__ == "__main__":
pose_results, segment_mask, original_image = create_dummy_data()
draft = calculate_draft(pose_results, segment_mask, original_image)
print(f"The draft is: {draft} meters")
|