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()
相关推荐
长和信泰光伏储能1 天前
京津冀光伏发电:绿色能源的未来之路
python·能源
浦信仿真大讲堂1 天前
从重复操作到自动化闭环:如何让 CST 与 Python 真正协同起来
python·自动化·cst·仿真软件·达索软件
Gu Gu Study1 天前
ScoutLoop开放域深度研究引擎(agent的初步设计想法)
人工智能·python
卷无止境1 天前
写代码这件事,到底该讲究点什么?
后端·python
卷无止境1 天前
循环复杂度到底在算什么,Python 代码怎么才能写得让人一看就懂
后端·python
lpfasd1231 天前
MediaCrawler 项目深度分析
chrome·python·chrome devtools
Dxy12393102161 天前
Python项目打包成EXE完整教程(PyInstaller实战避坑)
开发语言·python
bamb001 天前
一个项目带你入门AI应用开发01
python
0566461 天前
Python康复训练——常用标准库
开发语言·python·学习
昆曲之源_娄江河畔1 天前
Python如何安装flask, pymssql
开发语言·python·flask·pymssql