Naveen , open the image file using hex editor and you will find the binary equivalent of each pixel value . If you are using Linux then octal dump (od)command should do.
Best case: open it in C/C++ and read each unsigned char and check if pixel values are zeros..
Ah, I can see what you are trying: find matching points via squared differences.
This does not work ! As dispMap[] is already indicating. Thus further discussion of your algorithms is currently not considered.
How depth information is "normally" retrieved:
Locate "prominent" image elements in both images indpendently: corners, edges, borders and alike.
Find the corresponding elements in both images. The difference in relative coordinates of corresponding elements (pair-wise) gives the disparity (?) - better (relative) displacement - of each element pair.
Perform triangulation for each corresponding pair.
I suspect that you did not yet realize that depth information cannot be calculated for arbitrary image elements: this is the same as with human sight: seeing a grey plane without any edges does not allow for distance assessment. It's the edges, corners etc. that allows for depth assessment.
in a "true" disparity map of two stereo cameras with parallel axes there shouldn't occur any zeros, because a zero disparity corresponds to an infinite distance. In practice, however, zero values in the disparity map can result from finite accuracy / rounding effects or indicate that no match could be found for the corresponding image point. Zero disparity values can also be found regularly in a setting with converging (non-parallel) stereo cameras.