1 | % 'lumin_cali': check the luminosity of the camera lens versus distance to image center |
---|
2 | %---------------------------------------------------------------------- |
---|
3 | |
---|
4 | %======================================================================= |
---|
5 | % Copyright 2008-2018, LEGI UMR 5519 / CNRS UGA 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 | |
---|
22 | function 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) |
---|
25 | input_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 | |
---|
33 | if ~exist('num_i1','var') |
---|
34 | return % used to display the right input data from input_list when the function is selected |
---|
35 | end |
---|
36 | for ilist=1:length(input_list) |
---|
37 | eval([input_list{ilist} '= Series.' input_list{ilist} ';']) |
---|
38 | end |
---|
39 | |
---|
40 | %----------------------------------------------------------------- |
---|
41 | |
---|
42 | hRUN=findobj(Series.hseries,'Tag','RUN'); |
---|
43 | hwaitbar=findobj(Series.hseries,'Tag','waitbar'); |
---|
44 | waitbarpos(1)=Series.WaitbarPos(1);%x position of the waitbar |
---|
45 | waitbarpos(3)=Series.WaitbarPos(3);% width of the waitbar |
---|
46 | siz=size(num_i1); |
---|
47 | |
---|
48 | |
---|
49 | xpos(1:10)=[297 297 297 314 316 310 310 310 312 325]; |
---|
50 | ypos(1:10)=[818 818 818 817 822 820 820 820 813 799]; |
---|
51 | xpos(11:30)=[364 403 448 479 522 586 613 630 626 581 514 470 380 328 292 292 292 292 292 299]; |
---|
52 | ypos(11:30)=[733 673 604 558 504 405 357 339 337 409 509 570 701 789 845 845 845 845 845 836]; |
---|
53 | xpos(31:49)=[353 273 269 269 269 269 269 270 270 270 270 270 270 270 270 268 268 264 216 ]; |
---|
54 | ypos(31:49)=[748 875 883 883 883 883 883 888 888 888 888 888 888 888 888 888 888 885 959]; |
---|
55 | radius=50; |
---|
56 | Abackground=58.6; |
---|
57 | |
---|
58 | filebase=fullfile(Series.RootPath{1},Series.RootFile{1}); |
---|
59 | dir_images=Series.RootPath{1}; |
---|
60 | nom_type=Series.NomType{1}; |
---|
61 | % filebad=zeros(size(num_i1)); |
---|
62 | indbad=[21 22 30];%bad image |
---|
63 | file_index= 1:length(num_i1); |
---|
64 | ifile=0; |
---|
65 | for 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 | |
---|
82 | end |
---|
83 | dist=((xpos-512).*(xpos-512))+((ypos-512).*(ypos-512)); |
---|
84 | dist=dist/(512*512); |
---|
85 | file_index(indbad)=[]; |
---|
86 | Amean(indbad)=[]; |
---|
87 | dist(indbad)=[]; |
---|
88 | figure(1) |
---|
89 | plot(file_index,Amean,'+') |
---|
90 | figure(2) |
---|
91 | haxes=axes; |
---|
92 | h=plot(dist,Amean,'+') |
---|
93 | xlabel('distance to image center (pixels)') |
---|
94 | ylabel('luminosity of reference input dye solution') |
---|
95 | set(haxes,'YLim',[0 2850]) |
---|