/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 dict_hw/matlab/normxcorr_hw.c

  • Committer: Suren A. Chilingaryan
  • Date: 2010-04-22 13:42:41 UTC
  • Revision ID: csa@dside.dyndns.org-20100422134241-fv5m2ufk8n2tc9h5
Implementation of image and fragment modes, support for non-cacheable grids

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    const mxArray *input;
99
99
    const mxArray *base;
100
100
 
 
101
#if defined(VALIDATE_LSUM) || defined(VALIDATE_PEAK)
 
102
    int icp;
 
103
    int fft_size;
 
104
#endif
 
105
 
101
106
#ifdef VALIDATE_LSUM
102
 
    const mxArray *lsum;
103
 
    const mxArray *denom;
 
107
    mxArray *lsum;
 
108
    mxArray *denom;
104
109
#endif /* VALIDATE_LSUM */
105
110
 
106
111
    const mxArray *x, *y;
391
396
#ifdef VALIDATE_PEAK
392
397
     case ACTION_COMPUTE_FRAGMENT:
393
398
        if (nlhs > 0) {
 
399
            fft_size = 6 * corr_size + 1;
 
400
            
394
401
            icp = (unsigned int)mxGetScalar(prhs[2]) - 1;
395
 
            idMatrix = mxCreateNumericMatrix(size, size, mxSINGLE_CLASS, mxREAL);
 
402
            idMatrix = mxCreateNumericMatrix(fft_size, fft_size, mxSINGLE_CLASS, mxREAL);
396
403
 
397
 
            dictProcessFragment(ps, icp, 1, prhs[3]);
 
404
            dictLoadFragment(ps, icp, 1, mxGetData(prhs[3]));
398
405
            dictGetCorrelations(ps, icp, (float*)mxGetPr(idMatrix));
399
406
        
400
407
            plhs[0] = idMatrix;
407
414
        
408
415
            dictGetCorrections(ps, points, points + ncp);
409
416
        
410
 
            plhs[0] = idMatrix
 
417
            plhs[0] = idMatrix;
411
418
        }
412
419
     break;
413
420
#endif /* VALIDATE_PEAK */
419
426
        }
420
427
 
421
428
        icp = (unsigned int)mxGetScalar(prhs[2]) - 1;
422
 
        if (icp >= ps->ncp) {
423
 
            reportError("The control point (%i) is out of range (0-%u)", icp, ps->ncp - 1);
 
429
        if (icp >= ncp) {
 
430
            reportError("The control point (%i) is out of range (0-%u)", icp, ncp - 1);
424
431
            return;
425
432
        }
426
433
 
442
449
        if (nlhs > 1) denom = mxCreateNumericMatrix(fft_size, fft_size, mxSINGLE_CLASS, mxREAL);
443
450
        else denom = NULL;
444
451
        
445
 
        dictSetDimensions(ps, GetN(base), GetM(base));
446
 
        dictLoadTemplateFragment(ps, icp, 1, base);
447
 
        dictGetLocalSum(ps, icp, lsum, denom);
 
452
        dictSetDimensions(ps, mxGetN(base), mxGetM(base));
 
453
        dictLoadTemplateFragment(ps, icp, 1, mxGetData(base));
 
454
        dictGetLocalSum(ps, icp, mxGetData(lsum), mxGetData(denom));
448
455
 
449
456
        if (nlhs > 0) {
450
457
            plhs[0] = lsum;