0

I am trying to read a RAW16 image in MATLAB. After going through another question here on StackOverflow, I figured I could read it like reading a file and then doing some simple matrix transposes. However, I am running into a weird problem. The image below is what I am gettingWeird overlap. I do not understand why this overlap exists and am not entirely sure how to solve the issue. Could someone help?

Code:

fin = fopen('raw13.raw','r');
ima = fread(fin, [col*2 row],'uint8');
temp = zeros(col,row);
j=1;
for i=1:2:col*2-1
temp(j,:) = ima(i,:) + ima(i+1,:)*2^8; %The first element is the lower 8bits and the second element is the higher 8bits
j = j+1;
end
imshow(temp',[0 2^16-1])
Community
  • 1
  • 1
Mathews_M_J
  • 457
  • 4
  • 15

2 Answers2

0

In case anyone is having the same problem as me.

It seems the .RAW file that I obtained was somehow corrupted. Using a lower version of the FlyCapture program resulted in a better RAW file and the code that I used worked like a charm

Mathews_M_J
  • 457
  • 4
  • 15
0

I use col*3 in line 3 and line 5, then it displays the image well. but i use 8 bit raw image form pointgray camera,and i dont know 'imshow(temp',[0 2^16-1])' would work...

Windsor_Gu
  • 29
  • 2