将图像转换为CV2图像后,如何获得深度?
作为一个凝视点,使用CV2创建图像,这是黑白图像。
self.depth = .... #numpy array with x,y = depth
cv2.imwrite(self.depth) #saved as jpg
在稍后,我需要转换回去以获取深度值。
image = cv2.imread(path)
self.depth_array = np.array(image, dtype=np.float32)
但是在此数组中,所有值均在0或255之间,而在self中。深度数组值不同,例如10,3; 11,5; 18,5; ETC。 是否可以将CV2图像转换为具有深度值的[X,Y]数组?
PS
我最近尝试了下面提供的代码,但它仍然给我0.0和255.0值:
cv2.imread(path, cv2.IMREAD_UNCHANGED)
As a staring point, an image was created using cv2, this is a black-white image.
self.depth = .... #numpy array with x,y = depth
cv2.imwrite(self.depth) #saved as jpg
Later in my code I need to convert back to get values of depth.
image = cv2.imread(path)
self.depth_array = np.array(image, dtype=np.float32)
But in this array all values are between 0 or 255, while in self.depth array values were different, e.g. 10,3; 11,5; 18,5; etc.
Is it possible tO convert back cv2 image to get [x,y] array with depth values?
P.S.
I've recently tried code provided under, but it still gives me 0.0 and 255.0 values:
cv2.imread(path, cv2.IMREAD_UNCHANGED)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论