create util.py

This commit is contained in:
bluepulsar
2025-12-25 20:46:13 +08:00
parent f68893e16e
commit 231f070143
6 changed files with 212 additions and 243 deletions
+3 -6
View File
@@ -1,15 +1,13 @@
import os
os.environ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS"] = "0"
import cv2
from orisys import Sensor
import numpy as np
import orisys
def main():
global start_time
# 打开视频
sensor1 = Sensor("./s1.mp4",isstitch=True,cuda = True,verbose = True)
sensor1 = orisys.Sensor("./s1.mp4",isstitch=True,cuda = True,verbose = True)
# 打开摄像头
# sensor1 = Sensor(0,isstitch=True,cuda = True,verbose = True)
@@ -24,7 +22,7 @@ def main():
fps, fn, fx, fy, flow, depth = sensor1.read_info(sensor1.info.FPS, sensor1.info.FNORMAL, sensor1.info.FSHEARX, sensor1.info.FSHEARY, sensor1.info.VRAW, sensor1.info.DEPTH)
print(fps,fn,fx,fy)
# 显示向量场
arrows = sensor1.draw_arrows(sensor1.info.VRAW, threshold=5, grid_spacing=40, arrow_scale=1.0)
arrows = orisys.util.draw_arrows(sensor1.img, flow, threshold=5, grid_spacing=40, arrow_scale=1.0)
cv2.imshow("Deformation", arrows)
depth_img = cv2.applyColorMap((depth*1* 255.0).astype('uint8'), cv2.COLORMAP_HOT)
@@ -41,6 +39,5 @@ def main():
sensor1.disconnect() # 断开传感器连接
if __name__ == '__main__':
main()