/normxcorr/trunk

To get this branch, use:
bzr branch http://suren.me/webbzr/normxcorr/trunk

« back to all changes in this revision

Viewing changes to automate_image.m

  • Committer: Suren A. Chilingaryan
  • Date: 2009-11-26 18:37:24 UTC
  • Revision ID: csa@dside.dyndns.org-20091126183724-dck2wcyt2ookjtab
Add error checking to initialization process

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
OPTIMIZE = 3;
50
50
CORRSIZE = 15;  
51
51
PRECISION = 1000;
52
 
SILENT = 1;
 
52
SILENT = 0;
53
53
 
54
54
 
55
55
% exist('grid_x')
158
158
if OPTIMIZE > 2
159
159
    hwid = normxcorr_hw();
160
160
    if hwid > 0
161
 
        normxcorr_hw(hwid, 1, ncp, CORRSIZE);
 
161
        err = normxcorr_hw(hwid, 1, ncp, CORRSIZE);
 
162
        if (err ~= 0)
 
163
            normxcorr_hw(1);
 
164
            OPTIMIZE = 2;
 
165
        end
162
166
    else
163
167
        if hwid < 0
164
168
            OPTIMIZE = 1;
186
190
        continue
187
191
    end
188
192
    
189
 
    if (numel(sub_base) < 2) ||  (std(sub_base(:)) == 0)
 
193
    double_sub_base = double(sub_base);
 
194
 
 
195
    if (numel(sub_base) < 2) ||  (std(double_sub_base(:)) == 0)
190
196
        % This check is moved here for normxcorr2
191
197
        eid = sprintf('Images:%s:sameElementsInTemplate',mfilename);
192
198
        msg = 'The values of TEMPLATE cannot all be the same.';
193
199
        error(eid,'%s',msg);
194
200
    end
195
201
 
196
 
    double_sub_base = double(sub_base);
197
202
    local_sum_A = dic_local_sum(double_sub_base,n,n);
198
203
    local_sum_A2 = dic_local_sum(double_sub_base.*double_sub_base,n,n);
199
204