Exemple #1
0
void GMG::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/GMG.xml", 0, CV_STORAGE_READ);
  
  initializationFrames = cvReadIntByName(fs, 0, "initializationFrames", 20);
  decisionThreshold = cvReadRealByName(fs, 0, "decisionThreshold", 0.7);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);
  
  cvReleaseFileStorage(&fs);
}
 virtual void LoadState(CvFileStorage* fs, CvFileNode* node)
 {
     CvFileNode* BlobListNode = cvGetFileNodeByName(fs,node,"BlobList");
     m_FrameCount = cvReadIntByName(fs,node, "FrameCount", m_FrameCount);
     m_NextBlobID = cvReadIntByName(fs,node, "NextBlobID", m_NextBlobID);
     if(BlobListNode)
     {
         m_BlobList.Load(fs,BlobListNode);
     }
 };
void FrameDifferenceBGS::loadConfig()
{
    CvFileStorage* fs = cvOpenFileStorage("E:\\yzbx_programe\\QT\\qt_bgslibrary\\config\\FrameDifferenceBGS.xml", 0, CV_STORAGE_READ);

    enableThreshold = cvReadIntByName(fs, 0, "enableThreshold", true);
    threshold = cvReadIntByName(fs, 0, "threshold", 15);
    showOutput = cvReadIntByName(fs, 0, "showOutput", true);

    cvReleaseFileStorage(&fs);
}
void StaticFrameDifferenceBGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("../config/StaticFrameDifferenceBGS.xml", 0, CV_STORAGE_READ);
  
  enableThreshold = cvReadIntByName(fs, 0, "enableThreshold", true);
  threshold = cvReadIntByName(fs, 0, "threshold", 15);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
Exemple #5
0
void DPWrenGABGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/DPWrenGABGS.xml", 0, CV_STORAGE_READ);
  
  threshold = cvReadRealByName(fs, 0, "threshold", 12.25f);
  alpha = cvReadRealByName(fs, 0, "alpha", 0.005f);
  learningFrames = cvReadIntByName(fs, 0, "learningFrames", 30);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void MixtureOfGaussianV2BGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/MixtureOfGaussianV2BGS.xml", 0, CV_STORAGE_READ);
  
  alpha = cvReadRealByName(fs, 0, "alpha", 0.05);
  enableThreshold = cvReadIntByName(fs, 0, "enableThreshold", true);
  threshold = cvReadIntByName(fs, 0, "threshold", 15);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void DPEigenbackgroundBGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/DPEigenbackgroundBGS.xml", 0, CV_STORAGE_READ);
  
  threshold = cvReadIntByName(fs, 0, "threshold", 225);
  historySize = cvReadIntByName(fs, 0, "historySize", 20);
  embeddedDim = cvReadIntByName(fs, 0, "embeddedDim", 10);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void DPGrimsonGMMBGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/DPGrimsonGMMBGS.xml", 0, CV_STORAGE_READ);
  
  threshold = cvReadRealByName(fs, 0, "threshold", 9.0);
  alpha = cvReadRealByName(fs, 0, "alpha", 0.01);
  gaussians = cvReadIntByName(fs, 0, "gaussians", 3);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void DPAdaptiveMedianBGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("DPAdaptiveMedianBGS.xml", 0, CV_STORAGE_READ);
  
  threshold = cvReadIntByName(fs, 0, "threshold", 40);
  samplingRate = cvReadIntByName(fs, 0, "samplingRate", 7);
  learningFrames = cvReadIntByName(fs, 0, "learningFrames", 30);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void LBSimpleGaussian::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/LBSimpleGaussian.xml", 0, CV_STORAGE_READ);
  
  sensitivity = cvReadIntByName(fs, 0, "sensitivity", 66);
  noiseVariance = cvReadIntByName(fs, 0, "noiseVariance", 162);
  learningRate = cvReadIntByName(fs, 0, "learningRate", 18);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void WeightedMovingMeanBGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/WeightedMovingMeanBGS.xml", 0, CV_STORAGE_READ);
  
  enableWeight = cvReadIntByName(fs, 0, "enableWeight", true);
  enableThreshold = cvReadIntByName(fs, 0, "enableThreshold", true);
  threshold = cvReadIntByName(fs, 0, "threshold", 15);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);
  showBackground = cvReadIntByName(fs, 0, "showBackground", false);

  cvReleaseFileStorage(&fs);
}
void DPPratiMediodBGS::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/DPPratiMediodBGS.xml", 0, CV_STORAGE_READ);
  
  threshold = cvReadIntByName(fs, 0, "threshold", 30);
  samplingRate = cvReadIntByName(fs, 0, "samplingRate", 5);
  historySize = cvReadIntByName(fs, 0, "historySize", 16);
  weight = cvReadIntByName(fs, 0, "weight", 5);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
Exemple #13
0
  void PreProcessor::loadConfig()
  {
#if CV_MAJOR_VERSION < 4
    CvFileStorage* fs = cvOpenFileStorage("./config/PreProcessor.xml", 0, CV_STORAGE_READ);

    equalizeHist = cvReadIntByName(fs, 0, "equalizeHist", false);
    gaussianBlur = cvReadIntByName(fs, 0, "gaussianBlur", false);
    enableShow = cvReadIntByName(fs, 0, "enableShow", true);

    cvReleaseFileStorage(&fs);
#endif
  }
void WeightedMovingVarianceBGS::loadConfig()
{
    string xmlDirectory = QCoreApplication::applicationDirPath().toStdString() + "//WeightedMovingVarianceBGS.xml";
    const char *xmlDirect = xmlDirectory.c_str();
    CvFileStorage* fs = cvOpenFileStorage(xmlDirect, 0, CV_STORAGE_READ);

    enableWeight = cvReadIntByName(fs, 0, "enableWeight", true);
    enableThreshold = cvReadIntByName(fs, 0, "enableThreshold", true);
    threshold = cvReadIntByName(fs, 0, "threshold", 15);
    showOutput = cvReadIntByName(fs, 0, "showOutput", true);

    cvReleaseFileStorage(&fs);
}
void T2FGMM_UV::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/T2FGMM_UV.xml", 0, CV_STORAGE_READ);
  
  threshold = cvReadRealByName(fs, 0, "threshold", 9.0);
  alpha = cvReadRealByName(fs, 0, "alpha", 0.01);
  km = cvReadRealByName(fs, 0, "km", 1.5);
  kv = cvReadRealByName(fs, 0, "kv", 0.6);
  gaussians = cvReadIntByName(fs, 0, "gaussians", 3);
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void LBFuzzyGaussian::loadConfig()
{
    CvFileStorage* fs = cvOpenFileStorage("./config/LBFuzzyGaussian.xml", 0, CV_STORAGE_READ);

    sensitivity = cvReadIntByName(fs, 0, "sensitivity", 72);
    bgThreshold = cvReadIntByName(fs, 0, "bgThreshold", 162);
    learningRate = cvReadIntByName(fs, 0, "learningRate", 49);
    noiseVariance = cvReadIntByName(fs, 0, "noiseVariance", 195);

    showOutput = cvReadIntByName(fs, 0, "showOutput", true);

    cvReleaseFileStorage(&fs);
}
void AdaptiveBackgroundLearning::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("AdaptiveBackgroundLearning.xml", 0, CV_STORAGE_READ);
  
  alpha = cvReadRealByName(fs, 0, "alpha", 0.05);
  limit = cvReadIntByName(fs, 0, "limit", -1);
  enableThreshold = cvReadIntByName(fs, 0, "enableThreshold", true);
  threshold = cvReadIntByName(fs, 0, "threshold", 15);
  showForeground = cvReadIntByName(fs, 0, "showForeground", true);
  showBackground = cvReadIntByName(fs, 0, "showBackground", true);

  cvReleaseFileStorage(&fs);
}
void LBMixtureOfGaussians::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/LBMixtureOfGaussians.xml", 0, CV_STORAGE_READ);
  
  sensitivity = cvReadIntByName(fs, 0, "sensitivity", 81);
  bgThreshold = cvReadIntByName(fs, 0, "bgThreshold", 83);
  learningRate = cvReadIntByName(fs, 0, "learningRate", 59);
  noiseVariance = cvReadIntByName(fs, 0, "noiseVariance", 206);
  
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void VuMeter::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/VuMeter.xml", 0, CV_STORAGE_READ);
  
  enableFilter = cvReadIntByName(fs, 0, "enableFilter", true);
  
  binSize = cvReadIntByName(fs, 0, "binSize", 8);
  alpha = cvReadRealByName(fs, 0, "alpha", 0.995);
  threshold = cvReadRealByName(fs, 0, "threshold", 0.03);
  
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void FuzzyChoquetIntegral::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("../config/FuzzyChoquetIntegral.xml", 0, CV_STORAGE_READ);
  
  showOutput = cvReadIntByName(fs, 0, "showOutput", true);
  framesToLearn = cvReadIntByName(fs, 0, "framesToLearn", 10);
  alphaLearn = cvReadRealByName(fs, 0, "alphaLearn", 0.1);
  alphaUpdate = cvReadRealByName(fs, 0, "alphaUpdate", 0.01);
  colorSpace = cvReadIntByName(fs, 0, "colorSpace", 1);
  option = cvReadIntByName(fs, 0, "option", 2);
  smooth = cvReadIntByName(fs, 0, "smooth", true);
  threshold = cvReadRealByName(fs, 0, "threshold", 0.67);

  cvReleaseFileStorage(&fs);
}
Exemple #21
0
  void PreProcessor::loadConfig()
  {
#if defined(_WIN32)
	//CvFileStorage* fs = cvOpenFileStorage("F:\\Developer\\BGS\\AndrewsSobral\\bgslibrary\\config\\PreProcessor.xml", 0, CV_STORAGE_READ);
	CvFileStorage* fs = cvOpenFileStorage("config\\PreProcessor.xml", 0, CV_STORAGE_READ);
#else
    CvFileStorage* fs = cvOpenFileStorage("./config/PreProcessor.xml", 0, CV_STORAGE_READ);
#endif   

    equalizeHist = cvReadIntByName(fs, 0, "equalizeHist", false);
    gaussianBlur = cvReadIntByName(fs, 0, "gaussianBlur", false);
    enableShow = cvReadIntByName(fs, 0, "enableShow", true);

    cvReleaseFileStorage(&fs);
  }
int main(int argc, const char * argv[]) {
    CvMat *cmatrix = cvCreateMat(5,5,CV_32FC1);
    float element_3_2 = 7.7;
    *((float*)CV_MAT_ELEM_PTR( *cmatrix, 3,2) ) = element_3_2;
    cvmSet(cmatrix,4,4,0.5000);
    cvSetReal2D(cmatrix,3,3,0.5000);
    
    CvFileStorage* fs1 = cvOpenFileStorage("cfg.xml", 0, CV_STORAGE_WRITE);
    cvWriteInt( fs1, "frame_count", 10 );
    cvStartWriteStruct( fs1, "frame_size", CV_NODE_SEQ );
    cvWriteInt( fs1 , 0, 320 );
    cvWriteInt( fs1 , 0, 200 );
    cvEndWriteStruct( fs1 );
    cvWrite( fs1, "color_cvt_matrix", cmatrix );
    cvReleaseFileStorage( &fs1 );
    
    CvFileStorage* fs2 = cvOpenFileStorage("cfg.xml", 0, CV_STORAGE_READ);
    int frame_count = cvReadIntByName( fs2 , 0, "frame_count");
    CvSeq* s = cvGetFileNodeByName( fs2,0,"frame_size" )->data.seq;
    int frame_width = cvReadInt( (CvFileNode*)cvGetSeqElem(s,0) );
    int frame_height = cvReadInt( (CvFileNode*)cvGetSeqElem(s,1) );
    CvMat* color_cvt_matrix = (CvMat*) cvReadByName( fs2, 0 , "color_cvt_matrix");
    
    printf("color_cvt_matrix: width=%d, height=%d\n",color_cvt_matrix->width, color_cvt_matrix->height );
    printf("frame_count=%d, frame_width=%d, frame_height=%d\n",frame_count,frame_width,frame_height);
    
    cvReleaseFileStorage( &fs2 );
    
    return 0;
}
Exemple #23
0
int main (int argc, char *argv[]) 
{
	IplImage *img;
	CvFileStorage *fs;
	CvSeq* seq;
	CvMemStorage *str;
	int N,i;
	
	parse_args(argc,argv);

	str = cvCreateMemStorage(0);
	img = cvCreateImage(cvSize(WIDTH,HEIGHT), 8, 3);
	cvZero(img);
	fs = cvOpenFileStorage(infile, str, CV_STORAGE_READ, NULL);
	assert(fs);

	N = cvReadIntByName(fs, NULL, "N", 0);
	seq = cvReadByName(fs, NULL, "seq", 0);

	printf("N=%d\n", N);
	for (i=0; i<seq->total; i++) {
		CvPoint p;

		p = *(CvPoint*)cvGetSeqElem(seq, i);
		cvCircle(img, p, R, CV_RGB(255,0,0), -1, 8, 0);
	}

	cvShowImage("proto", img);
	cvWaitKey(0);
	
	cvReleaseFileStorage(&fs);
	cvReleaseImage(&img);
	
	return 0;
}
Exemple #24
0
  void VideoCapture::loadConfig()
  {
    CvFileStorage* fs = cvOpenFileStorage("./config/VideoCapture.xml", 0, CV_STORAGE_READ);

    stopAt = cvReadIntByName(fs, 0, "stopAt", 0);
    input_resize_percent = cvReadIntByName(fs, 0, "input_resize_percent", 100);
    enableFlip = cvReadIntByName(fs, 0, "enableFlip", false);
    VC_ROI::use_roi = cvReadIntByName(fs, 0, "use_roi", true);
    VC_ROI::roi_defined = cvReadIntByName(fs, 0, "roi_defined", false);
    VC_ROI::roi_x0 = cvReadIntByName(fs, 0, "roi_x0", 0);
    VC_ROI::roi_y0 = cvReadIntByName(fs, 0, "roi_y0", 0);
    VC_ROI::roi_x1 = cvReadIntByName(fs, 0, "roi_x1", 0);
    VC_ROI::roi_y1 = cvReadIntByName(fs, 0, "roi_y1", 0);
    showOutput = cvReadIntByName(fs, 0, "showOutput", true);

    cvReleaseFileStorage(&fs);
  }
Exemple #25
0
void LbpMrf::loadConfig()
{
  CvFileStorage* fs = cvOpenFileStorage("./config/LbpMrf.xml", 0, CV_STORAGE_READ);

  showOutput = cvReadIntByName(fs, 0, "showOutput", true);

  cvReleaseFileStorage(&fs);
}
void IndependentMultimodalBGS::loadConfig()
{
    CvFileStorage* fs = cvOpenFileStorage("./config/IndependentMultimodalBGS.xml", 0, CV_STORAGE_READ);

    showOutput = cvReadIntByName(fs, 0, "showOutput", true);

    cvReleaseFileStorage(&fs);
}
    virtual void LoadState(CvFileStorage* fs, CvFileNode* node)
    {
        int         b,bN = cvReadIntByName(fs,node,"BlobNum",0);
        CvFileNode* pBlobListNode = cvGetFileNodeByName(fs,node,"BlobList");
        if(!CV_NODE_IS_SEQ(pBlobListNode->tag)) return;
        bN = pBlobListNode->data.seq->total;

        for(b=0; b<bN; ++b)
        {
            DefBlobTrackerCR*   pF = NULL;
            CvBlob              Blob;
            CvFileNode*         pSeqNode = NULL;
            CvFileNode*         pBlobNode = (CvFileNode*)cvGetSeqElem(pBlobListNode->data.seq,b);
            assert(pBlobNode);

            Blob.ID = cvReadIntByName(fs,pBlobNode,"ID",0);

            pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "Blob");
            if(CV_NODE_IS_SEQ(pSeqNode->tag))
                cvReadRawData( fs, pSeqNode, &Blob, "ffffi" );

            AddBlob(&Blob,NULL,NULL);
            pF = (DefBlobTrackerCR*)m_BlobList.GetBlobByID(Blob.ID);

            pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "BlobPredict");
            if(CV_NODE_IS_SEQ(pSeqNode->tag))
                cvReadRawData( fs, pSeqNode, &pF->BlobPredict, "ffffi" );

            pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "BlobPrev");
            if(CV_NODE_IS_SEQ(pSeqNode->tag))
                cvReadRawData( fs, pSeqNode, &pF->BlobPrev, "ffffi" );

            pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "BlobHyp");
            if(pSeqNode)
                pF->pBlobHyp->Load(fs,pSeqNode);
            pF->Collision = cvReadIntByName(fs, pBlobNode,"Collision",pF->Collision);

            pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "Predictor");
            if(pSeqNode)
                pF->pPredictor->LoadState(fs,pSeqNode);

            pSeqNode = cvGetFileNodeByName(fs, pBlobNode, "Resolver");
            if(pSeqNode)
                pF->pResolver->LoadState(fs,pSeqNode);
        }   /* Read next blob. */
    }   /*  CCwithCR LoadState */
void EntropyOfEntropyArea::loadConfig(){
	CvFileStorage* fs1 = cvOpenFileStorage("./Config/ImageResize.xml", 0, CV_STORAGE_READ);
	CvFileStorage* fs2 = cvOpenFileStorage("./Config/EntropyOfEntropyArea.xml", 0, CV_STORAGE_READ);

	entropyAreaSize = cvReadIntByName(fs1, 0, "entropyAreaSize", 3);
	monitorAreaSize = cvReadIntByName(fs1, 0, "monitorAreaSize", 3);

	windowWidth = cvReadIntByName(fs2, 0, "windowWidth", 5);
	grayLevel = cvReadIntByName(fs2, 0, "grayLevel", 6);
	C0 = cvReadRealByName(fs2, 0, "C0", 0.05);
	learningRate = cvReadRealByName(fs2, 0, "learningRate", 0.7);
	deltaENToOldENRatioEntropy = cvReadRealByName(fs2, 0, "deltaENToOldENRatioEntropy", 0.1);
	staticRatioEntropy = cvReadRealByName(fs2, 0, "staticRatioEntropy", 0.7);

	cvReleaseFileStorage(&fs1);
	cvReleaseFileStorage(&fs2);
}
Exemple #29
0
int main(int argc, char** argv)
{
	if (argc == 1) {
		printf("Usage: %s <input> <config>\n", argv[0]);
		return 0;
	}

	char* filename = (argc > 1 ? argv[1] : (char*)"input.jpg");

	profile_name = (argc > 2 ? argv[2] : (char*)"blue_goal.yml");


	fs = cvOpenFileStorage(profile_name, 0, CV_STORAGE_READ, NULL);
	Hmax = cvReadIntByName(fs, NULL, "m_100", m_100);
	Hmax = cvReadIntByName(fs, NULL, "Hmax", Hmax);
	Smax = cvReadIntByName(fs, NULL, "Smax", Smax);
	Vmax = cvReadIntByName(fs, NULL, "Vmax", Vmax);
	Hmin = cvReadIntByName(fs, NULL, "Hmin", Hmin);
	Smin = cvReadIntByName(fs, NULL, "Smin", Smin);
	Vmin = cvReadIntByName(fs, NULL, "Vmin", Vmin);
	//minH = cvReadIntByName(fs, NULL, "minH", minH);

	printf("%s\n", filename);
	img = cvLoadImage(filename, 1);

	visy_img_alloc(&img, cvGetSize(img), 8, 1);
	imgThreshed = cvCreateImage(cvGetSize(img), 8, 1);

	//cvSmooth( imgHSV, imgHSV, CV_GAUSSIAN, 7, 7 );
	//cvInRangeS(imgHSV, cvScalar(20, 100, 100), cvScalar(30, 255, 255), imgThreshed);

	//cvInRangeS(imgHSV, cvScalar(100, 100, 100), cvScalar(120, 255, 255), imgThreshed);

	//cvInRangeS(imgHSV, cvScalar(0.11*256, 0.60*256, 0.20*256, 0),
	//                cvScalar(0.14*256, 1.00*256, 1.00*256, 0), imgThreshed);

	cvNamedWindow("origin", CV_WINDOW_AUTOSIZE);
	cvNamedWindow("treshed", CV_WINDOW_AUTOSIZE);
	cvNamedWindow("graph", CV_WINDOW_AUTOSIZE);


	cvCreateTrackbar("m_100", "treshed", &m_100, 255, onTrack);
	cvCreateTrackbar("Hmin", "treshed", &Hmin, 180, onTrack);
	cvCreateTrackbar("Smin", "treshed", &Smin, 255, onTrack);
	cvCreateTrackbar("Vmin", "treshed", &Vmin, 255, onTrack);

	cvCreateTrackbar("Hmax", "treshed", &Hmax, 180, onTrack);
	cvCreateTrackbar("Smax", "treshed", &Smax, 255, onTrack);
	cvCreateTrackbar("Vmax", "treshed", &Vmax, 255, onTrack);
	//cvCreateTrackbar("minH", "treshed", &minH, 255, onTrack);


	onTrack(0);

	//cvSaveImage("hsv.jpg", imgHSV);

	while(cvWaitKey(0) != 97);

	return 0;
}
  void ForegroundMaskAnalysis::loadConfig()
  {
    CvFileStorage* fs = cvOpenFileStorage("./config/ForegroundMaskAnalysis.xml", 0, CV_STORAGE_READ);

    stopAt = cvReadIntByName(fs, 0, "stopAt", 0);
    img_ref_path = cvReadStringByName(fs, 0, "img_ref_path", "");

    cvReleaseFileStorage(&fs);
  }