OpenCV Series : Slope + Radian + Degree

复制代码
------   -----------  -----------
IMG           903px       1212px
------   -----------  -----------
A4            210mm        297mm
------   -----------  -----------
Ratio      4.3px/mm     4.1px/mm
          0.23mm/px    0.24mm/px
------   -----------  -----------


c 复制代码
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
c 复制代码
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

c 复制代码
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()
相关推荐
LOVE️YOU7 小时前
Python 中 Tuple 为什么有时可 Hash,有时不可 Hash?
开发语言·python·哈希算法
小oo呆7 小时前
【学习心得】迭代器和可迭代对象
开发语言·python
AC赳赳老秦7 小时前
采集行为合规自检:OpenClaw 自动校验 robots 协议与采集频率,规避违规采集风险
java·开发语言·c++·python·php·deepseek·openclaw
迅猛龙办公室7 小时前
Python输出当前计算机的系统日期和时间
开发语言·前端·python
XiaoMaqqqq9 小时前
知名的IP驱动产业新场景新工具
网络·python·网络协议·tcp/ip
言乐69 小时前
Python实现语音审核模型
开发语言·python·django·virtualenv·pygame
程序员清风10 小时前
Python 数据分析环境搭建:从 Jupyter 到 pandas
python·jupyter·数据分析
月光船幽幽10 小时前
加性偏移外推提升参数识别可靠性
python·算法
BD_Marathon11 小时前
消息对象中字段的说明
java·前端·python
Java后端的Ai之路11 小时前
Python进阶探索23 - Python中的Time与Datetime模块
开发语言·数据库·python·datetime·time