当前位置:网站首页>ETH数据集下载及相关问题
ETH数据集下载及相关问题
2022-07-02 14:33:00 【LBJ_wz】
ETH数据集下载
存在问题
我尝试对其中的数据进行可视化,因为数据集给的数据是世界坐标系下的数据,我们希望在图片中进行展示,即将世界坐标系转为像素坐标系。按照H.txt中给出的但影星矩阵进行变换之后,发现了以下问题
代码如下:
class A:
def __init__(self):
self.h11 = 1.1048200e-02
self.h12 = 6.6958900e-04
self.h13 = -3.3295300e+00
self.h21 = -1.5966000e-03
self.h22 = 1.1632400e-02
self.h23 = -5.3951400e+00
self.h31 = 1.1190700e-04
self.h32 = 1.3617400e-05
self.h33 = 5.4276600e-01
self.P = np.array([
[self.h11,self.h12,self.h13],
[self.h21,self.h22,self.h23],
[self.h31,self.h32,self.h33]
])
self.P1 = inv(self.P)
def transform_coordinate(self, point):
# 输入像素点,返回世界坐标
x, y = point
x_ = (self.h11*x + self.h12*y + self.h13)/(self.h31*x + self.h32*y + self.h33)
y_ = (self.h21*x + self.h22*y + self.h23)/(self.h31*x + self.h32*y + self.h33)
return (x_,y_)
def w_to_p(self,point):
point_ = np.append(point,1)
p_point_ = np.matmul(self.P1,point_)
p_point_ /= p_point_[-1]
return p_point_[:-1]
其中transform_coordinate,w_to_p方法分别为像素坐标转世界坐标和世界坐标转像素坐标。
我们执行以下可视化代码,将obsmat.txt中的第一帧数据进行可视化
file_path = r"./ewap_dataset/seq_hotel/obsmat.txt"
data = pd.read_csv(file_path,header=None,sep='\s+',names=["frame_number", "human_id", "pos_x", "pos_z", "pos_y", "v_x", "v_z", "v_y" ])[["frame_number", "human_id", "pos_x", "pos_y"]]
data1 = data[data["frame_number"]==1]
a = A()
w_ps = []
for i,row in data1.iterrows():
point = np.array([row["pos_x"], row["pos_y"]])
w_p = a.w_to_p(point)
w_ps.append(w_p)
import cv2
img_path = r"./ewap_dataset/seq_hotel/jpg/1.jpg"
img = cv2.imread(img_path) # 读取图片
for i in w_ps:
cv2.circle(img, (int(i[0]), int(i[1])), 10, (0, 0, 255))
输出图片如下:
感觉好像不太对阿……不过代码看了好多遍都没有任何问题。
根据向师姐请教发现把x,y换一下位置即可正确输出
file_path = r"./ewap_dataset/seq_hotel/obsmat.txt"
data = pd.read_csv(file_path,header=None,sep='\s+',names=["frame_number", "human_id", "pos_x", "pos_z", "pos_y", "v_x", "v_z", "v_y" ])[["frame_number", "human_id", "pos_x", "pos_y"]]
data1 = data[data["frame_number"]==1]
a = A()
w_ps = []
for i,row in data1.iterrows():
point = np.array([row["pos_x"], row["pos_y"]])
w_p = a.w_to_p(point)
w_ps.append(w_p)
import cv2
img_path = r"./ewap_dataset/seq_hotel/jpg/1.jpg"
img = cv2.imread(img_path) # 读取图片
for i in w_ps:
cv2.circle(img, (int(i[1]), int(i[0])), 10, (0, 0, 255))

然后这里应该是数据给错了吧,或者是单应性矩阵给错了。个人感觉,如果有懂得大佬请指正!!
边栏推荐
- 绿竹生物冲刺港股:年期内亏损超5亿 泰格医药与北京亦庄是股东
- LeetCode 3. Longest substring without duplicate characters
- The macrogenome microbiome knowledge you want is all here (2022.7)
- 綠竹生物沖刺港股:年期內虧損超5億 泰格醫藥與北京亦莊是股東
- 剑指 Offer 22. 链表中倒数第k个节点
- VMware安装win10镜像
- MySQL port
- Day 18 of leetcode dynamic planning introduction
- Linux Installation PostgreSQL + Patroni cluster problem
- [essay solicitation activity] Dear developer, RT thread community calls you to contribute
猜你喜欢

【Leetcode】14. 最长公共前缀

Ap和F107数据来源及处理

移动应用性能工具探索之路

数字IC手撕代码--投票表决器

Geoserver: publishing PostGIS data sources

超卓航科上市:募资9亿市值超60亿 成襄阳首家科创板企业

PWM breathing lamp

亚马逊云科技 Community Builder 申请窗口开启

电脑自带软件使图片底色变为透明(抠图白底)

Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
随机推荐
綠竹生物沖刺港股:年期內虧損超5億 泰格醫藥與北京亦莊是股東
13、Darknet YOLO3
绿竹生物冲刺港股:年期内亏损超5亿 泰格医药与北京亦庄是股东
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
Yolov5 practice: teach object detection by hand
入行数字IC验证后会做些什么?
学习周刊-总第60期-2022年第25周
【Leetcode】14. 最长公共前缀
上传代码到远程仓库报错error: remote origin already exists.
What is the difference between JSP and servlet?
国内比较好的OJ平台[通俗易懂]
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
DigiCert SSL证书支持中文域名申请吗?
剑指 Offer 27. 二叉树的镜像
使用知行之桥的API端口,提供资源供合作伙伴访问
伟立控股港交所上市:市值5亿港元 为湖北贡献一个IPO
相信自己,这次一把搞定JVM面试
linux下配置Mysql授权某个用户远程访问,不受ip限制
[cloud native] briefly talk about the understanding of flume, a massive data collection component