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()
相关推荐
quikai19813 小时前
python练习第二组
开发语言·python
熊猫_豆豆3 小时前
python 用手势控制程序窗口文字大小
python·手势识别
测试秃头怪3 小时前
2026最新软件测试面试八股文(含答案+文档)
自动化测试·软件测试·python·功能测试·测试工具·面试·职场和发展
LUU_793 小时前
Day29 异常处理
python
子夜江寒4 小时前
Python 学习-Day8-执行其他应用程序
python·学习
背心2块钱包邮4 小时前
第7节——积分技巧(Integration Techniques)-代换积分法
人工智能·python·深度学习·matplotlib
一个散步者的梦4 小时前
一键生成数据分析报告:Python的ydata-profiling模块(汉化)
python·数据挖掘·数据分析
黑客思维者5 小时前
Python大规模数据处理OOM突围:从迭代器原理到TB级文件实战优化
开发语言·python·github·迭代器·oom
weixin_421133415 小时前
应用日志监控
python
CHANG_THE_WORLD6 小时前
Python 学习三 Python字符串拼接详解
开发语言·python·学习