MATLAB: TIF image not reading and displaying correctly, displaying as black

image processing

The tif file I uploaded here (actually it one of the 15,000 images) seems not right when I read it into matlab and display it:
img = imread('Image6119.tif')
imshow(img(:,:,1:3)) % 1~4 channel is R, G, B, Near Infrared
whos img
Name Size Bytes Class Attributes
Image6119 626x1484x4 7431872 uint16
Actually these tif images used to work correctly in my previous work (also 4 bands images), but I'm not sure why this does not work any more. These images were clipped from a big raster using ArcGIS, and they are displaying correctly in ArcGIS (I took a snapshot, see png file).
Now I'm pretty sure the data is not loaded correctly, not just a issue of displaying, because the program I ran based on the data leads to extremely low percentage of vegetation 0.04% (as you can see from the png picture, it is nor right, and I'm pretty sure that the program is right, because I wrote it for previous project and here I only changed the input image file to this tif file). Actually I followed this link to calculate the percentage of vegetation within an image.
I have been struggling guys, any help would appreciate.

Best Answer

The problem seems to be that the image data is uint16 and the maximum value across all dimensions is no more 255:
>> I = imread('Image6119.tif');
>> J = I(:,:,1:3);
>> class(J)
ans =
uint16
>> max(max(J))
ans(:,:,1) =
256
ans(:,:,2) =
246
ans(:,:,3) =
255
Given these values for the uint16 data type, then it seems reasonable that the image would appear as all black.
If I cast the image data type to uint8, then the image appears as expected
>> imshow(uint8(J));
EDIT or rather than casting, could just multiply J by 65535/255=257 to map the 8-bit unsigned integers to 16-bit "equivalents":
>> imshow(J*257)