Beispiel #1
0
void HGlobalStream::filter(LPCTSTR src)
{
	if (src == 0)
		return;
	DWORD i = 0;
	DWORD len = 0;
	//Find out the length
	if (_nbsp && _escfilt)
	{
		for (; src[i] != '\0'; i++)
		{
			switch (src[i])
			{
			case '\\':
			case '{':
			case '}':
			case ' ':
				len++;
				break;
			}
			len++;
		}
	}
	else if (_escfilt)
	{
		for (; src[i] != '\0'; i++)
		{
			switch (src[i])
			{
			case '\\':
			case '{':
			case '}':
				len++;
				break;
			}
			len++;
		}
	}
	else if (_nbsp)
	{
		for (; src[i] != '\0'; i++)
		{
			switch (src[i])
			{
			case ' ':
				len++;
				break;
			}
			len++;
		}
	}
	else
		return;

	if (TCHAR *pTemp = Extend(len))
	{
		DWORD ii = i = 0;
		//Filter the data
		if (_nbsp && _escfilt)
		{
			TCHAR c;
			for (; src[i] != '\0'; i++)
			{
				switch (src[i])
				{
					case '\\':
					case '{':
					case '}':
					case ' ':
						pTemp[ii++] = '\\';
				}
				c = src[i];
				if (src[i] == ' ')
					c = '~';
				pTemp[ii++] = c;
			}
		}
		else if (_escfilt)
		{
			for (; src[i] != '\0'; i++)
			{
				switch (src[i])
				{
					case '\\':
					case '{':
					case '}':
					 pTemp[ii++] = '\\';
				}
				pTemp[ii++] = src[i];
			}
		}
		else if (_nbsp)
		{
			for (; src[i] != '\0'; i++)
			{
				if (src[i] == ' ')
				{
					pTemp[ii++] = '\\';
					pTemp[ii++] = '~';
				}
				else
					pTemp[ii++] = src[i];
			}
		}
		GlobalUnlock(m_hGlobal);
	}
	_hex = _nbsp = _escfilt = 0;
}
Beispiel #2
0
void DockingProbe::TimeStep(double simt, double simdt)

{
	if (!FirstTimeStepDone) {
		DoFirstTimeStep();
		FirstTimeStepDone = true;
		return;
	}

	if (UndockNextTimestep) {
		UpdatePort(Dockparam[1] * 0.5, simdt);
		OurVessel->Undock(ourPort);
		UndockNextTimestep = false;
	}

	if (ExtendingRetracting > 0) {
		if (Status >= DOCKINGPROBE_STATUS_EXTENDED) {
			Status = DOCKINGPROBE_STATUS_EXTENDED;
			ExtendingRetracting = 0;
			Dockproc = DOCKINGPROBE_PROC_UNDOCKED;
			OurVessel->Undocking(ourPort);
			OurVessel->SetDockingProbeMesh();
		} else {
			Status += 0.33 * simdt;
		}
	} else if (ExtendingRetracting < 0) {
		if (Status <= DOCKINGPROBE_STATUS_RETRACTED) {
			Status = DOCKINGPROBE_STATUS_RETRACTED;
			ExtendingRetracting = 0;
			OurVessel->HaveHardDocked(ourPort);		
			OurVessel->SetDockingProbeMesh();
		} else {
			Status -= 0.33 * simdt;
		}	
	}

	if (Dockproc == DOCKINGPROBE_PROC_SOFTDOCKED) {
		UpdatePort(Dockparam[1] * 0.5, simdt);
		Dockproc = DOCKINGPROBE_PROC_HARDDOCKED;
	} else if (Dockproc == DOCKINGPROBE_PROC_HARDDOCKED) {
		if (Status > DOCKINGPROBE_STATUS_RETRACTED) {
			UpdatePort(Dockparam[1] * 0.5 * Status / 0.9, simdt);
		} else {
			UpdatePort(_V(0,0,0), simdt);
			Dockproc = DOCKINGPROBE_PROC_UNDOCKED;
		}
	}
	// sprintf(oapiDebugString(), "Docked %d Status %.3f Dockproc %d  ExtendingRetracting %d", (Docked ? 1 : 0), Status, Dockproc, ExtendingRetracting); 

	// Switching logic
	if (OurVessel->DockingProbeExtdRelSwitch.IsUp() && IsPowered()) {
		Extend();

	} else if (OurVessel->DockingProbeExtdRelSwitch.IsDown()) {
		if ((!OurVessel->DockingProbeRetractPrimSwitch.IsCenter() && OurVessel->DockProbeMnACircuitBraker.IsPowered() && OurVessel->PyroBusA.Voltage() > SP_MIN_DCVOLTAGE) ||
			(!OurVessel->DockingProbeRetractSecSwitch.IsCenter()  && OurVessel->DockProbeMnBCircuitBraker.IsPowered() && OurVessel->PyroBusB.Voltage() > SP_MIN_DCVOLTAGE)) {

			int ActiveCharges = 0;

			if (OurVessel->DockingProbeRetractPrimSwitch.IsUp()) ActiveCharges = ActiveCharges | DOCKINGPROBE_CHARGE_PRIM1;
			if (OurVessel->DockingProbeRetractPrimSwitch.IsDown()) ActiveCharges = ActiveCharges | DOCKINGPROBE_CHARGE_PRIM2;
			if (OurVessel->DockingProbeRetractSecSwitch.IsUp()) ActiveCharges = ActiveCharges | DOCKINGPROBE_CHARGE_SEC1;
			if (OurVessel->DockingProbeRetractSecSwitch.IsDown()) ActiveCharges = ActiveCharges | DOCKINGPROBE_CHARGE_SEC2;

			if ((ActiveCharges & RetractChargesUsed)!= ActiveCharges) Retract();

			RetractChargesUsed = RetractChargesUsed | ActiveCharges;

			// sprintf(oapiDebugString(), "Charge Used: P1%d P2%d S1%d S2%d", RetractChargesUsed & DOCKINGPROBE_CHARGE_PRIM1 , RetractChargesUsed & DOCKINGPROBE_CHARGE_PRIM2 , RetractChargesUsed & DOCKINGPROBE_CHARGE_SEC1 , RetractChargesUsed & DOCKINGPROBE_CHARGE_SEC2); 
		}
	}

	///
	/// Begin Advanced Docking Code
	///
	if (DockingMethod > ADVANCED){
		// Code that follows is largely lifted from Atlantis...
		// Goal is to handle close proximity docking between a probe and drogue

		VECTOR3 gdrgPos, gdrgDir, gprbPos, gprbDir, gvslPos, rvel, pos, dir, rot;
		OurVessel->Local2Global (Dockparam[0],gprbPos);  //converts probe location to global
		OurVessel->GlobalRot (Dockparam[1],gprbDir);     //rotates probe direction to global

		// Search the complete vessel list for a grappling candidate.
		// Not very scalable ...
		for (DWORD i = 0; i < oapiGetVesselCount(); i++) {
			OBJHANDLE hV = oapiGetVesselByIndex (i);
			if (hV == OurVessel->GetHandle()) continue; // we don't want to grapple ourselves ...
			oapiGetGlobalPos (hV, &gvslPos);
			if (dist (gvslPos, gprbPos) < oapiGetSize (hV)) { // in range
				VESSEL *v = oapiGetVesselInterface (hV);
				DWORD nAttach = v->AttachmentCount (true);
				for (DWORD j = 0; j < nAttach; j++) { // now scan all attachment points of the candidate
					ATTACHMENTHANDLE hAtt = v->GetAttachmentHandle (true, j);
					const char *id = v->GetAttachmentId (hAtt);
					if (strncmp (id, "PADROGUE", 8)) continue; // attachment point not compatible
					v->GetAttachmentParams (hAtt, pos, dir, rot);
					v->Local2Global (pos, gdrgPos);  // converts found drogue position to global
					v->GlobalRot (dir, gdrgDir);     // rotates found drogue direction to global
					if (dist (gdrgPos, gprbPos) < COLLISION_DETECT_RANGE && DockingMethod == ADVANCEDPHYSICS) { // found one less than a meter away!
						//  Detect if collision has happend, if so, t will return intersection point along the probe line X(t) = gprbPos + t * gprbDir
						double t = CollisionDetection(gprbPos, gprbDir, gdrgPos, gdrgDir);	
						//  Calculate time of penetration according to current velocity
						OurVessel->GetRelativeVel(hV, rvel);
						//  Determine resultant force

						//APPLY rforce to DockingProbe Vessel, and APPLY -rforce to Drogue Vessel
						return;
					} 
					if (dist(gdrgPos, gprbPos) < CAPTURE_DETECT_RANGE && DockingMethod > ADVANCED) {
						// If we're within capture range, set docking port to attachment so docking can take place
						// Originally, I would have used the Attachment features to soft dock and move the LM during retract
						// but Artlav's docking method does this better and uses the docking port itself.
						// Attachment is being used as a placeholder for the docking port and to identify its orientation.
						OurVessel->GetAttachmentParams(hattPROBE, pos, dir, rot);
						DOCKHANDLE dock = OurVessel->GetDockHandle(ourPort);
						OurVessel->SetDockParams(dock, pos, dir, rot);
					}
				}//for nAttach
			}//if inRange
		}//for nVessel
	}
}
KString& KString::operator += (TCHAR cChar)
{
	Extend(&cChar, 1);
	
	return *this;
}
/// @brief Defines a new type of class
/// @brief type: Type name
/// @brief methods: Method table
/// @brief new: New function
/// @brief params: Extra parameters
/// @note upvalue 1: Data table
static int Define (lua_State * L)
{
	if (lua_isnoneornil(L, 1)) luaL_error(L, "class.define: nil type");
	if (!lua_istable(L, 2)) luaL_error(L, "class.define: non-table methods");
	if (lua_isnoneornil(L, 3)) luaL_error(L, "class.define: nil new");

	// Allocate an entry for the class type and its methods. Check for extra parameters.
	bool bParams = lua_gettop(L) > 3;

	lua_settop(L, bParams ? 4 : 3);	// type, methods, new[, params]

	lua_createtable(L, eCDI_N, 0);	// type, methods, new[, params], C = {}
	lua_newtable(L);// type, methods, new[, params], C, cmethods = {}
	lua_rawgeti(L, lua_upvalueindex(1), eDefs);	// type, methods, new[, params], C, cmethods, _D

	if (bParams)
	{
		if (!lua_istable(L, 4)) luaL_error(L, "class.define: non-table parameters");

		// Inherit from base class if provided.
		lua_getfield(L, 4, "base");	// type, methods, new, params, C, cmethods, _D, base

		if (!lua_isnil(L, 8))
		{
			// Verify that the base class exists.
			lua_gettable(L, 7);	// type, methods, new, params, C, cmethods, _D, _D[base]

			if (lua_isnil(L, 8)) luaL_error(L, "class.define: base class does not exist");

			// By default, the new class will inherit the base class's size.
			lua_rawgeti(L, 8, eSize);	// type, methods, new, params, C, cmethods, _D, _D[base], size
			lua_rawseti(L, 5, eSize);	// type, methods, new, params, C, cmethods, _D, _D[base]

			// Bind the method table's "__index" metamethod to the base class's method table to
			// inherit its methods.
			lua_newtable(L);// type, methods, new, params, C, cmethods, _D, _D[base], {}
			lua_rawgeti(L, 8, eMethods);// type, methods, new, params, C, cmethods, _D, _D[base], {}, bmethods

			lua_setfield(L, 9, "__index");	// type, methods, new, params, C, cmethods, _D, _D[base], { __index = bmethods }
			lua_replace(L, 8);	// type, methods, new, params, C, cmethods, _D, { __index }
			lua_setmetatable(L, 6);	// type, methods, new, params, C, cmethods, _D

			// Store the base class name.
			lua_getfield(L, 4, "base");	// type, methods, new, params, C, cmethods, _D, base
			lua_rawseti(L, 5, eBase);	// type, methods, new, params, C, cmethods, _D
		}

		else lua_pop(L, 1);	// type, methods, new, params, C, cmethods, _D

		// Assign userdatum size if provided.
		lua_getfield(L, 4, "size");	// type, methods, new, params, C, cmethods, _D, size

		if (!lua_isnil(L, 8))
		{
			if (lua_tointeger(L, 8) <= 0) luaL_error(L, "class.define: non-positive integer size");

			lua_rawseti(L, 5, eSize);	// type, methods, new, params, C, cmethods, _D
		}

		else lua_pop(L, 1);	// type, methods, new, params, C, cmethods, _D

		// Treat remainder of function as though no parameters were provided.
		lua_remove(L, 4);	// type, methods, new, C, cmethods, _D
	}

	// Register the class.
	lua_pushvalue(L, 1);// type, methods, new, C, cmethods, _D, type
	lua_pushvalue(L, 4);// type, methods, new, C, cmethods, _D, type, C
	lua_settable(L, 6);	// _D[type] = C -> type, methods, new, C, cmethods, _D
	lua_pop(L, 1);	// type, methods, new, C, cmethods

	// Bind the metamethods table, installing stock methods.
	lua_newtable(L);// type, methods, new, C, cmethods, {}

	luaL_reg meta[] = {
		{ "__index", IndexDefault },
		{ "__newindex", NewIndexDefault }
	};

	for (int index = 0; index < sizeof(meta) / sizeof(luaL_reg); ++index)
	{
		lua_pushvalue(L, 5);// type, methods, new, C, cmethods, { ... }, cmethods
		lua_pushvalue(L, lua_upvalueindex(1));	// type, methods, new, C, cmethods, { ... }, cmethods, data
		lua_pushcclosure(L, meta[index].func, 2);	// type, methods, new, C, cmethods, { ... }, func
		lua_setfield(L, 6, meta[index].name);	// type, methods, new, C, cmethods, { ..., name = func }
	}

	lua_pushboolean(L, true);	// type, methods, new, C, cmethods, { ... }, true
	lua_setfield(L, 6, "__metatable");	// type, methods, new, C, cmethods, { ..., __metatable = true }
	lua_rawseti(L, 4, eMeta);	// type, methods, new, { meta = { ..., __metatable } }, cmethods

	// Bind the methods table, installing stock methods.
	luaL_reg Methods[] = {
		{ "InvokeIf", InvokeIf },
		{ "InvokeIf_", InvokeIf_ },
		{ 0, 0 }
	};

	luaL_register(L, 0, Methods);	// type, methods, new, { meta }, cmethods
	lua_rawseti(L, 4, eMethods);// type, methods, new, { meta, methods = cmethods }

	// Bind the new function.
	lua_pushvalue(L, 3);// type, methods, new, { meta, methods }, new
	lua_rawseti(L, 4, eNew);// type, methods, new, { meta, methods, new = new }

	// Install user-supplied methods and metamethods. Ensure that some metamethods are set.
	return Extend(L);	// cmeta, cmethods, methods, MM, n
}
KString& KString::operator += (LPCTSTR pSString)
{
	Extend(pSString, _tcslen(pSString));

	return *this;
}
void CSelection::SelectWord()
{
	MakeEmpty( FALSE );
	Extend( CSelection::eOutward, CSelection::eWord, FALSE, FALSE, FALSE );
}
Beispiel #7
0
CV_IMPL int
cvTrackFace(CvFaceTracker* pFaceTracker, IplImage* imgGray, CvRect* pRects, int nRects, CvPoint* ptRotate, double* dbAngleRotate)
{
    assert(NULL != pFaceTracker);
    assert(NULL != imgGray);
    assert(NULL != pRects && nRects >= NUM_FACE_ELEMENTS);
    if ((NULL == pFaceTracker) ||
        (NULL == imgGray))
        return 0;
    pFaceTracker->InitNextImage(imgGray);
    *ptRotate = pFaceTracker->ptRotate;
    *dbAngleRotate = pFaceTracker->dbRotateAngle;

    int nElements = 16;
    double dx = pFaceTracker->face[LEYE].ptCenter.x - pFaceTracker->face[REYE].ptCenter.x;
    double dy = pFaceTracker->face[LEYE].ptCenter.y - pFaceTracker->face[REYE].ptCenter.y;
    double d_eyes = sqrt(dx*dx + dy*dy);
    int d = cvRound(0.25 * d_eyes);
    int dMinSize = d;
    int nRestarts = 0;

    int elem;

    CvFaceElement big_face[NUM_FACE_ELEMENTS];
START:
    // init
    for (elem = 0; elem < NUM_FACE_ELEMENTS; elem++)
    {
        CvRect r = pFaceTracker->face[elem].r;
        Extend(r, d);
        if (r.width < 4*d)
        {
            r.x -= (4*d - r.width) / 2;
            r.width += 4*d - r.width;
        }
        if (r.height < 3*d)
        {
            r.y -= (3*d - r.height) / 2;
            r.height += 3*d - r.height;
        }
        if (r.x < 1)
            r.x = 1;
        if (r.y < 1)
            r.y = 1;
        if (r.x + r.width > pFaceTracker->imgGray->width - 2)
            r.width = pFaceTracker->imgGray->width - 2 - r.x;
        if (r.y + r.height > pFaceTracker->imgGray->height - 2)
            r.height = pFaceTracker->imgGray->height - 2 - r.y;
        if (!big_face[elem].Init(r, pFaceTracker->face[elem], pFaceTracker->mstgContours))
            return 0;
    }
    // find contours
    for (elem = 0; elem < NUM_FACE_ELEMENTS; elem++)
        big_face[elem].FindRects(pFaceTracker->imgGray, pFaceTracker->imgThresh, 32, dMinSize);
    // candidats
    CvTrackingRect new_face[NUM_FACE_ELEMENTS];
    int new_energy = 0;
    int found = ChoiceTrackingFace3(pFaceTracker, nElements, big_face, new_face, new_energy);
    int restart = 0;
    int find2 = 0;
    int noel = -1;
    if (found)
    {
        if (new_energy > 100000 && -1 != pFaceTracker->iTrackingFaceType)
            find2 = 1;
        else if (new_energy > 150000)
        {
            int elements = 0;
            for (int el = 0; el < NUM_FACE_ELEMENTS; el++)
            {
                if (big_face[el].m_seqRects->total > 16 || (big_face[el].m_seqRects->total > 8 && new_face[el].iEnergy < 100))
                    elements++;
                else
                    noel = el;
            }
            if (2 == elements)
                find2 = 1;
            else
                restart = 1;
        }
    }
    else
    {
        if (-1 != pFaceTracker->iTrackingFaceType)
            find2 = 1;
        else
            restart = 1;
    }
RESTART:
    if (restart)
    {
        if (nRestarts++ < 2)
        {
            d = d + d/4;
            goto START;
        }
    }
    else if (find2)
    {
        if (-1 != pFaceTracker->iTrackingFaceType)
            noel = pFaceTracker->iTrackingFaceType;
        int found2 = ChoiceTrackingFace2(pFaceTracker, nElements, big_face, new_face, new_energy, noel);
        if (found2 && new_energy < 100000)
        {
            pFaceTracker->iTrackingFaceType = noel;
            found = 1;
        }
        else
        {
            restart = 1;
            goto RESTART;
        }
    }

    if (found)
    {
        // angle by mouth & eyes
        double vx_prev = double(pFaceTracker->face[LEYE].ptCenter.x + pFaceTracker->face[REYE].ptCenter.x) / 2.0 - pFaceTracker->face[MOUTH].ptCenter.x;
        double vy_prev = double(pFaceTracker->face[LEYE].ptCenter.y + pFaceTracker->face[REYE].ptCenter.y) / 2.0 - pFaceTracker->face[MOUTH].ptCenter.y;
        double vx_prev1 = vx_prev * cos(pFaceTracker->dbRotateDelta) - vy_prev * sin(pFaceTracker->dbRotateDelta);
        double vy_prev1 = vx_prev * sin(pFaceTracker->dbRotateDelta) + vy_prev * cos(pFaceTracker->dbRotateDelta);
        vx_prev = vx_prev1;
        vy_prev = vy_prev1;
        for (elem = 0; elem < NUM_FACE_ELEMENTS; elem++)
            pFaceTracker->face[elem] = new_face[elem];
        double vx = double(pFaceTracker->face[LEYE].ptCenter.x + pFaceTracker->face[REYE].ptCenter.x) / 2.0 - pFaceTracker->face[MOUTH].ptCenter.x;
        double vy = double(pFaceTracker->face[LEYE].ptCenter.y + pFaceTracker->face[REYE].ptCenter.y) / 2.0 - pFaceTracker->face[MOUTH].ptCenter.y;
        pFaceTracker->dbRotateDelta = 0;
        double n1_n2 = (vx * vx + vy * vy) * (vx_prev * vx_prev + vy_prev * vy_prev);
        if (n1_n2 != 0)
            pFaceTracker->dbRotateDelta = asin((vx * vy_prev - vx_prev * vy) / sqrt(n1_n2));
        pFaceTracker->dbRotateAngle -= pFaceTracker->dbRotateDelta;
    }
    else
    {
        pFaceTracker->dbRotateDelta = 0;
        pFaceTracker->dbRotateAngle = 0;
    }
    if ((pFaceTracker->dbRotateAngle >= pi/2 && pFaceTracker->dbRotateAngle > 0) ||
        (pFaceTracker->dbRotateAngle <= -pi/2 && pFaceTracker->dbRotateAngle < 0))
    {
        pFaceTracker->dbRotateDelta = 0;
        pFaceTracker->dbRotateAngle = 0;
        found = 0;
    }
    if (found)
    {
        for (int i = 0; i < NUM_FACE_ELEMENTS && i < nRects; i++)
            pRects[i] = pFaceTracker->face[i].r;
    }
    return found;
}//int FindFaceTracker(CvFaceTracker* pFaceTracker, IplImage* imgGray, CvRect* pRects, int nRects, CvPoint& ptRotate, double& dbAngleRotate)
Beispiel #8
0
void CvFaceElement::FindContours(IplImage* img, IplImage* thresh, int nLayers, int dMinSize)
{
    CvSeq* seq;
    CvRect roi = m_rROI;
    Extend(roi, 1);
    cvSetImageROI(img, roi);
    cvSetImageROI(thresh, roi);
    // layers
    int colors[MAX_LAYERS] = {0};
    int iMinLevel = 0, iMaxLevel = 255;
    float step, power;
    ThresholdingParam(img, nLayers / 2, iMinLevel, iMaxLevel, step, power, 4);
    int iMinLevelPrev = iMinLevel;
    int iMaxLevelPrev = iMinLevel;
    if (m_trPrev.iColor != 0)
    {
        iMinLevelPrev = m_trPrev.iColor - nLayers / 2;
        iMaxLevelPrev = m_trPrev.iColor + nLayers / 2;
    }
    if (iMinLevelPrev < iMinLevel)
    {
        iMaxLevelPrev += iMinLevel - iMinLevelPrev;
        iMinLevelPrev = iMinLevel;
    }
    if (iMaxLevelPrev > iMaxLevel)
    {
        iMinLevelPrev -= iMaxLevelPrev - iMaxLevel;
        if (iMinLevelPrev < iMinLevel)
            iMinLevelPrev = iMinLevel;
        iMaxLevelPrev = iMaxLevel;
    }
    int n = nLayers;
    n -= (iMaxLevelPrev - iMinLevelPrev + 1) / 2;
    step = float(iMinLevelPrev - iMinLevel + iMaxLevel - iMaxLevelPrev) / float(n);
    int j = 0;
    float level;
    for (level = (float)iMinLevel; level < iMinLevelPrev && j < nLayers; level += step, j++)
        colors[j] = int(level + 0.5);
    for (level = (float)iMinLevelPrev; level < iMaxLevelPrev && j < nLayers; level += 2.0, j++)
        colors[j] = int(level + 0.5);
    for (level = (float)iMaxLevelPrev; level < iMaxLevel && j < nLayers; level += step, j++)
        colors[j] = int(level + 0.5);
    //
    for (int i = 0; i < nLayers; i++)
    {
        cvThreshold(img, thresh, colors[i], 255.0, CV_THRESH_BINARY);
        if (cvFindContours(thresh, m_mstgRects, &seq, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE))
        {
            CvTrackingRect cr;
            for (CvSeq* external = seq; external; external = external->h_next)
            {
                cr.r = cvContourBoundingRect(external);
                Move(cr.r, roi.x, roi.y);
                if (RectInRect(cr.r, m_rROI) && cr.r.width > dMinSize  && cr.r.height > dMinSize)
                {
                    cr.ptCenter = Center(cr.r);
                    cr.iColor = colors[i];
                    cvSeqPush(m_seqRects, &cr);
                }
                for (CvSeq* internal = external->v_next; internal; internal = internal->h_next)
                {
                    cr.r = cvContourBoundingRect(internal);
                    Move(cr.r, roi.x, roi.y);
                    if (RectInRect(cr.r, m_rROI) && cr.r.width > dMinSize  && cr.r.height > dMinSize)
                    {
                        cr.ptCenter = Center(cr.r);
                        cr.iColor = colors[i];
                        cvSeqPush(m_seqRects, &cr);
                    }
                }
            }
            cvClearSeq(seq);
        }
    }
    cvResetImageROI(img);
    cvResetImageROI(thresh);
}//void CvFaceElement::FindContours(IplImage* img, IplImage* thresh, int nLayers)
Beispiel #9
0
	int Dinic(void) {
		int r = 0, t;
		while (Bfs()) while (t = Extend(vs, inf)) r += t;
		return r;
	}