// before checkSerialNumber is called, usingSerialNumber() has to be called at least ONCE
int checkSerialNumber(license_id id) {
	int featureType, returnValue=LIC_FAIL;
#ifdef WIN32
	featureType = getFeatureType(id);
	switch(featureType) {
		case CIEI:
			if(CIsupported() == LIC_SUCCESS || EIsupported() == LIC_SUCCESS) { returnValue=LIC_SUCCESS; }
			//msg("case of CIEI ... returning $1") << eoarg << returnValue << endl;
			//printf("case of CIEI ... returning %d\n", returnValue);
			break;
		case CI:
			if(CIsupported() == LIC_SUCCESS) { returnValue=LIC_SUCCESS; }
			//msg("case of CI ... returning $1") << eoarg << returnValue << endl;
			//printf("case of CI ... returning %d\n", returnValue);
			break;
		case EI:
			if(EIsupported() == LIC_SUCCESS) { returnValue=LIC_SUCCESS; }
			//msg("case of EI ... returning $1") << eoarg << returnValue << endl;
			//printf("case of EI ... returning %d\n", returnValue);
			break;
		default:
			//printf("Failure to find that feature %d\n", featureType);
			//msg("Failure to find that feature $1") << featureType << eoarg << eom;
			returnValue=LIC_FAIL;
			break;
	}
#endif
	//printf("after switch in checkSerial\n");
	return(returnValue);
}
Example #2
0
void CascadeClassifier::detectMultiScaleNoGrouping( const Mat& image, std::vector<Rect>& candidates,
                                                    std::vector<int>& rejectLevels, std::vector<double>& levelWeights,
                                                    double scaleFactor, Size minObjectSize, Size maxObjectSize,
                                                    bool outputRejectLevels )
{
    candidates.clear();

    if (!maskGenerator.empty())
        maskGenerator->initializeMask(image);

    if( maxObjectSize.height == 0 || maxObjectSize.width == 0 )
        maxObjectSize = image.size();

    Mat grayImage = image;
    if( grayImage.channels() > 1 )
    {
        Mat temp;
        cvtColor(grayImage, temp, COLOR_BGR2GRAY);
        grayImage = temp;
    }

    Mat imageBuffer(image.rows + 1, image.cols + 1, CV_8U);

    for( double factor = 1; ; factor *= scaleFactor )
    {
        Size originalWindowSize = getOriginalWindowSize();

        Size windowSize( cvRound(originalWindowSize.width*factor), cvRound(originalWindowSize.height*factor) );
        Size scaledImageSize( cvRound( grayImage.cols/factor ), cvRound( grayImage.rows/factor ) );
        Size processingRectSize( scaledImageSize.width - originalWindowSize.width, scaledImageSize.height - originalWindowSize.height );

        if( processingRectSize.width <= 0 || processingRectSize.height <= 0 )
            break;
        if( windowSize.width > maxObjectSize.width || windowSize.height > maxObjectSize.height )
            break;
        if( windowSize.width < minObjectSize.width || windowSize.height < minObjectSize.height )
            continue;

        Mat scaledImage( scaledImageSize, CV_8U, imageBuffer.data );
        resize( grayImage, scaledImage, scaledImageSize, 0, 0, INTER_LINEAR );

        int yStep;
        if( getFeatureType() == cv::FeatureEvaluator::HOG )
        {
            yStep = 4;
        }
        else
        {
            yStep = factor > 2. ? 1 : 2;
        }

        int stripCount, stripSize;

        const int PTS_PER_THREAD = 1000;
        stripCount = ((processingRectSize.width/yStep)*(processingRectSize.height + yStep-1)/yStep + PTS_PER_THREAD/2)/PTS_PER_THREAD;
        stripCount = std::min(std::max(stripCount, 1), 100);
        stripSize = (((processingRectSize.height + stripCount - 1)/stripCount + yStep-1)/yStep)*yStep;

        if( !detectSingleScale( scaledImage, stripCount, processingRectSize, stripSize, yStep, factor, candidates,
            rejectLevels, levelWeights, outputRejectLevels ) )
            break;
    }
}