可显示景深图

This commit is contained in:
家才 王 2019-04-29 09:50:26 +08:00
parent 81970320f8
commit 10c1c4c430
24 changed files with 57 additions and 0 deletions

1
.gitignore vendored
View File

@ -328,3 +328,4 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder # MFractors (Xamarin productivity tool) working folder
.mfractor/ .mfractor/
/1.png

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}

17
Stereo.py Normal file
View File

@ -0,0 +1,17 @@
import numpy as np
import matplotlib
import cv2
import os
from matplotlib import pyplot as plt
img = cv2.imread("1.png", 0)
imgL = np.split(img, 2, 1)[0]
imgR = np.split(img, 2, 1)[1]
stereo = cv2.StereoBM_create(numDisparities=32, blockSize=25)
disparity = stereo.compute(imgL, imgR)
plt.imshow(disparity)
plt.show()

23
StereoVidComfort.py Normal file
View File

@ -0,0 +1,23 @@
import ffmpeg
import numpy as np
import matplotlib
import cv2
import os
from matplotlib import pyplot as plt
imgDirs = os.listdir("./pic_en")
for imgDir in imgDirs:
dir = "./pic_en/"+imgDir
print (dir)
img = cv2.imread(dir, 0)
imgL = np.split(img, 2, 1)[0]
imgR = np.split(img, 2, 1)[1]
stereo = cv2.StereoBM_create(numDisparities=64, blockSize=11)
disparity = stereo.compute(imgL, imgR)
plt.imshow(disparity)
plt.show()

BIN
pic_cn/小巷.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

BIN
pic_cn/恐龙.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 KiB

BIN
pic_cn/林中小径.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 KiB

BIN
pic_cn/校园.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

BIN
pic_cn/楼梯.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
pic_cn/渡口.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

BIN
pic_cn/白鸽.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

BIN
pic_cn/花.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
pic_cn/铁塔.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

BIN
pic_cn/雪花.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

BIN
pic_en/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

BIN
pic_en/10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

BIN
pic_en/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

BIN
pic_en/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
pic_en/4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 KiB

BIN
pic_en/5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 KiB

BIN
pic_en/6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
pic_en/7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

BIN
pic_en/8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

BIN
pic_en/9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB