将图像转换为CV2图像后,如何获得深度?

发布于 2025-01-26 13:53:59 字数 660 浏览 2 评论 0原文

作为一个凝视点,使用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)

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文