Real Time Disparity Map Project: Colormap Disparity not Recognized (OpenCV Python StereoBM)









up vote
1
down vote

favorite












My python code below is intended to get a real time disparity map with decent accuracy. Here is my code:



import cv2
import numpy as np
import sys
from matplotlib import pyplot as plt

cap = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture(2)
# Check if camera opened successfully
if (cap.isOpened()== False and cap2.isOpened()== False):
print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened() and cap2.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
ret2, frame2 = cap2.read()
if ret == True and ret2 == True:

# Display the resulting frame
cv2.imshow('Frame',frame)
cv2.imshow('Frame2',frame2)
framegray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame2gray = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
cv2.imshow('Gray1', framegray)
cv2.imshow('Gray2', frame2gray)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(framegray, frame2gray)
#minVal, maxVal, randval, dontcare = cv2.minMaxLoc(disparity)
#disparity.convertTo(dispweird, CV_8UC1, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
#disparitywithcolor = cv2.applyColorMap(dispweird, cv2.COLORMAP_JET)
plt.imshow(disparity,'disparity')
plt.show()
delay(1000)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break

# Break the loop
else:
break

# When everything done, release the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()


Here is my commmand line output:



Traceback (most recent call last): File "cameratest.py", line 31, in plt.imshow(disparity,'disparity') File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibpyplot.py", line 3205, in imshow **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlib__init__.py", line 1855, in inner return func(ax, *args, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibaxes_axes.py", line 5485, in imshow resample=resample, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 824, in init **kwargs File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 228, in init cm.ScalarMappable.init(self, norm, cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 203, in init self.cmap = get_cmap(cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 168, in get_cmap % (name, ', '.join(sorted(cmap_d)))) ValueError: Colormap disparity is not recognized. Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r



You can see from the commented out code that I tried to convert my disparity map output from stereoBM to an image so that I could colorize it, but for some reason, this isn't working. Please let me know if you have a solution for this issue.










share|improve this question



















  • 1




    The code you show is c code, not python. Where is the code that produces the python traceback? And what is imshow("disparity", disp8); doing? At the end the error tells you that "disparity" is not a valid colormap. So maybe you need to change that to imshow("viridis", disp8); but one can only guess here with the incomplete code provided.
    – ImportanceOfBeingErnest
    Nov 9 at 2:48










  • Hello Ernest, my bad! I pasted in the wrong code. Let me update the question
    – Adithya Shakthi Kumar
    Nov 9 at 14:02










  • Hello @ImportanceOfBeingErnest, I have just updated the code. Thank you for your help!
    – Adithya Shakthi Kumar
    Nov 9 at 14:04










  • Well, I guess my previous comment holds: You need to use a valid colormap, e.g. plt.imshow(disparity,'viridis')
    – ImportanceOfBeingErnest
    Nov 9 at 14:10










  • Hello Ernest, Thank you for your help! I actually solved this problem, so I will mark it solved, but I am now having an updated problem. Here is link: stackoverflow.com/questions/53230263/…
    – Adithya Shakthi Kumar
    Nov 9 at 17:02














up vote
1
down vote

favorite












My python code below is intended to get a real time disparity map with decent accuracy. Here is my code:



import cv2
import numpy as np
import sys
from matplotlib import pyplot as plt

cap = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture(2)
# Check if camera opened successfully
if (cap.isOpened()== False and cap2.isOpened()== False):
print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened() and cap2.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
ret2, frame2 = cap2.read()
if ret == True and ret2 == True:

# Display the resulting frame
cv2.imshow('Frame',frame)
cv2.imshow('Frame2',frame2)
framegray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame2gray = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
cv2.imshow('Gray1', framegray)
cv2.imshow('Gray2', frame2gray)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(framegray, frame2gray)
#minVal, maxVal, randval, dontcare = cv2.minMaxLoc(disparity)
#disparity.convertTo(dispweird, CV_8UC1, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
#disparitywithcolor = cv2.applyColorMap(dispweird, cv2.COLORMAP_JET)
plt.imshow(disparity,'disparity')
plt.show()
delay(1000)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break

# Break the loop
else:
break

# When everything done, release the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()


Here is my commmand line output:



Traceback (most recent call last): File "cameratest.py", line 31, in plt.imshow(disparity,'disparity') File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibpyplot.py", line 3205, in imshow **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlib__init__.py", line 1855, in inner return func(ax, *args, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibaxes_axes.py", line 5485, in imshow resample=resample, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 824, in init **kwargs File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 228, in init cm.ScalarMappable.init(self, norm, cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 203, in init self.cmap = get_cmap(cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 168, in get_cmap % (name, ', '.join(sorted(cmap_d)))) ValueError: Colormap disparity is not recognized. Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r



You can see from the commented out code that I tried to convert my disparity map output from stereoBM to an image so that I could colorize it, but for some reason, this isn't working. Please let me know if you have a solution for this issue.










share|improve this question



















  • 1




    The code you show is c code, not python. Where is the code that produces the python traceback? And what is imshow("disparity", disp8); doing? At the end the error tells you that "disparity" is not a valid colormap. So maybe you need to change that to imshow("viridis", disp8); but one can only guess here with the incomplete code provided.
    – ImportanceOfBeingErnest
    Nov 9 at 2:48










  • Hello Ernest, my bad! I pasted in the wrong code. Let me update the question
    – Adithya Shakthi Kumar
    Nov 9 at 14:02










  • Hello @ImportanceOfBeingErnest, I have just updated the code. Thank you for your help!
    – Adithya Shakthi Kumar
    Nov 9 at 14:04










  • Well, I guess my previous comment holds: You need to use a valid colormap, e.g. plt.imshow(disparity,'viridis')
    – ImportanceOfBeingErnest
    Nov 9 at 14:10










  • Hello Ernest, Thank you for your help! I actually solved this problem, so I will mark it solved, but I am now having an updated problem. Here is link: stackoverflow.com/questions/53230263/…
    – Adithya Shakthi Kumar
    Nov 9 at 17:02












up vote
1
down vote

favorite









up vote
1
down vote

favorite











My python code below is intended to get a real time disparity map with decent accuracy. Here is my code:



import cv2
import numpy as np
import sys
from matplotlib import pyplot as plt

cap = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture(2)
# Check if camera opened successfully
if (cap.isOpened()== False and cap2.isOpened()== False):
print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened() and cap2.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
ret2, frame2 = cap2.read()
if ret == True and ret2 == True:

# Display the resulting frame
cv2.imshow('Frame',frame)
cv2.imshow('Frame2',frame2)
framegray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame2gray = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
cv2.imshow('Gray1', framegray)
cv2.imshow('Gray2', frame2gray)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(framegray, frame2gray)
#minVal, maxVal, randval, dontcare = cv2.minMaxLoc(disparity)
#disparity.convertTo(dispweird, CV_8UC1, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
#disparitywithcolor = cv2.applyColorMap(dispweird, cv2.COLORMAP_JET)
plt.imshow(disparity,'disparity')
plt.show()
delay(1000)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break

# Break the loop
else:
break

# When everything done, release the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()


Here is my commmand line output:



Traceback (most recent call last): File "cameratest.py", line 31, in plt.imshow(disparity,'disparity') File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibpyplot.py", line 3205, in imshow **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlib__init__.py", line 1855, in inner return func(ax, *args, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibaxes_axes.py", line 5485, in imshow resample=resample, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 824, in init **kwargs File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 228, in init cm.ScalarMappable.init(self, norm, cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 203, in init self.cmap = get_cmap(cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 168, in get_cmap % (name, ', '.join(sorted(cmap_d)))) ValueError: Colormap disparity is not recognized. Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r



You can see from the commented out code that I tried to convert my disparity map output from stereoBM to an image so that I could colorize it, but for some reason, this isn't working. Please let me know if you have a solution for this issue.










share|improve this question















My python code below is intended to get a real time disparity map with decent accuracy. Here is my code:



import cv2
import numpy as np
import sys
from matplotlib import pyplot as plt

cap = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture(2)
# Check if camera opened successfully
if (cap.isOpened()== False and cap2.isOpened()== False):
print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened() and cap2.isOpened()):
# Capture frame-by-frame
ret, frame = cap.read()
ret2, frame2 = cap2.read()
if ret == True and ret2 == True:

# Display the resulting frame
cv2.imshow('Frame',frame)
cv2.imshow('Frame2',frame2)
framegray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame2gray = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY)
cv2.imshow('Gray1', framegray)
cv2.imshow('Gray2', frame2gray)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(framegray, frame2gray)
#minVal, maxVal, randval, dontcare = cv2.minMaxLoc(disparity)
#disparity.convertTo(dispweird, CV_8UC1, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
#disparitywithcolor = cv2.applyColorMap(dispweird, cv2.COLORMAP_JET)
plt.imshow(disparity,'disparity')
plt.show()
delay(1000)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break

# Break the loop
else:
break

# When everything done, release the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()


Here is my commmand line output:



Traceback (most recent call last): File "cameratest.py", line 31, in plt.imshow(disparity,'disparity') File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibpyplot.py", line 3205, in imshow **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlib__init__.py", line 1855, in inner return func(ax, *args, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibaxes_axes.py", line 5485, in imshow resample=resample, **kwargs) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 824, in init **kwargs File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibimage.py", line 228, in init cm.ScalarMappable.init(self, norm, cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 203, in init self.cmap = get_cmap(cmap) File "C:UsersAdithya KumarAppDataLocalProgramsPythonPython36-32libsite-packagesmatplotlibcm.py", line 168, in get_cmap % (name, ', '.join(sorted(cmap_d)))) ValueError: Colormap disparity is not recognized. Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r, gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, inferno, inferno_r, jet, jet_r, magma, magma_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r, viridis, viridis_r, winter, winter_r



You can see from the commented out code that I tried to convert my disparity map output from stereoBM to an image so that I could colorize it, but for some reason, this isn't working. Please let me know if you have a solution for this issue.







python python-3.x opencv matplotlib






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 14:04

























asked Nov 9 at 2:40









Adithya Shakthi Kumar

87




87







  • 1




    The code you show is c code, not python. Where is the code that produces the python traceback? And what is imshow("disparity", disp8); doing? At the end the error tells you that "disparity" is not a valid colormap. So maybe you need to change that to imshow("viridis", disp8); but one can only guess here with the incomplete code provided.
    – ImportanceOfBeingErnest
    Nov 9 at 2:48










  • Hello Ernest, my bad! I pasted in the wrong code. Let me update the question
    – Adithya Shakthi Kumar
    Nov 9 at 14:02










  • Hello @ImportanceOfBeingErnest, I have just updated the code. Thank you for your help!
    – Adithya Shakthi Kumar
    Nov 9 at 14:04










  • Well, I guess my previous comment holds: You need to use a valid colormap, e.g. plt.imshow(disparity,'viridis')
    – ImportanceOfBeingErnest
    Nov 9 at 14:10










  • Hello Ernest, Thank you for your help! I actually solved this problem, so I will mark it solved, but I am now having an updated problem. Here is link: stackoverflow.com/questions/53230263/…
    – Adithya Shakthi Kumar
    Nov 9 at 17:02












  • 1




    The code you show is c code, not python. Where is the code that produces the python traceback? And what is imshow("disparity", disp8); doing? At the end the error tells you that "disparity" is not a valid colormap. So maybe you need to change that to imshow("viridis", disp8); but one can only guess here with the incomplete code provided.
    – ImportanceOfBeingErnest
    Nov 9 at 2:48










  • Hello Ernest, my bad! I pasted in the wrong code. Let me update the question
    – Adithya Shakthi Kumar
    Nov 9 at 14:02










  • Hello @ImportanceOfBeingErnest, I have just updated the code. Thank you for your help!
    – Adithya Shakthi Kumar
    Nov 9 at 14:04










  • Well, I guess my previous comment holds: You need to use a valid colormap, e.g. plt.imshow(disparity,'viridis')
    – ImportanceOfBeingErnest
    Nov 9 at 14:10










  • Hello Ernest, Thank you for your help! I actually solved this problem, so I will mark it solved, but I am now having an updated problem. Here is link: stackoverflow.com/questions/53230263/…
    – Adithya Shakthi Kumar
    Nov 9 at 17:02







1




1




The code you show is c code, not python. Where is the code that produces the python traceback? And what is imshow("disparity", disp8); doing? At the end the error tells you that "disparity" is not a valid colormap. So maybe you need to change that to imshow("viridis", disp8); but one can only guess here with the incomplete code provided.
– ImportanceOfBeingErnest
Nov 9 at 2:48




The code you show is c code, not python. Where is the code that produces the python traceback? And what is imshow("disparity", disp8); doing? At the end the error tells you that "disparity" is not a valid colormap. So maybe you need to change that to imshow("viridis", disp8); but one can only guess here with the incomplete code provided.
– ImportanceOfBeingErnest
Nov 9 at 2:48












Hello Ernest, my bad! I pasted in the wrong code. Let me update the question
– Adithya Shakthi Kumar
Nov 9 at 14:02




Hello Ernest, my bad! I pasted in the wrong code. Let me update the question
– Adithya Shakthi Kumar
Nov 9 at 14:02












Hello @ImportanceOfBeingErnest, I have just updated the code. Thank you for your help!
– Adithya Shakthi Kumar
Nov 9 at 14:04




Hello @ImportanceOfBeingErnest, I have just updated the code. Thank you for your help!
– Adithya Shakthi Kumar
Nov 9 at 14:04












Well, I guess my previous comment holds: You need to use a valid colormap, e.g. plt.imshow(disparity,'viridis')
– ImportanceOfBeingErnest
Nov 9 at 14:10




Well, I guess my previous comment holds: You need to use a valid colormap, e.g. plt.imshow(disparity,'viridis')
– ImportanceOfBeingErnest
Nov 9 at 14:10












Hello Ernest, Thank you for your help! I actually solved this problem, so I will mark it solved, but I am now having an updated problem. Here is link: stackoverflow.com/questions/53230263/…
– Adithya Shakthi Kumar
Nov 9 at 17:02




Hello Ernest, Thank you for your help! I actually solved this problem, so I will mark it solved, but I am now having an updated problem. Here is link: stackoverflow.com/questions/53230263/…
– Adithya Shakthi Kumar
Nov 9 at 17:02

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219086%2freal-time-disparity-map-project-colormap-disparity-not-recognized-opencv-pytho%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219086%2freal-time-disparity-map-project-colormap-disparity-not-recognized-opencv-pytho%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo