We all know that we have been developing the intelligent recognition function of EasyCVR recently. In order to adapt different formats and SDK with our EasyCVR, we have also started to study this. This article is mainly to share the brief introduction of dahua SDK’s graph search function when we develop intelligent recognition function.
The realization of this function is mainly to import a picture and similarity value from the outside, IVSS, NVR and other devices through this picture to retrieve the history database or face database whether there has been a matching face, and return the picture results above the similarity.
The following is a brief description of the downsizing process:
1. Call CLIENT_Init to complete the SDK initialization process. 2. After the initialization is successful, call CLIENT_LoginEx2 to log in to the device. 3. Call CLIENT_StartFindFaceRecognition to set face query conditions. 4. Check the return value in the preceding steps. If nTotalCount returns -1, wait until the device query is complete. 5. Call CLIENT_AttachFaceFindState to subscribe to face query state. Then wait for the return progress in the progress callback function to reach 100 for the search to complete. After the search is complete, call CLIENT_DetachFaceFindState to unsubscribe the query progress. 6. Call the CLIENT_DoFindFaceRecognition interface to obtain the query result. 7. Call the CLIENT_StopFindFaceRecognition interface to end the query. 8. After services are used, call CLIENT_Logout to log out of the device. 9. After the SDK function is used, call CLIENT_Cleanup to release SDK resources.
Code examples:
Void CALLBACK FaceFindState(LLONG lLoginID, LLONG lAttachHandle, NET_CB_FACE_FIND_STATE* pstStates, int nStateNum, LDWORD dwUser) {if (pstStates->nProgress== 100) // indicates the query progress 100% {// stop face query progress subscription CLIENT_DetachFaceFindState(lAttachHandle); // start DoFind(); } return; } // Set the query condition NET_IN_STARTFIND_FACERECONGNITION stuInParam = {sizeof(stuInParam)}; NET_OUT_STARTFIND_FACERECONGNITION stuOutParam = { sizeof(stuOutParam) }; stuInParam.stFilterInfo.dwSize = sizeof(stuInParam.stFilterInfo); stuInParam.stMatchOptions.dwSize = sizeof(stuInParam.stMatchOptions); stuInParam.bPersonExEnable = TRUE; stuInParam.nChannelID = 0; stuInParam.stMatchOptions.nSimilarity = 80; stuInParam.stFilterInfo.stStartTime = startTime; stuInParam.stFilterInfo.stEndTime = endTime; stuInParam.nBufferLen = nPicBufLen; stuInParam.pBuffer = strPicBuf; / / picture Buffer stuInParam. StPersonInfoEx. WFacePicNum = 1; stuInParam.stPersonInfoEx.szFacePicInfo[0].dwOffSet = 0; stuInParam.stPersonInfoEx.szFacePicInfo[0].dwFileLenth = nLength; BOOL bRet = CLIENT_StartFindFaceRecognition(m_lLoginId, &stuInParam, &stuOutParam, 5000); if (! bRet) { printf("CLIENT_StartFindFaceRecognition: failed! Error code %x.\n", CLIENT_GetLastError()); return -1; } m_lFindHandle = stuOutParam.lFindHandle;Copy the code