Displaying Multispectral Image in MATLAB
27 次查看(过去 30 天)
显示 更早的评论
I have multispectral image (data3.tif) which is raw image of 6 bands.
I used following code to read the image and matlab reads it properly no issues. I tried to seperate band 4 from raw image and displayed single band it is also works fine.
A=imread('data3.tif');
% b1=im2single(A(:,:,4));
but imshow(A) and imtool(A) doesnot works
i tried multibandread also it does not works.
Actually I need to train neural network for segmentation which accepts [256 256 6] as an input size. To do that first i need to display image (data3.tif) for cliping small patches from the raw data. My problem is imshow and imtool is shows an error if i use imshow(A) and imtool(A).
Question is
how To display multispectral image which has 6 bands in a single image ?
how to crop small patches from raw image?
If i cropped small patch in raw image whether it has same 6 bands?
link for image size 22MB
0 个评论
采纳的回答
Subhadeep Koley
2021-4-12
You can not use imshow(_) or imagesc(_) to display Multi-plane images having more than 3 channels.
cube = imread('data3.tif');
figure
sliceViewer(cube);
colormap parula
Moreover, if you have the wavelength corresponds to each plane of your multispectral image, you can construct a hypercube(_) object and use the colorize(_) method to generate RGB, CIR, or False-colored image. Also, you can crop your region of interest. Like below,
% Construct the hypercube object
hCube = hypercube('data3.tif', wavelength); % Here wavelength is a C-element vector. C is the number of bands
% Compute RGB image
rgbImg = colorize(hCube, 'method', 'rgb', 'ContrastStretching', true);
% Crop region of interest
row = 100:250;
column = 200:400;
bands = 1:6;
newHcube = cropData(hCube, row, column, bands);
NOTE: The above mentioned fetures come under Image Processing Toolbox's Hyperspectral Imaging Library support package, and can be downloaded from here. For more information on Hyperspectral Imaging Library see the documentation.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hyperspectral Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!