日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python中xy坐标如何从十个中找到最远的两个_python – Opencv单应性从像素xy坐标中查找全局xy坐标...

發布時間:2025/3/11 python 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中xy坐标如何从十个中找到最远的两个_python – Opencv单应性从像素xy坐标中查找全局xy坐标... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我試圖找到變換矩陣H,以便我可以乘以(x,y)像素坐標并得到(x,y)真實世界坐標.這是我的代碼:

import cv2

import numpy as np

from numpy.linalg import inv

if __name__ == '__main__' :

D=[159.1,34.2]

I=[497.3,37.5]

G=[639.3,479.7]

A=[0,478.2]

# Read source image.

im_src = cv2.imread('/home/vivek/june_14.png')

# Four corners of the book in source image

pts_src = np.array([D,I,G,A])

# Read destination image.

im_dst = cv2.imread('/home/vivek/june_14.png')

# Four corners of the book in destination image.

print "img1 shape:",im_dst.shape

scale=1

O=[0.0,0.0]

X=[134.0*scale,0]

Y=[0.0,184.0*scale]

P=[134.0*scale,184.0*scale]

# lx = 75.5 * scale

# ly = 154.0 * scale

pts_dst = np.array([O,X,P,Y])

# Calculate Homography

h, status = cv2.findHomography(pts_src, pts_dst)

print "homography:",h

print "inv of H:",inv(h)

print "position of the blob on the ground xy plane:",np.dot(np.dot(h,np.array([[323.0],[120.0],[1.0]])),scale)

# Warp source image to destination based on homography

im_out = cv2.warpPerspective(im_src, h, (im_dst.shape[1],im_dst.shape[0]))

# Display images

cv2.imshow("Source Image", im_src)

cv2.imshow("Destination Image", im_dst)

cv2.imshow("Warped Source Image", im_out)

cv2.imwrite("im_out.jpg", im_out)

cv2.waitKey(0)

我得到的全球xy非常關閉.我在某處做錯了嗎?

總結

以上是生活随笔為你收集整理的python中xy坐标如何从十个中找到最远的两个_python – Opencv单应性从像素xy坐标中查找全局xy坐标...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。