HRESULT ClearElementFromAllLocations( IN IAppHostAdminManager * pAdminMgr, IN CONST WCHAR * szConfigPath, IN CONST WCHAR * szElementName ) { HRESULT hr; CComPtr<IAppHostConfigLocationCollection> pLocationCollection; CComPtr<IAppHostConfigLocation> pLocation; CComPtr<IAppHostChildElementCollection> pChildCollection; ENUM_INDEX index; // // Enum the <location> tags, remove the specified elements. // hr = GetLocationCollection( pAdminMgr, szConfigPath, &pLocationCollection ); if (FAILED(hr)) { DBGERROR_HR(hr); goto exit; } for (hr = FindFirstLocation(pLocationCollection, &index, &pLocation) ; SUCCEEDED(hr) ; hr = FindNextLocation(pLocationCollection, &index, &pLocation)) { if (hr == S_FALSE) { hr = S_OK; break; } hr = ClearLocationElements(pLocation, szElementName); if (FAILED(hr)) { DBGERROR_HR(hr); goto exit; } pLocation.Release(); } exit: return hr; }
void CObjectTracker::ObjeckTrackerHandlerByUser(UBYTE8 *frame) { m_cActiveObject = 0; if (m_sTrackingObjectTable[m_cActiveObject].Status) { if (!m_sTrackingObjectTable[m_cActiveObject].assignedAnObject) { FindHistogram(frame,m_sTrackingObjectTable[m_cActiveObject].initHistogram); m_sTrackingObjectTable[m_cActiveObject].assignedAnObject = true; } else { FindNextLocation(frame); DrawObjectBox(frame); } } }
//进行一次跟踪 void CObjectTracker::ObjeckTrackerHandlerByUser(IplImage *frame) { m_cActiveObject = 0; if (m_sTrackingObjectTable[m_cActiveObject].Status) { if (!m_sTrackingObjectTable[m_cActiveObject].assignedAnObject) { //计算目标的初始直方图 FindHistogram(frame,m_sTrackingObjectTable[m_cActiveObject].initHistogram); m_sTrackingObjectTable[m_cActiveObject].assignedAnObject = true; } else { //在图像上搜索目标 FindNextLocation(frame); DrawObjectBox(frame); } } }
HRESULT FindFirstLocation( IN IAppHostConfigLocationCollection * pCollection, OUT ENUM_INDEX * pIndex, OUT IAppHostConfigLocation ** pLocation ) { HRESULT hr; hr = pCollection->get_Count(&pIndex->Count); if (FAILED(hr)) { DBGERROR_HR(hr); return hr; } VariantInit(&pIndex->Index); pIndex->Index.vt = VT_UI4; pIndex->Index.ulVal = 0; return FindNextLocation(pCollection, pIndex, pLocation); }