示例#1
0
BlockHoughDetector::BlockHoughDetector(cv::Mat img)
{
	if (img.channels() > 1)
		cv::cvtColor(img, img, CV_BGR2GRAY);
	cv::Mat left = img.clone()(cv::Rect(100, 0, 400, img.rows));

	//vector<int> o;
	//o.push_back(-1);
	//o.push_back(-2);
	//o.push_back(-2);
	//o.push_back(-2);
	//o.push_back(0);//0点表示
	//o.push_back(1);
	//o.push_back(1);
	//o.push_back(1);
	//o.push_back(1);
	//o.push_back(1);
	//o.push_back(1);
	//o.push_back(1);
	//Caculte(left, o);


	//char o[] = {
	//	-5, 0, 0, 1, 1, 1, 1,
	//	-5, 0, 0, 1, 1, 1, 1,
	//	-5, 0, 0, 1, 1, 1, 1 };
	char o[] = {
		-5, 0, 0, 1, 1, 1, 1 ,1,1,1};

	cv::Point center = cv::Point(3, 2);
	cv::Mat _operator(3, 7, CV_8S);
	InitMat(_operator, o);
	InitMat(_operator, o);
	Caculte(left, _operator, center);
}
PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBuilder)
{
    FilterEffect* input1 = filterBuilder->getEffectById(in1());
    FilterEffect* input2 = filterBuilder->getEffectById(in2());
    
    if (!input1 || !input2)
        return 0;
    
    return FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
                                        k1(), k2(), k3(), k4());
}
PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder)
{
    FilterEffect* input1 = filterBuilder->getEffectById(in1());
    float xRadius = radiusX();
    float yRadius = radiusY();

    if (!input1)
        return 0;

    if (xRadius < 0 || yRadius < 0)
        return 0;

    return FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), xRadius, yRadius);
}
bool SVGFECompositeElement::build(FilterBuilder* builder)
{
    FilterEffect* input1 = builder->getEffectById(in1());
    FilterEffect* input2 = builder->getEffectById(in2());
    
    if(!input1 || !input2)
        return false;
    
    RefPtr<FilterEffect> addedEffect = FEComposite::create(input1, input2, static_cast<CompositeOperationType> (_operator()),
                                        k1(), k2(), k3(), k4());
    builder->add(result(), addedEffect.release());

    return true;
}
bool SVGFECompositeElement::build(SVGResourceFilter* filterResource)
{
    FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
    FilterEffect* input2 = filterResource->builder()->getEffectById(in2());
    
    if(!input1 || !input2)
        return false;
    
    RefPtr<FilterEffect> effect = FEComposite::create(input1, input2, static_cast<CompositeOperationType>(_operator()),
                                        k1(), k2(), k3(), k4());
    filterResource->addFilterEffect(this, effect.release());

    return true;
}
示例#6
0
	void VCPU::Execute()
	{
		TokenList& insVector = IR->m_elements;

		static TokenList lastInst = insVector;

		std::string& first = insVector[ 0 ];

		if ( first == "mov" )
		{
			_mov(insVector);
		}
		else if ( first == "lea" )
		{
			dword target = NULL;		
			dword source = NULL;
			target |= (dword)GetReg( insVector[ 1 ] );				
			target |= (dword)GetVar( insVector[ 1 ] );

			source |= (dword)GetReg( insVector[ 2 ] );				
			source |= (dword)GetVar( insVector[ 2 ] );
			source |= (dword)GetConst( insVector[ 2 ] );

			dword_pointer t = (dword_pointer)target;
			dword_pointer s = (dword_pointer)source;

			*(dword_pointer)target = source;

			t = (dword_pointer)target;
			s = (dword_pointer)source;
		}
		else if ( first == "push" || first == "arg" )
		{
			push(insVector);
		}
		else if ( first == "pop" )
		{
			pop(insVector);
		}
		else if ( first == "add" || first == "sub" || first == "mul" || first == "div" )
		{
			_operator(insVector);
		}
		else if ( first == "jmp" )
		{
			jump(insVector);
		}
		else if ( first == "jeq" || first == "jlt" || first == "jle" || first == "jne" || first == "jgt" || first == "jge")
		{
			_conditionJmp(insVector);
		}	
		else if ( first == "call" )
		{
			_call(insVector);
		}
		else if ( first == "leave" )
		{
			leave();
		}
		else if ( first == "in" )
		{

		}
		else if ( first == "out" )
		{
			dword target = 0;

			target |= (dword)GetConst( insVector[ 1 ] );
			if ( target ) 
			{
				if ( *(dword_pointer)target == 0 )	m_log += "\n";					
				else if ( *(dword_pointer)target == 1 )	m_log += " ";
			}
			else
			{
				target = GetAddress( insVector[ 1 ] );

				char out[ 64 ];
				sprintf_s( out, "%d", *(dword_pointer)target );

				m_log += out;
			}

		}
		else if ( first == "halt" )
		{
			eip = m_pInstructions->size();	// 程序结束
			std::cout << "\nDone!!\n";
		}

		lastInst = insVector;
	}
bool SVGFEMorphologyElement::build(SVGResourceFilter* filterResource)
{
    FilterEffect* input1 = filterResource->builder()->getEffectById(in1());

    if (!input1)
        return false;

    RefPtr<FilterEffect> effect = FEMorphology::create(input1, static_cast<MorphologyOperatorType>(_operator()), radiusX(), radiusY());
    filterResource->addFilterEffect(this, effect.release());
    
    return true;
}