source: trunk/src/series/lumin_calib.m @ 811

Last change on this file since 811 was 810, checked in by g7moreau, 10 years ago
  • Add license
File size: 3.8 KB
Line 
1% 'lumin_cali': check the luminosity of the camera lens versus distance to image center
2%----------------------------------------------------------------------
3
4%=======================================================================
5% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
6%   http://www.legi.grenoble-inp.fr
7%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
8%
9%     This file is part of the toolbox UVMAT.
10%
11%     UVMAT is free software; you can redistribute it and/or modify
12%     it under the terms of the GNU General Public License as published
13%     by the Free Software Foundation; either version 2 of the license,
14%     or (at your option) any later version.
15%
16%     UVMAT is distributed in the hope that it will be useful,
17%     but WITHOUT ANY WARRANTY; without even the implied warranty of
18%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19%     GNU General Public License (see LICENSE.txt) for more details.
20%=======================================================================
21
22function input_list=lumin_calib (num_i1,num_i2,num_j1,num_j2,Series)
23
24%display  request  of input parameters in the series interface (activated directly by the selection in the menu ACTION)
25input_list={'NbSlice';...%nbre of slices
26    'RootPath';... %path to the input root file
27    'RootFile';... %root input file name
28    'FileExt';... %input file extension
29    'NomType';...%type of file indexing
30    'SubDir';...% subdirectory of derived files (PIV fields)
31    };
32
33if ~exist('num_i1','var')
34    return %  used to display the right input data from input_list when the function is selected
35end
36for ilist=1:length(input_list)
37    eval([input_list{ilist} '= Series.' input_list{ilist} ';'])
38end
39
40%-----------------------------------------------------------------
41
42hRUN=findobj(Series.hseries,'Tag','RUN');
43hwaitbar=findobj(Series.hseries,'Tag','waitbar');
44waitbarpos(1)=Series.WaitbarPos(1);%x position of the waitbar
45waitbarpos(3)=Series.WaitbarPos(3);% width of the waitbar
46siz=size(num_i1);
47
48
49xpos(1:10)=[297 297 297 314 316 310 310 310 312 325];
50ypos(1:10)=[818 818 818 817 822 820 820 820 813 799];
51xpos(11:30)=[364 403 448 479 522 586 613 630 626 581 514 470 380 328 292 292 292 292 292 299];
52ypos(11:30)=[733 673 604 558 504 405 357 339 337 409 509 570 701 789 845 845 845 845 845 836];
53xpos(31:49)=[353 273 269 269 269 269 269 270 270 270 270 270 270 270 270 268 268 264 216 ];
54ypos(31:49)=[748 875 883 883 883 883 883 888 888 888 888 888 888 888 888 888 888 885 959];
55radius=50;
56Abackground=58.6;
57
58filebase=fullfile(Series.RootPath{1},Series.RootFile{1});
59dir_images=Series.RootPath{1};
60nom_type=Series.NomType{1};
61% filebad=zeros(size(num_i1));
62indbad=[21 22 30];%bad image
63file_index= 1:length(num_i1);
64ifile=0;
65for ifile= 1:length(num_i1)
66               [filename,idetect]=...
67                       name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt{1},Series.NomType{1});
68                 
69               A=imread(filename);
70               A=flipdim(A,1);
71               ind_x=[xpos(ifile)-radius:xpos(ifile)+radius];
72               ind_y=[ypos(ifile)-radius:ypos(ifile)+radius];
73               A=double(A(ind_y,ind_x))-Abackground;
74               [Xi,Yi]=meshgrid([-radius:+radius],[-radius:+radius]);
75%                distX=(Xi+radius+1);
76%                distY=(Yi+radius+1);
77               testin=(Xi.*Xi+Yi.*Yi)<=radius*radius;
78               testin=double(testin);
79               A=(A>0).*A.*double(testin);
80               Amean(ifile)=sum(sum(A))/sum(sum(testin));
81               
82end
83dist=((xpos-512).*(xpos-512))+((ypos-512).*(ypos-512));
84dist=dist/(512*512);
85file_index(indbad)=[];
86Amean(indbad)=[];
87dist(indbad)=[];
88figure(1)   
89plot(file_index,Amean,'+')   
90figure(2)
91haxes=axes;
92h=plot(dist,Amean,'+')
93xlabel('distance to image center (pixels)')
94ylabel('luminosity of reference  input dye solution')
95set(haxes,'YLim',[0 2850])
Note: See TracBrowser for help on using the repository browser.