필터 지우기
필터 지우기

How to create RGB image from multispectral image?

조회 수: 7 (최근 30일)
User1
User1 2022년 10월 7일
답변: Image Analyst 2022년 11월 30일
I am trying to extract certain bands under the name of 'red', 'green', 'blue' from hyperspcetral image, then to combine them and create the 'RGB' version of the image. here is the code I tried but I get error when I combine. paviaU variable has the following dimenstions '610x340x103' as I know '103' is the number of bands. What are your suggestions here? What am I doing wrong? Is there a better method?
image=paviaU;
blue=image(:,:,7);
green=image(:,:,21);
red=image(:,:,53);
figure; imshow(blue, []); figure; imshow(green, []); figure; imshow(red, []);
rgbImage = image(3, red,green,blue); &line where I get the error
imshow(rgbImage);

답변 (3개)

Benjamin Thompson
Benjamin Thompson 2022년 10월 7일
I don't see in the documentation of the image function that it accepts a parameter list like you are using.
You can combine the red, green, and blue matrices together yourself:
rgbImage = red;
rgbImage(:,:,2) = green;
rgbImage(:,:,3) = blue;
Then you can probably use imshow to display it. You did not attach a sample image for reference so I cannot test this myself.

Parth Parikh
Parth Parikh 2022년 11월 30일
Hi,
Try below code for generating the RGB image.
hcube = hypercube('PaviaU.dat');
rgbImg = colorize(hcube, 'Method','rgb','ContrastStretching',true);
imshow(rgbImg);
In case you have PaviaU data in the .mat file than, you can create a hypercube object using below syntax.
hcube = hypercube(paviaUData, wavelengths);
For more information take a look at the documentation:

Image Analyst
Image Analyst 2022년 11월 30일

카테고리

Help CenterFile Exchange에서 Hyperspectral Image Processing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by