mexLocalMaxima.cpp

Go to the documentation of this file.
00001 
00010 // This file is part of the SaliencyToolbox - Copyright (C) 2006-2007
00011 // by Dirk B. Walther and the California Institute of Technology.
00012 // See the enclosed LICENSE.TXT document for the license agreement. 
00013 // More information about this project is available at: 
00014 // http://www.saliencytoolbox.net
00015 
00016 #include "mexLog.h"
00017 #include "Image.h"
00018 #include "MexParams.h"
00019 
00020 /* the main program */
00021 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
00022 {
00023   MexParams Params(0,3,nlhs,plhs,2,2,nrhs,prhs);
00024   Image img(Params.getInput(0));
00025   double thresh = Params.getScalarInput(1);
00026   
00027   int lm_num;
00028   double lm_sum, lm_avg;
00029   img.getLocalMaxima(thresh,&lm_num,&lm_sum);
00030   
00031   if (lm_sum > 0) lm_avg = lm_sum / (double)lm_num;
00032   else lm_avg = 0.0;
00033   
00034   Params.setScalarOutput(0,lm_avg);
00035   Params.setScalarOutput(1,(double)lm_num);
00036   Params.setScalarOutput(2,lm_sum);
00037 }

Generated on Fri Sep 7 13:09:49 2007 for SaliencyToolbox by  doxygen 1.5.2