Exemplo n.º 1
0
bool DcRawQT::GetRawImage(QString filename, QStringList args)
{
    int argc;
    char **argv;


	if(args.contains("-i")){
		args.removeOne("-i");
		qDebug("-i passed to GetRawImage");
	}

    args += filename;
    argc = BuildCommandLine(args, &argv);

	if(GetRawImage(argc, argv))
	{
		buildHistogram();

		return true;
	}

	return false;


}
Exemplo n.º 2
0
/*
this is the method used to call into the original 'main' function.  its the bridge into the 
dcraw 'C' code.
*/
int DcRawQT::dcrawmain (int argc, const char **argv, QByteArray *imageArray)
{
    int retVal = themain(argc, argv, imageArray);

	buildHistogram();

	return retVal;
}
Exemplo n.º 3
0
QByteArray *DcRawQT::GetImage(int argc, char *argv[])
{
    QByteArray *imageArray = new QByteArray();

    if(0 == dcrawmain(argc, (const char **)argv, imageArray))
	{
		buildHistogram();
        return imageArray;
	}
    return 0;

}
Exemplo n.º 4
0
void GStatsEventTimingHist::commit_sample(unsigned long long id)
{
  EventHistory::iterator it_begin;
  Time_t startTime;
  bool build = false;
  
  I( evPending.find(id) != evPending.end() );
  
  startTime = evPending[id].start;
  evPending.erase(id);  
    
  it_begin = beginH.find( startTime ); 
  I( it_begin != beginH.end() );

  (*it_begin).second = (*it_begin).second - 1;   
  if( (*it_begin).second == 0 ) {
    beginT.erase(startTime);    
    beginH.erase(startTime);
    build = true;
  }

  EventHistory::iterator it_now, it_before;
  
  it_now = evH.find(globalClock);
  if( it_now == evH.end() ) {
    evH[globalClock] = 0;
    it_now = evH.find(globalClock); 
  }   
  it_before = evH.find(startTime);
  if(it_before == evH.end()) {
    evH[startTime] = 0; 
    it_before = evH.find(startTime);  
  }

  evT.insert(globalClock);
  evT.insert(startTime);
  
  (*it_now).second = (*it_now).second - 1;
  (*it_before).second = (*it_before).second + 1;

  if(build)
    buildHistogram(true);
}
Exemplo n.º 5
0
void GStatsEventTimingHist::remove_sample(unsigned long long id)
{
  EventHistory::iterator it_begin;
  Time_t startTime;
  
  I( evPending.find(id) != evPending.end() );
  
  startTime = evPending[id].start;
  evPending.erase(id);  
    
  it_begin = beginH.find( startTime ); 
  I( it_begin != beginH.end() );

  (*it_begin).second = (*it_begin).second - 1;   
  if( (*it_begin).second == 0 ) {
    beginT.erase(startTime);
    beginH.erase(startTime);    

    buildHistogram(true);
  }   
}
Exemplo n.º 6
0
    int track(Mat &image,Rect &rect)
    {
        int status=0;
        cvtColor(image, hsv, CV_BGR2HSV_FULL);
        selection=rect;
        if(rect.width!=0&&rect.height!=0)
        {
            if(trackObject==false)
                buildHistogram ();
            if(trackObject==true)
            {
                Rect trackWindow=selection;
                Mat backproj=calcProbability ();
                RotatedRect trackBox = CamShift(backproj,trackWindow,TermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1 ));
                if( trackWindow.area() <= 1 )
                {
                    int cols = backproj.cols, rows = backproj.rows, r = (MIN(cols, rows) + 5)/6;
                    trackWindow = Rect(0,0,0,0);
                    trackObject=false;
                }
                else
                {
                    Point2f rect_points[4]; trackBox.points( rect_points );
                          for( int j = 0; j < 4; j++ )
                              line( image, rect_points[j], rect_points[(j+1)%4], Scalar(0,0,255), 1, 8 );

                }

            }
        }
        else
        {
            trackObject=false;
        }

        status=1;
        return status;
    }
MyHistorogram::MyHistorogram(MyImage *image)
{
    m_histogram = (unsigned int*) calloc(255,sizeof(unsigned int));
    buildHistogram(image);
}
void MyHistorogram::reloadHistogram(MyImage *image)
{
    buildHistogram(image);
}
Exemplo n.º 9
0
int main(int argc, char *argv[]) {
    imagePGM srcImg;
    imagePGM dstImg;
    char *srcFilename;
    char *dstFilename;
    int FileLoad = 0, FileLoadFilename = 0, FileSave = 0, FileSaveFilename = 0, flagInfo = 0, FileInfoOptions = 0;
    int FileImage = 0, FileImageOptions = 0, rotAngle = 0;
    int c;
    int index;

    while ((c = getopt(argc, argv, "i:o:hnr:")) != -1) {
        switch (c) {
            case 'h':
                printHelp();
                exit(EXIT_SUCCESS);
            case 'n':
                flagInfo = 1;
                break;
            case 'i':
                FileLoad = 1;
                FileLoadFilename = 1;
                srcFilename = optarg;
                break;
            case 'o':
                FileSave = 1;
                FileSaveFilename = 1;
                dstFilename = optarg;
                break;
            case 'r':
                FileImage = 1;
                FileImageOptions = 1;
                rotAngle = atoi(optarg);
                break;
            case '?':
                break;
                /*
                if (optopt == 'i')
                    fprintf(stderr, "Option -%c requires an argument.\n", optopt);
                else if (optopt == 'o')
                    fprintf(stderr, "Option -%c requires an argument.\n", optopt);
                else if (optopt == 'r')
                    fprintf(stderr, "Option -%c requires an argument.\n", optopt);
                else if (isprint(optopt))
                    fprintf(stderr, "Unknown option `-%c'.\n", optopt);
                else
                    fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
                return 1;
                */
            default:
                fprintf(stderr, "Wrong arguments. try simpleocr -h for help.");
                exit(EXIT_FAILURE);
        }
    }
    
    ///printf("src = %s\n", dstFilename);
    
    if (FileLoad && FileLoadFilename) {
        srcImg = loadPGM(srcFilename);
        if (flagInfo) {
            printf ("Properties:\n");
            printf ("format: %s\n", getFormatPGM(srcImg));
            printf ("depth: %d\n", getMaxIntensityPGM(srcImg));
            printf ("width: %d\n", getColsPGM(srcImg));
            printf ("height: %d\n", getRowsPGM(srcImg));
            printf ("###: %d\n", getRowsPGM(srcImg));
            dstImg = buildHistogram(srcImg);
            savePGM("histogram.pgm", dstImg);
        }
    }
    
    if (FileSave && FileSaveFilename) {
        if (FileImage) {
            dstImg = rotatePGM(srcImg, rotAngle);
        }
        savePGM(dstFilename, dstImg);
        freePGM(dstImg);
        printf ("Done\n");
    }
    
    return 0;
}