Error for Disparity Map Code: cv::StereoSGBMImpl::compute' (-215 OpenCV)
up vote
0
down vote
favorite
I am trying to create a high quality disparity map. However, my current disparity map's output is quite terrible. Here is my code for my current iteration:
from __future__ import print_function
import os
import numpy as np
import cv2 as cv
import time
ply_header = '''ply
format ascii 1.0
element vertex %(vert_num)d
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
'''
cap = cv.VideoCapture(0)
cap2 = cv.VideoCapture(2)
cap.set(3,640) # set Width
cap.set(4,480) # set Height
cap2.set(3,640) # set Width
cap2.set(4,480) # set Height
def write_ply(fn, verts, colors):
verts = verts.reshape(-1, 3)
colors = colors.reshape(-1, 3)
verts = np.hstack([verts, colors])
with open(fn, 'wb') as f:
f.write((ply_header % dict(vert_num=len(verts))).encode('utf-8'))
np.savetxt(f, verts, fmt='%f %f %f %d %d %d ')
while(True):
if __name__ == '__main__':
print('loading images...')
bool1, image1 = cap.read()
bool2, image2 = cap2.read()
cv.imwrite('opencvL'+'.jpg', image1)
cv.imwrite('opencvR'+'.jpg', image2)
imgL = cv.imread('opencvL.jpg') # downscale images for faster processing
imgR = cv.imread('opencvR.jpg')
# disparity range is tuned for 'aloe' image pair
window_size = 7
min_disp = 0
max_disp = 160
num_disp = 112-min_disp
stereo = cv.StereoSGBM_create(minDisparity = min_disp,
numDisparities = num_disp,
blockSize = 5,
P1 = 8*3*window_size**2,
P2 = 32*3*window_size**2,
disp12MaxDiff = 1,
uniquenessRatio = 15,
speckleWindowSize = 50,
speckleRange = 2
)
print('computing disparity...')
disp = stereo.compute(imgL, imgR).astype(np.float32) / 16.0
print('generating 3d point cloud...',)
h, w = imgL.shape[:2]
f = 0.8*w # guess for focal length
Q = np.float32([[1, 0, 0, -0.5*w],
[0,-1, 0, 0.5*h], # turn points 180 deg around x-axis,
[0, 0, 0, -f], # so that y-axis looks up
[0, 0, 1, 0]])
points = cv.reprojectImageTo3D(disp, Q)
colors = cv.cvtColor(imgL, cv.COLOR_BGR2RGB)
mask = disp > disp.min()
out_points = points[mask]
out_colors = colors[mask]
#out_fn = 'out.ply'
#write_ply('out.ply', out_points, out_colors)
#print('%s saved' % 'out.ply')
cv.imshow('left', imgL)
cv.imshow('right', imgR)
cv.imshow('disparity', (disp-min_disp)/num_disp)
os.remove("opencvL.jpg")
#os.remove("out.ply")
os.remove("opencvR.jpg")
if cv.waitKey(1) & 0xFF == ord('q'):
break
time.sleep(.1)
else:
break
# When everything done, release the capture
cap.release()
cv.destroyAllWindows()
This code works, but the output is horrible. It does not even resemble a disparity map. This is what I am getting:
Image of output
Hence, I tried another code that I found online with some edits. Here it is:
import numpy as np
from sklearn.preprocessing import normalize
import cv2
print('loading images...')
imgL = cv2.imread('left.jpg') # downscale images for faster processing
imgR = cv2.imread('right.jpg')
# SGBM Parameters -----------------
window_size = 3 # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
left_matcher = cv2.StereoSGBM_create(
minDisparity=0,
numDisparities=160, # max_disp has to be dividable by 16 f. E. HH 192, 256
blockSize=5,
P1=8 * 3 * window_size ** 2, # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
P2=32 * 3 * window_size ** 2,
disp12MaxDiff=1,
uniquenessRatio=15,
speckleWindowSize=0,
speckleRange=2,
preFilterCap=63,
mode=cv2.STEREO_SGBM_MODE_SGBM_3WAY
)
right_matcher = cv2.ximgproc.createRightMatcher(left_matcher)
# FILTER Parameters
lmbda = 80000
sigma = 1.2
visual_multiplier = 1.0
wls_filter = cv2.ximgproc.createDisparityWLSFilter(matcher_left=left_matcher)
wls_filter.setLambda(lmbda)
wls_filter.setSigmaColor(sigma)
print('computing disparity...')
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
dispr = right_matcher.compute(imgR, imgL) # .astype(np.float32)/16
displ = np.int16(displ)
dispr = np.int16(dispr)
filteredImg = wls_filter.filter(displ, imgL, None, dispr) # important to put "imgL" here!!!
filteredImg = cv2.normalize(src=filteredImg, dst=filteredImg, beta=0, alpha=255, norm_type=cv2.NORM_MINMAX);
filteredImg = np.uint8(filteredImg)
cv2.imshow('Disparity Map', filteredImg)
cv2.waitKey()
cv2.destroyAllWindows()
However, when I try to run this, this is my output from the command terminal:
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>python onlinefiltereddisparitymap.py
C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagessklearnexternalsjoblibexternalscloudpicklecloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
loading images...
computing disparity...
Traceback (most recent call last):
File "onlinefiltereddisparitymap.py", line 38, in <module>
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulescalib3dsrcstereosgbm.cpp:2156: error: (-215:Assertion failed) left.size() == right.size() && left.type() == right.type() && left.depth() == CV_8U in function 'cv::StereoSGBMImpl::compute'
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>
Any help would be much appreciated.
opencv
add a comment |
up vote
0
down vote
favorite
I am trying to create a high quality disparity map. However, my current disparity map's output is quite terrible. Here is my code for my current iteration:
from __future__ import print_function
import os
import numpy as np
import cv2 as cv
import time
ply_header = '''ply
format ascii 1.0
element vertex %(vert_num)d
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
'''
cap = cv.VideoCapture(0)
cap2 = cv.VideoCapture(2)
cap.set(3,640) # set Width
cap.set(4,480) # set Height
cap2.set(3,640) # set Width
cap2.set(4,480) # set Height
def write_ply(fn, verts, colors):
verts = verts.reshape(-1, 3)
colors = colors.reshape(-1, 3)
verts = np.hstack([verts, colors])
with open(fn, 'wb') as f:
f.write((ply_header % dict(vert_num=len(verts))).encode('utf-8'))
np.savetxt(f, verts, fmt='%f %f %f %d %d %d ')
while(True):
if __name__ == '__main__':
print('loading images...')
bool1, image1 = cap.read()
bool2, image2 = cap2.read()
cv.imwrite('opencvL'+'.jpg', image1)
cv.imwrite('opencvR'+'.jpg', image2)
imgL = cv.imread('opencvL.jpg') # downscale images for faster processing
imgR = cv.imread('opencvR.jpg')
# disparity range is tuned for 'aloe' image pair
window_size = 7
min_disp = 0
max_disp = 160
num_disp = 112-min_disp
stereo = cv.StereoSGBM_create(minDisparity = min_disp,
numDisparities = num_disp,
blockSize = 5,
P1 = 8*3*window_size**2,
P2 = 32*3*window_size**2,
disp12MaxDiff = 1,
uniquenessRatio = 15,
speckleWindowSize = 50,
speckleRange = 2
)
print('computing disparity...')
disp = stereo.compute(imgL, imgR).astype(np.float32) / 16.0
print('generating 3d point cloud...',)
h, w = imgL.shape[:2]
f = 0.8*w # guess for focal length
Q = np.float32([[1, 0, 0, -0.5*w],
[0,-1, 0, 0.5*h], # turn points 180 deg around x-axis,
[0, 0, 0, -f], # so that y-axis looks up
[0, 0, 1, 0]])
points = cv.reprojectImageTo3D(disp, Q)
colors = cv.cvtColor(imgL, cv.COLOR_BGR2RGB)
mask = disp > disp.min()
out_points = points[mask]
out_colors = colors[mask]
#out_fn = 'out.ply'
#write_ply('out.ply', out_points, out_colors)
#print('%s saved' % 'out.ply')
cv.imshow('left', imgL)
cv.imshow('right', imgR)
cv.imshow('disparity', (disp-min_disp)/num_disp)
os.remove("opencvL.jpg")
#os.remove("out.ply")
os.remove("opencvR.jpg")
if cv.waitKey(1) & 0xFF == ord('q'):
break
time.sleep(.1)
else:
break
# When everything done, release the capture
cap.release()
cv.destroyAllWindows()
This code works, but the output is horrible. It does not even resemble a disparity map. This is what I am getting:
Image of output
Hence, I tried another code that I found online with some edits. Here it is:
import numpy as np
from sklearn.preprocessing import normalize
import cv2
print('loading images...')
imgL = cv2.imread('left.jpg') # downscale images for faster processing
imgR = cv2.imread('right.jpg')
# SGBM Parameters -----------------
window_size = 3 # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
left_matcher = cv2.StereoSGBM_create(
minDisparity=0,
numDisparities=160, # max_disp has to be dividable by 16 f. E. HH 192, 256
blockSize=5,
P1=8 * 3 * window_size ** 2, # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
P2=32 * 3 * window_size ** 2,
disp12MaxDiff=1,
uniquenessRatio=15,
speckleWindowSize=0,
speckleRange=2,
preFilterCap=63,
mode=cv2.STEREO_SGBM_MODE_SGBM_3WAY
)
right_matcher = cv2.ximgproc.createRightMatcher(left_matcher)
# FILTER Parameters
lmbda = 80000
sigma = 1.2
visual_multiplier = 1.0
wls_filter = cv2.ximgproc.createDisparityWLSFilter(matcher_left=left_matcher)
wls_filter.setLambda(lmbda)
wls_filter.setSigmaColor(sigma)
print('computing disparity...')
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
dispr = right_matcher.compute(imgR, imgL) # .astype(np.float32)/16
displ = np.int16(displ)
dispr = np.int16(dispr)
filteredImg = wls_filter.filter(displ, imgL, None, dispr) # important to put "imgL" here!!!
filteredImg = cv2.normalize(src=filteredImg, dst=filteredImg, beta=0, alpha=255, norm_type=cv2.NORM_MINMAX);
filteredImg = np.uint8(filteredImg)
cv2.imshow('Disparity Map', filteredImg)
cv2.waitKey()
cv2.destroyAllWindows()
However, when I try to run this, this is my output from the command terminal:
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>python onlinefiltereddisparitymap.py
C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagessklearnexternalsjoblibexternalscloudpicklecloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
loading images...
computing disparity...
Traceback (most recent call last):
File "onlinefiltereddisparitymap.py", line 38, in <module>
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulescalib3dsrcstereosgbm.cpp:2156: error: (-215:Assertion failed) left.size() == right.size() && left.type() == right.type() && left.depth() == CV_8U in function 'cv::StereoSGBMImpl::compute'
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>
Any help would be much appreciated.
opencv
That error message is quite clear -- either the two inputs aren't the same shape, type, or they're not holding 8bit unsigned integers. So, inspect the inputs are make sure they satisfy the requirements.
– Dan Mašek
Nov 9 at 17:13
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to create a high quality disparity map. However, my current disparity map's output is quite terrible. Here is my code for my current iteration:
from __future__ import print_function
import os
import numpy as np
import cv2 as cv
import time
ply_header = '''ply
format ascii 1.0
element vertex %(vert_num)d
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
'''
cap = cv.VideoCapture(0)
cap2 = cv.VideoCapture(2)
cap.set(3,640) # set Width
cap.set(4,480) # set Height
cap2.set(3,640) # set Width
cap2.set(4,480) # set Height
def write_ply(fn, verts, colors):
verts = verts.reshape(-1, 3)
colors = colors.reshape(-1, 3)
verts = np.hstack([verts, colors])
with open(fn, 'wb') as f:
f.write((ply_header % dict(vert_num=len(verts))).encode('utf-8'))
np.savetxt(f, verts, fmt='%f %f %f %d %d %d ')
while(True):
if __name__ == '__main__':
print('loading images...')
bool1, image1 = cap.read()
bool2, image2 = cap2.read()
cv.imwrite('opencvL'+'.jpg', image1)
cv.imwrite('opencvR'+'.jpg', image2)
imgL = cv.imread('opencvL.jpg') # downscale images for faster processing
imgR = cv.imread('opencvR.jpg')
# disparity range is tuned for 'aloe' image pair
window_size = 7
min_disp = 0
max_disp = 160
num_disp = 112-min_disp
stereo = cv.StereoSGBM_create(minDisparity = min_disp,
numDisparities = num_disp,
blockSize = 5,
P1 = 8*3*window_size**2,
P2 = 32*3*window_size**2,
disp12MaxDiff = 1,
uniquenessRatio = 15,
speckleWindowSize = 50,
speckleRange = 2
)
print('computing disparity...')
disp = stereo.compute(imgL, imgR).astype(np.float32) / 16.0
print('generating 3d point cloud...',)
h, w = imgL.shape[:2]
f = 0.8*w # guess for focal length
Q = np.float32([[1, 0, 0, -0.5*w],
[0,-1, 0, 0.5*h], # turn points 180 deg around x-axis,
[0, 0, 0, -f], # so that y-axis looks up
[0, 0, 1, 0]])
points = cv.reprojectImageTo3D(disp, Q)
colors = cv.cvtColor(imgL, cv.COLOR_BGR2RGB)
mask = disp > disp.min()
out_points = points[mask]
out_colors = colors[mask]
#out_fn = 'out.ply'
#write_ply('out.ply', out_points, out_colors)
#print('%s saved' % 'out.ply')
cv.imshow('left', imgL)
cv.imshow('right', imgR)
cv.imshow('disparity', (disp-min_disp)/num_disp)
os.remove("opencvL.jpg")
#os.remove("out.ply")
os.remove("opencvR.jpg")
if cv.waitKey(1) & 0xFF == ord('q'):
break
time.sleep(.1)
else:
break
# When everything done, release the capture
cap.release()
cv.destroyAllWindows()
This code works, but the output is horrible. It does not even resemble a disparity map. This is what I am getting:
Image of output
Hence, I tried another code that I found online with some edits. Here it is:
import numpy as np
from sklearn.preprocessing import normalize
import cv2
print('loading images...')
imgL = cv2.imread('left.jpg') # downscale images for faster processing
imgR = cv2.imread('right.jpg')
# SGBM Parameters -----------------
window_size = 3 # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
left_matcher = cv2.StereoSGBM_create(
minDisparity=0,
numDisparities=160, # max_disp has to be dividable by 16 f. E. HH 192, 256
blockSize=5,
P1=8 * 3 * window_size ** 2, # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
P2=32 * 3 * window_size ** 2,
disp12MaxDiff=1,
uniquenessRatio=15,
speckleWindowSize=0,
speckleRange=2,
preFilterCap=63,
mode=cv2.STEREO_SGBM_MODE_SGBM_3WAY
)
right_matcher = cv2.ximgproc.createRightMatcher(left_matcher)
# FILTER Parameters
lmbda = 80000
sigma = 1.2
visual_multiplier = 1.0
wls_filter = cv2.ximgproc.createDisparityWLSFilter(matcher_left=left_matcher)
wls_filter.setLambda(lmbda)
wls_filter.setSigmaColor(sigma)
print('computing disparity...')
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
dispr = right_matcher.compute(imgR, imgL) # .astype(np.float32)/16
displ = np.int16(displ)
dispr = np.int16(dispr)
filteredImg = wls_filter.filter(displ, imgL, None, dispr) # important to put "imgL" here!!!
filteredImg = cv2.normalize(src=filteredImg, dst=filteredImg, beta=0, alpha=255, norm_type=cv2.NORM_MINMAX);
filteredImg = np.uint8(filteredImg)
cv2.imshow('Disparity Map', filteredImg)
cv2.waitKey()
cv2.destroyAllWindows()
However, when I try to run this, this is my output from the command terminal:
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>python onlinefiltereddisparitymap.py
C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagessklearnexternalsjoblibexternalscloudpicklecloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
loading images...
computing disparity...
Traceback (most recent call last):
File "onlinefiltereddisparitymap.py", line 38, in <module>
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulescalib3dsrcstereosgbm.cpp:2156: error: (-215:Assertion failed) left.size() == right.size() && left.type() == right.type() && left.depth() == CV_8U in function 'cv::StereoSGBMImpl::compute'
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>
Any help would be much appreciated.
opencv
I am trying to create a high quality disparity map. However, my current disparity map's output is quite terrible. Here is my code for my current iteration:
from __future__ import print_function
import os
import numpy as np
import cv2 as cv
import time
ply_header = '''ply
format ascii 1.0
element vertex %(vert_num)d
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
'''
cap = cv.VideoCapture(0)
cap2 = cv.VideoCapture(2)
cap.set(3,640) # set Width
cap.set(4,480) # set Height
cap2.set(3,640) # set Width
cap2.set(4,480) # set Height
def write_ply(fn, verts, colors):
verts = verts.reshape(-1, 3)
colors = colors.reshape(-1, 3)
verts = np.hstack([verts, colors])
with open(fn, 'wb') as f:
f.write((ply_header % dict(vert_num=len(verts))).encode('utf-8'))
np.savetxt(f, verts, fmt='%f %f %f %d %d %d ')
while(True):
if __name__ == '__main__':
print('loading images...')
bool1, image1 = cap.read()
bool2, image2 = cap2.read()
cv.imwrite('opencvL'+'.jpg', image1)
cv.imwrite('opencvR'+'.jpg', image2)
imgL = cv.imread('opencvL.jpg') # downscale images for faster processing
imgR = cv.imread('opencvR.jpg')
# disparity range is tuned for 'aloe' image pair
window_size = 7
min_disp = 0
max_disp = 160
num_disp = 112-min_disp
stereo = cv.StereoSGBM_create(minDisparity = min_disp,
numDisparities = num_disp,
blockSize = 5,
P1 = 8*3*window_size**2,
P2 = 32*3*window_size**2,
disp12MaxDiff = 1,
uniquenessRatio = 15,
speckleWindowSize = 50,
speckleRange = 2
)
print('computing disparity...')
disp = stereo.compute(imgL, imgR).astype(np.float32) / 16.0
print('generating 3d point cloud...',)
h, w = imgL.shape[:2]
f = 0.8*w # guess for focal length
Q = np.float32([[1, 0, 0, -0.5*w],
[0,-1, 0, 0.5*h], # turn points 180 deg around x-axis,
[0, 0, 0, -f], # so that y-axis looks up
[0, 0, 1, 0]])
points = cv.reprojectImageTo3D(disp, Q)
colors = cv.cvtColor(imgL, cv.COLOR_BGR2RGB)
mask = disp > disp.min()
out_points = points[mask]
out_colors = colors[mask]
#out_fn = 'out.ply'
#write_ply('out.ply', out_points, out_colors)
#print('%s saved' % 'out.ply')
cv.imshow('left', imgL)
cv.imshow('right', imgR)
cv.imshow('disparity', (disp-min_disp)/num_disp)
os.remove("opencvL.jpg")
#os.remove("out.ply")
os.remove("opencvR.jpg")
if cv.waitKey(1) & 0xFF == ord('q'):
break
time.sleep(.1)
else:
break
# When everything done, release the capture
cap.release()
cv.destroyAllWindows()
This code works, but the output is horrible. It does not even resemble a disparity map. This is what I am getting:
Image of output
Hence, I tried another code that I found online with some edits. Here it is:
import numpy as np
from sklearn.preprocessing import normalize
import cv2
print('loading images...')
imgL = cv2.imread('left.jpg') # downscale images for faster processing
imgR = cv2.imread('right.jpg')
# SGBM Parameters -----------------
window_size = 3 # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
left_matcher = cv2.StereoSGBM_create(
minDisparity=0,
numDisparities=160, # max_disp has to be dividable by 16 f. E. HH 192, 256
blockSize=5,
P1=8 * 3 * window_size ** 2, # wsize default 3; 5; 7 for SGBM reduced size image; 15 for SGBM full size image (1300px and above); 5 Works nicely
P2=32 * 3 * window_size ** 2,
disp12MaxDiff=1,
uniquenessRatio=15,
speckleWindowSize=0,
speckleRange=2,
preFilterCap=63,
mode=cv2.STEREO_SGBM_MODE_SGBM_3WAY
)
right_matcher = cv2.ximgproc.createRightMatcher(left_matcher)
# FILTER Parameters
lmbda = 80000
sigma = 1.2
visual_multiplier = 1.0
wls_filter = cv2.ximgproc.createDisparityWLSFilter(matcher_left=left_matcher)
wls_filter.setLambda(lmbda)
wls_filter.setSigmaColor(sigma)
print('computing disparity...')
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
dispr = right_matcher.compute(imgR, imgL) # .astype(np.float32)/16
displ = np.int16(displ)
dispr = np.int16(dispr)
filteredImg = wls_filter.filter(displ, imgL, None, dispr) # important to put "imgL" here!!!
filteredImg = cv2.normalize(src=filteredImg, dst=filteredImg, beta=0, alpha=255, norm_type=cv2.NORM_MINMAX);
filteredImg = np.uint8(filteredImg)
cv2.imshow('Disparity Map', filteredImg)
cv2.waitKey()
cv2.destroyAllWindows()
However, when I try to run this, this is my output from the command terminal:
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>python onlinefiltereddisparitymap.py
C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagessklearnexternalsjoblibexternalscloudpicklecloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
loading images...
computing disparity...
Traceback (most recent call last):
File "onlinefiltereddisparitymap.py", line 38, in <module>
displ = left_matcher.compute(imgL, imgR) # .astype(np.float32)/16
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmodulescalib3dsrcstereosgbm.cpp:2156: error: (-215:Assertion failed) left.size() == right.size() && left.type() == right.type() && left.depth() == CV_8U in function 'cv::StereoSGBMImpl::compute'
C:UsersAdithya KumarDesktopsciencefair18githubSciencefair2018-19>
Any help would be much appreciated.
opencv
opencv
asked Nov 9 at 17:02
Adithya Shakthi Kumar
87
87
That error message is quite clear -- either the two inputs aren't the same shape, type, or they're not holding 8bit unsigned integers. So, inspect the inputs are make sure they satisfy the requirements.
– Dan Mašek
Nov 9 at 17:13
add a comment |
That error message is quite clear -- either the two inputs aren't the same shape, type, or they're not holding 8bit unsigned integers. So, inspect the inputs are make sure they satisfy the requirements.
– Dan Mašek
Nov 9 at 17:13
That error message is quite clear -- either the two inputs aren't the same shape, type, or they're not holding 8bit unsigned integers. So, inspect the inputs are make sure they satisfy the requirements.
– Dan Mašek
Nov 9 at 17:13
That error message is quite clear -- either the two inputs aren't the same shape, type, or they're not holding 8bit unsigned integers. So, inspect the inputs are make sure they satisfy the requirements.
– Dan Mašek
Nov 9 at 17:13
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230263%2ferror-for-disparity-map-code-cvstereosgbmimplcompute-215-opencv%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
That error message is quite clear -- either the two inputs aren't the same shape, type, or they're not holding 8bit unsigned integers. So, inspect the inputs are make sure they satisfy the requirements.
– Dan Mašek
Nov 9 at 17:13