OpenCV Series : Slope + Radian + Degree

------   -----------  -----------
IMG           903px       1212px
------   -----------  -----------
A4            210mm        297mm
------   -----------  -----------
Ratio      4.3px/mm     4.1px/mm
          0.23mm/px    0.24mm/px
------   -----------  -----------

在这里插入图片描述
在这里插入图片描述

def lineSlope(p1, p2):
    slope = (p2[1] - p1[1]) / (p2[0] - p1[0])
    return slope

def slopeAngle(p1, p2):
    slope  = lineSlope(p1, p2)
    radian = np.arctan(slope)
    return radian

def angleDegree(radian):
    theta = int(radian * 180 / np.pi) % 360
    return theta

在这里插入图片描述

RealSence ToF

https://github.com/IntelRealSense/librealsense/tree/development/wrappers/python
https://github.com/IntelRealSense/librealsense/tree/development/wrappers/python/examples
pip install pyrealsense2

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyrealsense2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/80/53/7c90f162661b4ad0dd4d2d4dc2e8330c52943cbd968c44770464d6d658b8/pyrealsense2-2.54.1.5217-cp39-cp39-win_amd64.whl (5.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 10.8 MB/s eta 0:00:00
Installing collected packages: pyrealsense2
Successfully installed pyrealsense2-2.54.1.5217

Librealsense frames support the buffer protocol文章来源地址https://uudwc.com/A/nP3aB

import numpy as np
import pyrealsense2 as rs

pipeline = rs.pipeline()
pipeline.start()

try:
    while True:
        frames = pipeline.wait_for_frames()
        depth = frames.get_depth_frame()
        if not depth: continue

        depth_data = depth.as_frame().get_data()
		np_image = np.asanyarray(depth_data)
finally:
    pipeline.stop()

原文地址:https://blog.csdn.net/unix2linux/article/details/133031106

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请联系站长进行投诉反馈,一经查实,立即删除!

h
上一篇 2023年09月23日 22:10
下一篇 2023年09月23日 22:11