colorbar not matching disparity image values
2 次查看(过去 30 天)
显示 更早的评论
I calculated a disparity image. Plotting this image, i use the following basic code:
figure
imshow(dispa)
title('Disparity Map1')
colormap jet
colorbar
The disparity image is a variable of type 478x638 double.
The result of the given plotting code shows me a colorbar, which does not match the colorbar:
I displayed an example DataTip. The 'value' of this pixel ist 38.5105. The colorbar is still going from 0 to 1.
If i extend the colorbar range, the colorbar becomes nearly completely red:
How can i display the disparity image with a suitable colorbar next to the disparity image?
回答(1 个)
Yash
2023-10-25
编辑:Yash
2023-10-25
Hi Ozan,
I understand that you are facing issues while plotting a disparity image using the "imshow" function.
According to the documentation (https://www.mathworks.com/help/images/ref/imshow.html), the function "imshow" uses the default display range for the image data type and optimizes figure, axes, and image object properties for image display. In this case, the default range is set from 0 to 1.
To address this issue, you can modify the default display range by providing the "DisplayRange" argument to the "imshow" function. For more information on how to use this argument, you can refer to the documentation at the following link: https://www.mathworks.com/help/images/ref/imshow.html#bvmnrxi-1-DisplayRange
You can modify the code to set the display range as shown below:
figure
imshow(dispa,[0 max(dispa)])
title('Disparity Map1')
colormap jet
colorbar
Alternatively, you can use the "imagesc" function to plot the image. The "imagesc" function displays the data in an array as an image, utilizing the full range of colors in the colormap. You can find more details about the "imagesc" function in the MATLAB documentation at the following link: https://www.mathworks.com/help/matlab/ref/imagesc.html
I hope this resolves the issue faced by you.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!