我正在完成此处找到的 Python 和 OpenCV 头部姿势估计教程:
https://www.learnopencv.com/head-pose-estimation-using-opencv-and-dlib/
我能够准确地将 3D 点投影到 2D 图像上。但是,我无法理解我使用计算的欧拉角(偏航、俯仰、滚转)的实际含义cv2.decomposeProjectionMatrix
我需要知道这些值是否对应于 (yaw, pitch, roll) 或 (roll, pitch, yaw) 等。此外,我需要了解所使用的轴方向,以便我知道旋转度数在哪里从测量。
输出图像:https : //www.learnopencv.com/wp-content/uploads/2016/09/head-pose-example-1024x576.jpg
输出角度:[[-179.30011146], [ 53.77756583], [-176.6277211 ]]
这是我的代码
# --- Imports ---
import cv2
import numpy as np
# --- Main ---
if __name__ == "__main__":
# Read Image
im = cv2.imread("headPose.jpg");
size = im.shape
#2D image points. If you change the image, you need to change vector
image_points = np.array([
(359, 391), # …
Run Code Online (Sandbox Code Playgroud) 我已经在互联网上搜索了几个小时,了解一些有关如何理解返回的欧拉角的文档cv2.decomposeProjectionMatrix
。
我的问题看起来很简单,我有一张飞机的二维图像。
我希望能够从该图像中得出飞机相对于相机的方向。最终,我正在寻找外观和凹陷(即方位角和仰角)。我有与图像中选择的 2D 特征相对应的 3D 坐标 - 在我的代码中列出如下。
# --- Imports ---
import os
import cv2
import numpy as np
# --- Main ---
if __name__ == "__main__":
# Load image and resize
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
im = cv2.imread(os.path.abspath(os.path.join(THIS_DIR, "raptor.jpg")))
im = cv2.resize(im, (im.shape[1]//2, im.shape[0]//2))
size = im.shape
# 2D image points
image_points = np.array([
(230, 410), # Nose
(55, 215), # right forward wingtip
(227, 170), # right aft outboard horizontal
(257, …
Run Code Online (Sandbox Code Playgroud) 我试图从Zillow收集数据是不成功的.
例:
url = https://www.zillow.com/homes/for_sale/Los-Angeles-CA_rb/?fromHomePage=true&shouldFireSellPageImplicitClaimGA=false&fromHomePageTab=buy
我想从洛杉矶的所有家庭中提取地址,价格,zestimates,地点等信息.
我已经尝试使用像BeautifulSoup这样的包进行HTML抓取.我也尝试过使用json.我几乎肯定Zillow的API没有帮助.我的理解是,API最适合收集特定属性的信息.
我已经能够从其他站点获取信息,但似乎Zillow使用动态ID(更改每次刷新)使得访问该信息变得更加困难.
更新: 尝试使用以下代码,但仍然没有产生任何结果
import requests
from bs4 import BeautifulSoup
url = 'https://www.zillow.com/homes/for_sale/Los-Angeles-CA_rb/?fromHomePage=true&shouldFireSellPageImplicitClaimGA=false&fromHomePageTab=buy'
page = requests.get(url)
data = page.content
soup = BeautifulSoup(data, 'html.parser')
for li in soup.find_all('div', {'class': 'zsg-photo-card-caption'}):
try:
#There is sponsored links in the list. You might need to take care
#of that
#Better check for null values which we are not doing in here
print(li.find('span', {'class': 'zsg-photo-card-price'}).text)
print(li.find('span', {'class': 'zsg-photo-card-info'}).text)
print(li.find('span', {'class': 'zsg-photo-card-address'}).text)
print(li.find('span', {'class': 'zsg-photo-card-broker-name'}).text)
except :
print('An error occured')
Run Code Online (Sandbox Code Playgroud)