0
我有以下代碼來讀取CIF序列中的Y組件,這是拋出此錯誤。錯誤在函數重塑()在matlab
使用重整的錯誤 要重新設置元素的數量不得更改。
foremanOne中的錯誤(第12行) img_y = reshape(img_y,nColumn,nRow);
代碼
clc;
file = 'foreman.cif';
nFrame = 10;
[fid,message]= fopen(file,'rb');
nRow = 288;
nColumn = 352;
for i = 1: nFrame
%reading Y component
img_y = fread(fid, nRow * nColumn, 'uchar');
img_y = reshape(img_y, nColumn, nRow);
img_y = img_y';
imshow(uint8(img_y));
end
fclose(fid);
disp('OK');
什麼可能出現了問題?
感謝您的接受!我只注意到'ImY'被重新塑造成尺寸爲[nColumn,nRow]。由於在MATLAB中,行在索引過程中首先出現,所以您可能需要交換它們。 – 2015-02-07 05:26:21
我試圖執行代碼,但錯誤仍然是相同的! – Prashanth 2015-02-08 06:06:30
使用重整的錯誤 重新設置元素的數量不得更改。 foremanOne中的錯誤(第31行) ImY = reshape(img_y(:,:,k),nColumn,nRow); – Prashanth 2015-02-08 06:06:52