1

I have written the code to access opencv(Mainly used for image processing) function from Scilab(numerical computation software). When I run bilder gateway file, I am encountering below error.

opencv_NormalizeHist.cpp:47:34: error: 'NormalizeHist' was not declared in this scope.


#include <numeric>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv.hpp"
#include <iostream>

using namespace cv;
using namespace std;
extern "C"
{
  #include "api_scilab.h"
  #include "Scierror.h"
  #include "BOOL.h"
  #include <localization.h>
  #include "../common.h"


  int opencv_NormalizeHist(char *fname, unsigned long fname_len)
  {
    SciErr sciErr;
    int iRows=0,iCols=0;
    int *piAddr2 = NULL;

    //checking input argument
    CheckInputArgument(pvApiCtx, 2, 2);
    CheckOutputArgument(pvApiCtx, 0, 0) ;
       //Define histogram
    Mat hist;
    retrieveImage(hist,1);
    double *factor;


     //for value of factor
    sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
    if (sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }
    sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows, &iCols ,&factor);
    if(sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    NormalizeHist(hist, factor[0]); //Normalizing hist


    string tempstring = type2str(hist.type());
    char *checker;`enter code herek
    checker = (char *)malloc(tempstring.size() + 1);
    memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
    returnImage(checker,hist,1); //here, remove the temp as a parameter as it is not needed, and instead add 1 as the third parameter. 1 denotes that the first output       argument will be this variable
    free(checker); //free memory taken up by checker, i missed this earlier

    //Assigning the list as the Output Variable
    AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
    //Returning the Output Variables as arguments to the Scilab environment
    ReturnArguments(pvApiCtx);
    return 0;

  }
/* ==================================================================== */
}
Lavitha
  • 51
  • 3
  • Double-check your `#include`s. Are you sure that the file declaring `NormalizeHist` has been included ? You can try including `imgproc.hpp`.I hope this helps. – Paul D. Aug 06 '15 at 10:47
  • See for example including imgproc: http://stackoverflow.com/questions/19177456/include-c-header-files-in-opencv – spoorcc Aug 06 '15 at 11:20

0 Answers0