How can the image Processing of .tif file of size 763x1023x4 be done?
3 views (last 30 days)
I am using SEM files in .tif format for image processing using MATLAB to extract the edge, size, and area of the microstrtucture. The size of the file is 763x1024x4, The image is already in grayscale colour and I am not able to apply the command which I am leaning through Matlab online course. there are many errors showing just using imshow(file) command like
Error using images.internal.imageDisplayValidateParams>validateCData
Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.imageDisplayValidateParams (line 30)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 79)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 253)
Error in sample (line 5)
Kindly help me with solution, since I am stuck at beginning, so could not proceed with image segmentation, detection & analysing texture.
DGM on 10 May 2022
Edited: DGM on 10 May 2022
Imshow() can only represent 1-channel (grayscale) images or 3-channel images (represented as RGB).
So whatever you do to display a 4-channel image will depend on what the channels represent. Normally, if I see a 4-channel image, I expect that it's RGBA or CMYK. Alternatively, it could be some sort of multispectral image, so as with RGBA you'd have to know which channels are which in order to know how to split/view it. Maybe it's just a volumetric image with only 4 z-slices. Maybe it's not even conceptually volumetric, but merely four independent grayscale frames.
I'm not sure what conventions exist for SEM imaging. I'm guessing it's four independent grayscale frames. If that's the case, then you can just show the pages independently:
imshow(A(:,:,1)) % show just the first page/frame
Alternatively, you can use montage for a quick view of all pages.
A = imread('cameraman.tif');
A = cat(3,A,rot90(A,1),rot90(A,2),rot90(A,3)); % make a 4-channel image to test
% swap dim 4 and 3 so that montage correctly treats it as a multiframe image
% montage arranges the images row-wise (left-right, top-bottom)
montage(permute(A,[1 2 4 3]))