added contact gpu support

This commit is contained in:
bluepulsar
2025-12-28 21:20:37 +08:00
parent e8e4fd8625
commit 4f8165b04b
4 changed files with 218 additions and 19 deletions
+5 -2
View File
@@ -3,7 +3,7 @@ os.environ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS"] = "0" # Windows 下禁
import cv2
import orisys
import numpy as np
import time
def main():
# 方式1: 从视频文件读取
@@ -46,7 +46,8 @@ def main():
cv2.imshow("magnitude map", mag_img)
# 计算触碰点
contact_result = sensor.get_contact(multiple_foe=False, min_magnitude=1, expansion_threshold=0.01,denoise_sigma=15)
contact_result = sensor.get_contact(min_magnitude=1, expansion_threshold=0.01,denoise_sigma=15)
# 在图像上触碰点和区域
image_with_foe = orisys.util.draw_foe(sensor.img.copy(), contact_result)
cv2.imshow("Contact Centroid", image_with_foe)
@@ -63,6 +64,8 @@ def main():
# 应用颜色映射(使用JET:蓝色=低散度,红色=高散度)
cv2.imshow("Divergence Map", cv2.applyColorMap(div_normalized, cv2.COLORMAP_JET))
print(f"fps: {fps}")
# =====================================================================