Tuesday, June 14, 2016

Matlab: Image Data Procedure

[1] 特定目录下,全部影像文件对应像元DN数值:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% Created by LI Xu
% Version 1.0
% June 14, 2016

% Description:
% Recognize pixels

% If you have any question about this code,
% please do not hesitate to contact me via E-mail: 
% jeremy456@163.com

% Blog:
% http://blog.sciencenet.cn/u/lixujeremy
% http://lixuworld.blogspot.com/


function dns=GetDirDN(TarDir, index)

    dns=[];
    files=dir(fullfile(TarDir, '*.tif'));
    % Loop
    for ii=1:length(files)
        filename=files(ii).name;
        filepath=fullfile(TarDir, filename);
        image=imread(filepath);
        DN=image(index);
        dns=AddData(dns, DN);
    end


end

No comments:

Post a Comment