OpenCV---Python----Depth Map

來源:互聯網
上載者:User

標籤:block   pre   real   show   basic   err   rgb   odi   raspberry   

 

可以看看這篇部落格

http://blog.csdn.net/taily_duan/article/details/52165458

測試圖片可以從這裡找

https://www.raspberrypi.org/blog/real-time-depth-perception-with-the-compute-module/

以下兩行代碼似乎因為版本更替原因都無效了

deparsity = cv2.StereoBM(cv2.STEREO_BM_BASIC_PRESET,ndisparities=16, SADWindowSize=15)
deparsity = cv2.createStereoBM(numDisparities=16, blockSize=25)


#測試代碼如下:

# -*- coding: UTF-8 -*-import numpy as npimport cv2from matplotlib import pyplot as plt   #import the libraryleft_img = cv2.imread(‘Tsukuba_L.png‘,0)  #read the left_image(grey)left_img_rgb = cv2.imread(‘Tsukuba_L.png‘,cv2.IMREAD_COLOR) #read the left_image(colorful)right_img = cv2.imread(‘Tsukuba_R.png‘,0)      #read the right_image(grey)right_img_rgb = cv2.imread(‘Tsukuba_R.png‘,cv2.IMREAD_COLOR)  #read the right_image(colorful)matching=cv2.StereoBM_create(numDisparities=16, blockSize=15) #set the parameters of the stereodisparity = matching.compute(left_img,right_img) #make the depth mapcv2.imshow("left_img",left_img_rgb)    #show the left_image(colorful)cv2.imshow("right_img",right_img_rgb)  #show the right_image(colorful)plt.imshow(disparity,‘gray‘)           #show the depth map(grey)plt.show()

#

 

OpenCV---Python----Depth Map

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.