我想在MATLAB中讀取RAW16 image。在通過另一個question here on StackOverflow之後,我想我可以像閱讀文件一樣閱讀它,然後做一些簡單的矩陣轉置。但是,我遇到了一個奇怪的問題。下面的圖片是我得到的。我不明白爲什麼存在這種重疊,我不完全確定如何解決這個問題。有人可以幫忙嗎?在MATLAB中讀取RAW16圖像
代碼:
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])
期望的大小,即col和row是什麼? – Marcin
column = 1384 and rows = 1036.我拿col * 2是因爲當我從緩衝區讀取MONO16信息時,它是兩個字節,即stride = col * 2 –