这里写自定义目录标题
matlab读raw图像数据解析matlab读raw图像数据解析
function img = read_raw(name, type, num) c_path = 'F:\xxx\test\';switch type case 'd64'file_name = [ c_path, name, '_', type, '_', num2str(num,'%04d'), '.raw'];fid = fopen(file_name, 'rb');src_img = fread(fid, 'double');img = double(reshape(src_img, 1280,1024)'); fclose(fid); case 'f32'file_name = [ c_path, name, '_', type, '_', num2str(num,'%04d'), '.raw'];fid = fopen(file_name, 'rb');src_img = fread(fid, 'single');img = double(reshape(src_img, 1280,1024)'); fclose(fid); case 'u16'file_name = [ c_path, name, '_', type, '_', num2str(num,'%04d'), '.raw'];fid = fopen(file_name, 'rb');src_img = fread(fid, 'uint16');img = double(reshape(src_img, 1280,1024)'); fclose(fid); case 'u8'file_name = [ c_path, name, '_', type, '_', num2str(num,'%04d'), '.raw'];fid = fopen(file_name, 'rb');src_img = fread(fid, 'uint8');img = double(reshape(src_img, 1280,1024)'); fclose(fid); otherwisewarning('Unexpected plot type. No plot created.')endendfk=100img = read_raw('c_prnu', 'u16', fk);%%读取文件 F:\xxx\test\c_prnu_u16_0100.raw的数据.imshow(img,[])