How to create RGB image with 3 bands from hyperspectral image?

5 views (last 30 days)
Duygu Ocal
Duygu Ocal on 16 Mar 2015
Commented: Walter Roberson on 28 Mar 2016
Hi, I have a Hyperion EO-1 satellite image and i want to create an RGB band with band numbers (40,31,13) as (R,G,B). The hyperion image has 242 bands. But I'm having trouble opening the L1R file properly.
I am using Matlab 2011, and 2014 hyperion image. I load the image with hdfinfo and hdfread commands like this;
hdfinfo('EO1H1930282003203110PY.L1R');
fileinfo = hdfinfo('EO1H1930282003203110PY.L1R');
sds_info = fileinfo.SDS(1);
hdfread(sds_info);
ans=imhdf;
But this loads a matrix [3128,242,256] , although it should be [3128,256,242] how can i fix this?
After loading the image as 3D matrix i try to create the RGB image with selecte 3 bands as shown below it creates [3128,3,256] matrix but I cant use imwrite, imshow or any other displaying functions on it.
imrgb [:,1,:] = imhdf [:,40,:];
imrgb [:,2,:] = imhdf [:,31,:];
imrgb [:,3,:] = imhdf [:,13,:];
image(imrgb);
Error using image
Error using image
Indexed CData must be size [MxN], TrueColor CData must be
size [MxNx3]
Please answer, thank you.

Answers (1)

tamer dnmzgllr
tamer dnmzgllr on 28 Mar 2016

merhabalar,

hemen hemen aynı işle uğraşmaktayım. 1 yıl önceki sorunuzu internette gördüm de. L1R formatındaki görüntüyü hdfinfo ve hdfread komutları kullandıktan sonra RGB image yaratmam gerekiyor. sorunuzdan sonraki çözümünüz nasıl oldu. paylaşabilirseniz sevinirim

Teşekkürler.

  1 Comment
Walter Roberson
Walter Roberson on 28 Mar 2016
Approximate translation:
Hello,
It was dealing with almost the same process. 1 year I saw your earlier question on the internet as well. After using image hdfinfo hdfread commands in L1 and I had to create RGB image format. Your next question was how your solution. I would appreciate if you could share
Thank you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!