I\'m checking out the ground truth segmentation masks of the pascal voc 2012 dataset. These are single channel 8-bit uint png files. However when I open these images in eith
Your image files contain indexed images, with an M-by-N index matrix and a P-by-3 colormap matrix. How can you tell? You need to get the second output from imread when loading your images:
[img, cmap] = imread('zuIra.png');
if isempty(cmap)
  % Process data as a grayscale or RGB image
else
  % Process data as an indexed image
end
If cmap is empty, your data is either an M-by-N grayscale intensity image or an M-by-N-by-3 Truecolor RGB image. Otherwise, you're dealing with an indexed color image, and will have to use both pieces of data in any processing of your image, such as viewing it with imshow:
imshow(img, cmap);
Or when resaving the data with imwrite:
imwrite(img, cmap, 'outfile.png');
If you would rather deal with a single image data matrix (which can make processing easier in some cases), you can convert the indexed image data and associated colormap into an RGB image with ind2rgb:
imgRGB = ind2rgb(img, cmap);