讀取siftgeo格式檔案的matlab程式_siftgeo

來源:互聯網
上載者:User
% This function reads a siftgeo binary file %讀取siftgeo格式的二進位檔案%% Usage: [v, meta] = siftgeo_read (filename, maxdes)%   filename    the input filename%   maxdes      maximum number of descriptors to be loaded 要載入的描述子最大數量%   (default=unlimited)%預設無限制%% Returned values %傳回值%   v           the sift descriptors (1 descriptor per line) %每行一個sift描述子%   meta        meta data for each descriptor, i.e., per line: %每個描述子的中繼資料%               x, y, scale, angle, mi11, mi12, mi21, mi22, cornernessfunction [v, meta] = siftgeo_read (filename, maxdes) if nargin < 2 %nargin:number of arguments input %nargout:number of arguments ouput  maxdes = 100000000; %1億end  % open the file and count the number of descriptorsfid = fopen (filename, 'r'); fseek (fid, 0, 1); %fseek(fid, 0, 'eof'); 跳到檔案末尾 %'bof' or -1   Beginning of file;  'cof' or  0   Current position in file;  'eof' or  1   End of filen = ftell (fid) / (9 * 4 + 1 * 4 + 128); %n是descriptors的數量 %return the current position (number of bytes from the file beginning)fseek (fid, 0, -1); %fseek(fid, 0, 'bof') 跳到檔案開頭if n > maxdes  n = maxdes;end;% first read the meta information associated with the descriptormeta = zeros (n, 9, 'single'); %n*9矩陣v = zeros (n, 128, 'single'); %n*128矩陣% read the elementsfor i = 1:n %n是要讀區的descriptors數量  meta(i,:) = fread (fid, 9, 'float'); %(float)*9 中繼資料資訊  d = fread (fid, 1, 'int'); %(int)*1  v(i,:) = fread (fid, d, 'uint8=>single'); %(uint8=>single)*d 描述子endfclose (fid);

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.