How can I read a RGB raw file in MATLAB?

232 Views Asked by At

I have a problem about reading a 8bit two-tap interleaved RGB raw file in MATLAB

I followed several answers in web, but I can not find exact form for my one.

Is there anyone can help this problem?

Following

How can I read in a RAW image in MATLAB?

I wrote lines like below.

imraw = fread(fin, row*col*3, '*uint8');
imraw = reshape(imraw,[col,row,3]);
imfinal = flip(imrotate(imraw, -90),2); % // The clever transpose
fclose(fin);
imshow(imfinal,[])

But, I think something wrong. With above code, a result is like this Example of the result from above lines

This image is enlarged image of a part of true image (about 1/8 of true image I guess).

T think something is messed up in line 2-3 (reshape, flip).

MY Raw file can be downloaded here

https://drive.google.com/drive/folders/1AWMpX3Rfm193M0xMkLJOZI0tPxjpsHsV?usp=sharing

And an example image in jpg is,

Example in jpg

Thank you!!


I solved this problem! I think, "two-tap interleaved" is not important.

How I solve this problem

  1. I investigated whole size of my raw file and I found it is 2048 X 2048 X 4.
  2. Zeros appears every 4th positions. (like, 10, 200, 100, 0, 50, 5, 70, 0 ...)
  3. I think my image structure is 20482048(3 RGB +1 garbage)
  4. So I get numbers from every first positions and get an image

enter image description here

So now, I think only thing I need to do is flip. haha I hope this text will help some other people who have same problem.

0

There are 0 best solutions below