Filter löschen
Filter löschen

colorbar not matching disparity image values

2 Ansichten (letzte 30 Tage)
Ozan Anli
Ozan Anli am 23 Jun. 2022
Bearbeitet: Yash am 25 Okt. 2023
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?

Antworten (1)

Yash
Yash am 25 Okt. 2023
Bearbeitet: Yash am 25 Okt. 2023
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.

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by