[英]moving image with cv2
I applied the image to the background, but I can't figure out how to move it around.我将图像应用于背景,但我不知道如何移动它。
That's more or less what it looks like:这或多或少是这样的:
This is my code (I take it from here ):这是我的代码(我从这里获取):
# GUI
background = cv2.imread('BG2.png')
overlay = cv2.imread('beacon.png')
rows,cols,channels = overlay.shape
overlay=cv2.addWeighted(background[250:250+rows, 0:0+cols],0.5,overlay,0.5,0)
background[250:250+rows, 0:0+cols ] = overlay
# Display the image
cv2.imshow("Composited image", background)
cv2.waitKey(0)
I would like to be able to move the dot in real time, but I can't change its position.我希望能够实时移动点,但我无法更改它的 position。
Just overlaying the images took me a while.只是叠加图像花了我一段时间。 I checked the code from these topics before, but none worked:我之前检查了这些主题的代码,但没有一个有效:
If you want to carry out image transformations only by means of cv2, use affine transformations: cv2.warpAffine如果只想通过 cv2 进行图像变换,请使用仿射变换: cv2.warpAffine
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.