diff --git a/src/left_over/MSRegionSurveilance.cpp b/src/left_over/MSRegionSurveilance.cpp index c212679..3120082 100644 --- a/src/left_over/MSRegionSurveilance.cpp +++ b/src/left_over/MSRegionSurveilance.cpp @@ -10,7 +10,7 @@ IRegionSurveillance *MS_RegionSurveillance::GetMS_RS() //if (!MS_RS) { RegionSurveillance * MS_RS = nullptr; - if (checkTime() == 1 && (MS_RS = new RegionSurveillance())) + if (/*checkTime() == 1 &&*/ (MS_RS = new RegionSurveillance())) return MS_RS; else { diff --git a/src/left_over/help.cpp b/src/left_over/help.cpp index 8ba4dd1..e0b5790 100644 --- a/src/left_over/help.cpp +++ b/src/left_over/help.cpp @@ -1,8 +1,8 @@ /************************************************************* /* name: help.cpp -/* Description: ¸¨Öúº¯Êý¼¯ºÏ -/* Purpose£ºÂú×ãÒÔÏÂÌõ¼þ£¬ºÏ²¢Á½¸ö¿ò£º -/* 1 ´ó¿òÖаüº¬Ð¡¿ò 2 ¿ò½»²æ 3 ¿òÏàÁÚ +/* Description: ������������ +/* Purpose�����������������ϲ������� +/* 1 �������� 2 �ò½»²ï¿½ 3 ������ /* Update Time: by zl 20160307 **************************************************************/ #include "help.h" @@ -11,7 +11,7 @@ #include #include using namespace std; -//ÅÅÐò +//���� bool SortByPoint(const CForeground &C1,const CForeground &C2) { bool sign = false; @@ -28,7 +28,7 @@ bool SortByPoint(const CForeground &C1,const CForeground &C2) return false; } -//´Ó´óµ½Ð¡ +//�Ӵ�С bool SortByArea(const CForeground &C1, const CForeground &C2) { bool sign = false; @@ -38,7 +38,7 @@ bool SortByArea(const CForeground &C1, const CForeground &C2) return false; } -//ÅжÏxÊÇ·ñÔڱ߽çÄÚ +//�ж�x�Ƿ��ڱ߽��� bool InRange(int x, int boundary1, int boundary2) { int max_b = boundary1 >= boundary2 ? boundary1 : boundary2; @@ -49,33 +49,33 @@ bool InRange(int x, int boundary1, int boundary2) return false; } -//ÏàÁÚ»òÕß°üº¬ +//���ڻ��߰��� bool NeighbourorSub(CForeground c1, CForeground c2) { - //c2ÖÐÐĵãÔÚc1ÄÚ²¿ ÐèÒªºÏ²¢ ·µ»Øtrue + //c2���ĵ���c1�ڲ� ��Ҫ�ϲ� ����true /*if (c2.m_ptCenter.x < c1.m_rtConnect.right && InRange(c2.m_ptCenter.y, c1.m_rtConnect.top, c1.m_rtConnect.bottom)) return true; else */ - //ÊäÈëÌõ¼þΪc2Ò»¶¨ÔÚc1µÄÓÒ²à Òò´ËÈô½»²æ»òÕß°üº¬ c2µÄ×óϵ㠻òÕß ÓÒÉϵ㠿϶¨ÖÁÉÙÓÐÒ»¸öÔÚc1µÄÄÚ²¿ + //��������Ϊc2һ����c1���Ҳ� �����������߰��� c2�����µ� ���� ���ϵ� �϶�������һ����c1���ڲ� if (c2.m_rtConnect.left <= c1.m_rtConnect.right) { - //°üº¬»òÕß½»²æ + //�������߽��� if (InRange(c2.m_rtConnect.bottom, c1.m_rtConnect.top, c1.m_rtConnect.bottom) || InRange(c2.m_rtConnect.top, c1.m_rtConnect.top, c1.m_rtConnect.bottom)) return true; - //ÉÏ·½ÁÚ½ü »òÕß Ï·½ÁÚ½ü + //�Ϸ��ڽ� ���� �·��ڽ� else if (abs(c1.m_rtConnect.top - c2.m_rtConnect.bottom) < MergeMinDistance || abs(c1.m_rtConnect.bottom - c2.m_rtConnect.top) < MergeMinDistance) return true; } else if (InRange(c2.m_rtConnect.bottom, c1.m_rtConnect.top, c1.m_rtConnect.bottom) || InRange(c2.m_rtConnect.top, c1.m_rtConnect.top, c1.m_rtConnect.bottom)) { - if((abs(c1.m_rtConnect.right - c2.m_rtConnect.left) < MergeMinDistance)) //c2 ÔÚ c1 ÓÒ²à ÁÚ½ü + if((abs(c1.m_rtConnect.right - c2.m_rtConnect.left) < MergeMinDistance)) //c2 �� c1 �Ҳ� �ڽ� return true; } return false; } -//ºÏ²¢ +//�ϲ� void MergeNeighborBox(vector &ForegroundArray) { vector::iterator iter1 = ForegroundArray.begin(); @@ -84,23 +84,23 @@ void MergeNeighborBox(vector &ForegroundArray) vector::iterator iter2 = iter1 + 1; for (; iter2 != ForegroundArray.end(); ) { - //if ((x2 <= iter1->m_rtConnect.right && y2 <= iter1->m_rtConnect.bottom && y2 >= iter1->m_rtConnect.top) || //´ó¿òº¬Ð¡¿ò×´¿ö - // (iter2->m_rtConnect.left <= iter1->m_rtConnect.right && iter2->m_rtConnect.bottom <= iter1->m_rtConnect.bottom && iter2->m_rtConnect.bottom >= iter1->m_rtConnect.top) || //¿ò½»²æ ×óÉϽÇÔÚµÚÒ»¸ö¿òÄÚ - // (iter2->m_rtConnect.left <= iter1->m_rtConnect.right && iter2->m_rtConnect.top <= iter1->m_rtConnect.bottom && iter2->m_rtConnect.top >= iter1->m_rtConnect.top) ||//¿ò½»²æ ×óϽÇÔÚµÚÒ»¸ö¿òÄÚ - // iter2->m_rtConnect.left <= iter1->m_ptCenter.x && abs(iter2->m_rtConnect.bottom - iter1->m_rtConnect.top) < 10 ||//¾àÀë½Ï½üµÄ + //if ((x2 <= iter1->m_rtConnect.right && y2 <= iter1->m_rtConnect.bottom && y2 >= iter1->m_rtConnect.top) || //���С��״�� + // (iter2->m_rtConnect.left <= iter1->m_rtConnect.right && iter2->m_rtConnect.bottom <= iter1->m_rtConnect.bottom && iter2->m_rtConnect.bottom >= iter1->m_rtConnect.top) || //�ò½»²ï¿½ ���Ͻ��ڵ�һ������ + // (iter2->m_rtConnect.left <= iter1->m_rtConnect.right && iter2->m_rtConnect.top <= iter1->m_rtConnect.bottom && iter2->m_rtConnect.top >= iter1->m_rtConnect.top) ||//�ò½»²ï¿½ ���½��ڵ�һ������ + // iter2->m_rtConnect.left <= iter1->m_ptCenter.x && abs(iter2->m_rtConnect.bottom - iter1->m_rtConnect.top) < 10 ||//����Ͻ��� // iter2->m_rtConnect.left <= iter1->m_ptCenter.x && abs(iter2->m_rtConnect.top - iter1->m_rtConnect.bottom) < 10 || - // distance < 20 //¾àÀë½Ï½üµÄ + // distance < 20 //����Ͻ��� // ) if (NeighbourorSub(*iter1, *iter2)) { - //ºÏ²¢ + //�ϲ� iter1->m_rtConnect.left = min(iter1->m_rtConnect.left, iter2->m_rtConnect.left); iter1->m_rtConnect.bottom = max(iter1->m_rtConnect.bottom, iter2->m_rtConnect.bottom); iter1->m_rtConnect.right = max(iter1->m_rtConnect.right, iter2->m_rtConnect.right); iter1->m_rtConnect.top = min(iter1->m_rtConnect.top, iter2->m_rtConnect.top); iter1->m_ptCenter.x = (iter1->m_rtConnect.right + iter1->m_rtConnect.left) / 2; iter1->m_ptCenter.y = (iter1->m_rtConnect.bottom + iter1->m_rtConnect.top) / 2; - //ɾ³ýÒ»¸ö + //ɾ��һ�� iter2 = ForegroundArray.erase(iter2); iter1 = iter2; iter1--; @@ -108,8 +108,8 @@ void MergeNeighborBox(vector &ForegroundArray) else iter2++; //else - // break; //ÓÉÓÚForegroundArray°´x×ø±êÅÅÁÐ ËùÒÔÈÏΪÈç¹ûµ±Ç°¿ÉÒԺϲ¢£¬ÔòÓпÉÄÜÏÂÒ»¸öÒ²ÐèÒªºÏ²¢£» - //µ«Èôµ±Ç°²»·ûºÏºÏ²¢ ÔòÏÂÒ»¸öÒ²²»»á·ûºÏ£¨ÎªÁ˼õÉÙ¼ÆËã´ÎÊý£© + // break; //����ForegroundArray��x�������� ������Ϊ�����ǰ���Ժϲ������п�����һ��Ҳ��Ҫ�ϲ��� + //������ǰ�����Ϻϲ� ����һ��Ҳ������ϣ�Ϊ�˼��ټ�������� } } @@ -125,9 +125,9 @@ int checkTime() nYear = info->tm_year + 1900; nMonth = info->tm_mon + 1; nDay = info->tm_mday; - if (nYear != 2020)//2017Äê1ÔÂ1ÈÕ°æ±¾¹ýÆÚ + if (nYear != 2021)//2017��1��1�հ汾���� { - printf("°æ±¾¹ýÆÚ£¡\n"); + printf("�汾���ڣ�\n"); return -1; } else diff --git a/src/left_over/svibe.cpp b/src/left_over/svibe.cpp index fb6cd84..bd7d833 100644 --- a/src/left_over/svibe.cpp +++ b/src/left_over/svibe.cpp @@ -1,4 +1,4 @@ -// svibe.cpp : ¶¨Òå¿ØÖÆÌ¨Ó¦ÓóÌÐòµÄÈë¿Úµã¡£ +// svibe.cpp : �������̨Ӧ�ó������ڵ㡣 #include #include #include "svibe.h" @@ -13,20 +13,20 @@ #include "help.h" #include "left_over_det.h" /************************************************************************/ -/* º¯Êý: get_ArrowDir() by zl */ -/* ×÷ÓÃ: »ñÈ¡·½ÏòºÍÓÃÓÚ»æÖƼýÍ·µÄÁ½¸ö¶Ëµã£» */ -/* ²ÎÊý: pROI0&pROI1£º°èÏßÁ½¸ö¶Ëµã£» */ -/* dir£ºÈ·¶¨µ¥Ïò¾¯±¨·½ÏòµÄ×ø±êµã£» */ -/* ·µ»Ø: 1:Õý·½Ïò£»0:¸º·½Ïò */ +/* ����: get_ArrowDir() by zl */ +/* ����: ��ȡ��������ڻ��Ƽ�ͷ�������˵㣻 */ +/* ����: pROI0&pROI1�����������˵㣻 */ +/* dir��ȷ�����ò¾¯±ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ã£» */ +/* ����: 1:������0:������ */ /************************************************************************/ int RegionSurveillance::get_ArrowDir(CMPoint pROI0, CMPoint pROI1, CMPoint dir) { float distance = (float)abs(pROI0.y - pROI1.y); - //»ñÈ¡·½Ïò - float k1, k2; //k1ΪԭÏ߶εÄбÂÊ + //��ȡ���� + float k1, k2; //k1Ϊԭ�߶ε�б�� - if (pROI0.y > pROI1.y) //ÔÚ°èÏß¿¿½üͼÏñÏ·½µÄ¶Ëµã´¦»­¼ýÍ· + if (pROI0.y > pROI1.y) //�ڰ��߿���ͼ���·��Ķ˵㴦����ͷ { pStart.x = pROI0.x; pStart.y = pROI0.y; @@ -37,18 +37,18 @@ int RegionSurveillance::get_ArrowDir(CMPoint pROI0, CMPoint pROI1, CMPoint dir) pStart.y = pROI1.y; } - if (pROI0.x != pROI1.x) //Èô²»ÎªÒ»¸ù´¹Ö±Ïß + if (pROI0.x != pROI1.x) //����Ϊһ����ֱ�� { k1 = (float)(pROI0.y - pROI1.y) / (float)(pROI0.x - pROI1.x); - if (k1 != 0) //Èô²»ÎªÒ»¸ùƽÐÐÏß + if (k1 != 0) //����Ϊһ��ƽ���� { k2 = -1 / k1; - float b = pROI1.y - k1 * pROI1.x;//y = kx + b ×ø±êϵһͼÏñ×óÉ϶¥µãΪԭµã£¬ÏòÓÒΪxÕý·½ÐÎ ÏòÏÂΪyÕý·½Ïò + float b = pROI1.y - k1 * pROI1.x;//y = kx + b ����ϵһͼ�����϶���Ϊԭ�㣬����Ϊx������ ����Ϊy������ if ((k1 < 0 && (float)((float)dir.y - k1 * (float)dir.x - b) < 0)||(k1 > 0 && (float)((float)dir.y - k1 * (float)dir.x - b) > 0)) { - if (distance < 30) //µ±Á½µãyÖµ²îÒì½ÏСʱ£¬´¹Ï߱Ƚ϶¸ Èô¼õÈ¥20 ¿ÉÄܵ¼Ö¼ýÍ·Ì«³¤ + if (distance < 30) //������yֵ�����Сʱ�����߱Ƚ϶� ����ȥ20 ���ܵ��¼�ͷ̫�� { pEnd.x = pStart.x - 2; } @@ -66,7 +66,7 @@ int RegionSurveillance::get_ArrowDir(CMPoint pROI0, CMPoint pROI1, CMPoint dir) } pEnd.y = (int)((pEnd.x - pStart.x) * k2 + pStart.y); } - else //ÈôΪˮƽÏß + else //��Ϊˮƽ�� { pEnd.x = pStart.x; if (dir.y > pStart.y) @@ -77,7 +77,7 @@ int RegionSurveillance::get_ArrowDir(CMPoint pROI0, CMPoint pROI1, CMPoint dir) } } - else //ÈôΪ´¹Ö±Ïß + else //��Ϊ��ֱ�� { pEnd.y = pStart.y; if (dir.x > pStart.x) @@ -85,20 +85,20 @@ int RegionSurveillance::get_ArrowDir(CMPoint pROI0, CMPoint pROI1, CMPoint dir) else pEnd.x = pStart.x - 20; } - //·ÀÖ¹Ô½½ç + //��ֹԽ�� pEnd.x = pEnd.x >= 0 ? pEnd.x : 0; pEnd.x = pEnd.x <= GlobelWidth ? pEnd.x : GlobelWidth; pEnd.y = pEnd.y >= 0 ? pEnd.y : 0; pEnd.y = pEnd.y <= GlobelHeight ? pEnd.y : GlobelHeight; - if (pROI0.x == pROI1.x) //ÈôΪ´¹Ö±Ïß + if (pROI0.x == pROI1.x) //��Ϊ��ֱ�� { if (pEnd.x > pStart.x) return 1; else return 0; } - else if (k1 <= 0) //Èô²»Îª´¹Ö±ÏßÇÒбÂÊСÓÚµÈÓÚ0£¨º¬Ë®Æ½ÏßÇé¿ö£© + else if (k1 <= 0) //����Ϊ��ֱ����б��С�ڵ���0����ˮƽ������� { if ((pStart.x != pEnd.x && pEnd.x > pStart.x) || (pStart.x == pEnd.x && pEnd.y > pStart.y)) return 0; @@ -116,27 +116,27 @@ int RegionSurveillance::get_ArrowDir(CMPoint pROI0, CMPoint pROI1, CMPoint dir) /****************************************************************************** * Function: RSinit -* Description: MaskImgDataÄÚ´æ·ÇÅä¼°VIBE Ä£Ðͳõʼ»¯ +* Description: MaskImgData�ڴ���估VIBE ģ�ͳ�ʼ�� * Calls: VibeModelInitC3 * Called By: main -* Input: nWidth ͼÏñ¿í¶È - nHeight ͼÏñ¸ß¶È - frameImgData ͼÏñRGB -* Output: vbM VIBE Ä£ÐÍ -* Return: 0 ÊäÈëͨµÀ²ÎÊý²»ºÏÀí 1 Õý³£ +* Input: nWidth ͼ����� + nHeight ͼ��߶� + frameImgData ͼ��RGB +* Output: vbM VIBE � +* Return: 0 ����ͨ������������ 1 ���� *******************************************************************************/ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned char* frameImgData, int nChannel, int nChannel_deal, bool nfiltFlag, int maxObjNum, int minArea, int maxArea) { macDetectObjNum = maxObjNum; - if(nWidth < 600 || nHeight < 300) //Èç¹û³ß´ç¹ýС ÐÞ¸Ävibe²ÎÊý + if(nWidth < 600 || nHeight < 300) //����ߴ��С �޸�vibe���� VBPARAM = new VIBEPARAM(35, 18); else VBPARAM = new VIBEPARAM(20, 35); - //checkMID£ºÈí¼þÐí¿É¼ì²â by zl - if (/*checkMIDkeySet() == -1 */ checkTime() == -1 || (nChannel != 1 && nChannel != 3) || (nChannel_deal != 1 && nChannel_deal != 3) || (nChannel_deal > nChannel)) + //checkMID���������ɼ�� by zl + if (/*checkMIDkeySet() == -1 */ /*checkTime() == -1 || */(nChannel != 1 && nChannel != 3) || (nChannel_deal != 1 && nChannel_deal != 3) || (nChannel_deal > nChannel)) { return 0; } @@ -147,8 +147,8 @@ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned GlobelHeight = nHeight; GlobelWidthstep = widthstep; gfiltFlag = nfiltFlag; - OBJECT_AREA_MIN = minArea; //ĬÈÏ×î´ó¹ýÂËÃæ»ýΪ1,000,000 by zl 20160304 - OBJECT_AREA_MAX = maxArea; //ĬÈÏ×îС¹ýÂËÃæ»ýΪ300 by zl 20160304 + OBJECT_AREA_MIN = minArea; //Ĭ�����������Ϊ1,000,000 by zl 20160304 + OBJECT_AREA_MAX = maxArea; //Ĭ����С�������Ϊ300 by zl 20160304 /* int widthstep = nWidth * 3; if (widthstep % 4) @@ -164,12 +164,12 @@ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned memset(MaskImgCfd, 0, sizeof(float)* GlobelWidth * GlobelHeight); if (!vbM) { - // ³õʼ»¯Ä£ÐÍ + // ��ʼ��ģ�� if (nChannel == 3) { if (nChannel_deal == 3) { - // ¸ß˹ģºý + // ��˹ģ�� if (nfiltFlag == 1) { unsigned char* inputData = NULL; @@ -207,10 +207,10 @@ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned { greyImgData = (unsigned char*) malloc(sizeof(unsigned char*) * GlobelWidth * nHeight); memset(greyImgData, 0, sizeof(unsigned char*)); - // ½«RGBͼÏñת»»Îª»Ò¶ÈͼÏñ + // ��RGBͼ��ת��Ϊ�Ҷ�ͼ�� VibeRGBToGray(frameImgData, greyImgData); - // ¸ß˹ģºý + // ��˹ģ�� if (nfiltFlag == 1) { unsigned char* inputData = NULL; @@ -241,7 +241,7 @@ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned } else { - // ¸ß˹ģºý + // ��˹ģ�� if (nfiltFlag == 1) { unsigned char* inputData = NULL; @@ -272,10 +272,10 @@ int RegionSurveillance::RSinit(int nWidth, int nHeight, int widthstep, unsigned } } - left_flag = 1; // ¶ºÁô±êÖ¾ 0 ÒÅÁô 1ÒÆ³ý + left_flag = 1; // ������־ 0 ���� 1�Ƴ� - maskImg = new unsigned char[nWidth*nHeight]; //ÅòÕͺ͸¯Ê´ ¼ÓËÙÓà - memset(maskImg, 0, sizeof(maskImg[0])*nWidth*nHeight); //ÅòÕͺ͸¯Ê´ ¼ÓËÙÓà + maskImg = new unsigned char[nWidth*nHeight]; //���ͺ͸�ʴ ������ + memset(maskImg, 0, sizeof(maskImg[0])*nWidth*nHeight); //���ͺ͸�ʴ ������ return 1; } @@ -319,17 +319,17 @@ VibeModel_t * RegionSurveillance::VibeModelInitC1(uint8_t *image_data) /****************************************************************************** * Function: VibeModelInitC3 -* Description: VIBEÄ£Ðͳõʼ»¯ +* Description: VIBEģ�ͳ�ʼ�� * Calls: RandInit RandNeighborInit GetRandNeighborXY * Called By: RSinit -* Input: image_data ͼÏñRGB +* Input: image_data ͼ��RGB * Output: g_XNeighborTable 22100012 g_YNeighborTable 10001222 - g_randTable 65536¸öËæ»úÊý - g_XTable 0 0 1 2 3 ... ¿í¶È-1 ¿í¶È-1 - g_YTable 0 0 1 2 3 ... ¸ß¶È-1 ¸ß¶È-1 + g_randTable 65536������� + g_XTable 0 0 1 2 3 ... ����-1 ����-1 + g_YTable 0 0 1 2 3 ... �߶�-1 �߶�-1 * Return: vbM *******************************************************************************/ VibeModel_t* RegionSurveillance::VibeModelInitC3(uint8_t *image_data) @@ -449,11 +449,11 @@ void RegionSurveillance::VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, u }// end of for y loop - VibeModelDilation2(output, maskImg, model->width, model->height);// ÅòÕÍ - VibeModelErosion2(maskImg, output, model->width, model->height);// ¸¯Ê´ - //δ¼ÓËÙ°æ±¾ - //VibeModelDilation(output, model->width, model->height);// ÅòÕÍ - //VibeModelErosion(output, model->width, model->height);// ¸¯Ê´ + VibeModelDilation2(output, maskImg, model->width, model->height);// ���� + VibeModelErosion2(maskImg, output, model->width, model->height);// ��ʴ + //δ���ٰ汾 + //VibeModelDilation(output, model->width, model->height);// ���� + //VibeModelErosion(output, model->width, model->height);// ��ʴ g_frameCount++; @@ -462,16 +462,16 @@ void RegionSurveillance::VibeModelUpdateC1(VibeModel_t *model, uint8_t *image, u /****************************************************************************** * Function: VibeModelUpdateC3 -* Description: VIBEÄ£Ð͸üР+* Description: VIBEģ�͸��� * Calls: GetRand GetRandNeighborXY VibeModelDilation VibeModelErosion * Called By: RSDetect -* Input: model VBM Ä£ÐÍ - image ͼÏñRGB -* Output: output ǰ¾°ÊÇ255 ±³¾°ÊÇ0 - model VBM Ä£ÐÍ +* Input: model VBM � + image ͼ��RGB +* Output: output ǰ����255 ������0 + model VBM � *******************************************************************************/ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, uint8_t *output) { @@ -487,10 +487,10 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u { for (x = 0; x < model->width; x++) { - // µ±Ç°µã¶ÔÓ¦µÄÄ£°åÖеÄË÷Òý + // ��ǰ���Ӧ��ģ���е����� sampleOffset = ((y * model-> width * model->nSample + x * model->nSample) << 1) + (y * model-> width * model->nSample + x * model->nSample); - // µ±Ç°µã¶ÔÓ¦µÄRGBÖеÄË÷Òý + // ��ǰ���Ӧ��RGB����� imageOffset = ((y * model->width + x) << 1) + (y * model->width + x); // if (imageOffset>=(model->width * model->height)) @@ -500,7 +500,7 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u count = 0; index = 0; - // Èç¹ûµ±Ç°Âú×ããÐÖµµÄµãÊýСÓڹ涨ƥÅäµãÊý ÇÒ µ±Ç°ÆÀ¹ÀµÄµãÊýСÓÚ20¸öµã + // �����ǰ������ֵ�ĵ���С�ڹ涨ƥ����� �� ��ǰ�����ĵ���С��20���� while ((count < model->nMatch) && (index < model->nSample)) { //Euclidean distance computation @@ -508,10 +508,10 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u dist = (double)((image[imageOffset] - model->bg_samples[tmpValue ])*(image[imageOffset] - model->bg_samples[tmpValue])) + (double)((image[imageOffset + 1] - model->bg_samples[tmpValue + 1])*(image[imageOffset + 1] - model->bg_samples[tmpValue+ 1])) + (double)((image[imageOffset + 2] - model->bg_samples[tmpValue + 2])*(image[imageOffset + 2] - model->bg_samples[tmpValue + 2])); - // ÈýͨµÀ¼ÆËã¾àÀëÖ®ºÍ + // ��ͨ���������֮�� //dist = abs(image[imageOffset] - model->bg_samples[tmpValue]) + abs(image[imageOffset + 1] - model->bg_samples[tmpValue + 1]) //+ abs(image[imageOffset + 2] - model->bg_samples[tmpValue + 2]); - // Âú×ããÐÖµÌõ¼þµÄµã + // ������ֵ�����ĵ� if (dist < model->threshold * model->threshold * 3) { count++; @@ -520,22 +520,22 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u index++; } - // Èç¹ûµ±Ç°µãΪǰ¾° + // �����ǰ��Ϊǰ�� if (count < model->nMatch) { output[y * model->width + x] = VBPARAM->DEFAULT_COLOR_FOREGROUND; - // ǰ20Ö¡Ôö¼ÓÄ£°åÐÅÏ¢ + // ǰ20֡����ģ����Ϣ if (g_frameCount < model->nSample) { - // Ëæ»ú¸üе±Ç°µã¶ÔÓ¦µÄÄ£°åÖеÄijһ±³¾° + // ������µ�ǰ���Ӧ��ģ���е�ijһ���� rand = GetRand() % (model->nSample); tmpValue = sampleOffset + ((rand << 1) +rand ); model->bg_samples[tmpValue] = image[imageOffset]; model->bg_samples[tmpValue + 1] = image[imageOffset + 1]; model->bg_samples[tmpValue + 2] = image[imageOffset + 2]; - // Í¬Ê±Ëæ»ú¶Ôµ±Ç°µãµÄijһ¸öÏàÁÚµã¶ÔÓ¦µÄÄ£°åÖеÄËæ»úÒ»±³¾°½øÐиüР+ // ͬʱ����Ե�ǰ���ijһ�����ڵ��Ӧ��ģ���е����һ�������и��� GetRandNeighborXY(x, y, &xNG, &yNG); rand = GetRand() % (model->nSample); tmpValue = ((yNG * model->width * model->nSample + xNG * model->nSample + rand) << 1)+ (yNG * model->width * model->nSample + xNG * model->nSample + rand); @@ -545,12 +545,12 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u } } - // Èç¹ûµ±Ç°µãΪ±³¾° + // �����ǰ��Ϊ���� else { output[y * model->width + x] = VBPARAM->DEFAULT_COLOR_BACKGROUND; - // ¶Ôǰ20Ö¡½øÐÐVIBEÄ£°å¸üУ¨Í¬Ç°¾°£© + // ��ǰ20֡����VIBEģ����£�ͬǰ���� if (g_frameCount < model->nSample) { //curr @@ -582,7 +582,7 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u } //update neighboring pixel model - // Âú×ãÌõ¼þ²Å½øÐб³¾°¸üУ¨ÎªÁËÌáËÙ£© + // ���������Ž��б������£�Ϊ�����٣� rand = GetRand() % (model->upSpeed); if (rand == 0 && left_flag == 1) { @@ -606,11 +606,11 @@ void RegionSurveillance::VibeModelUpdateC3(VibeModel_t *model, uint8_t *image, u }// end of for y loop - //VibeModelDilation(output, model->width, model->height); // ÅòÕÍ - //VibeModelErosion(output, model->width, model->height);// ¸¯Ê´ + //VibeModelDilation(output, model->width, model->height); // ���� + //VibeModelErosion(output, model->width, model->height);// ��ʴ - VibeModelDilation2(output, maskImg, model->width, model->height); // ¼ÓËÙ ÅòÕÍ - VibeModelErosion2(maskImg, output, model->width, model->height); // ¼ÓËÙ ÅòÕÍ + VibeModelDilation2(output, maskImg, model->width, model->height); // ���� ���� + VibeModelErosion2(maskImg, output, model->width, model->height); // ���� ���� //VibeModelErosion(output,model->width,model->height); @@ -629,11 +629,11 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi } */ - // »ñµÃµ±Ç°Ö¡µÄǰ¾°ºÍ±³¾°£¨Ç°¾°255 ±³¾°0£©Í¬Ê±¶ÔVIBEÄ£°å½øÐиüР+ // ��õ�ǰ֡��ǰ���ͱ�����ǰ��255 ����0��ͬʱ��VIBEģ����и��� //VibeModelUpdateC3(vbM, frameImgData, greyImgData, MaskImgData); if (vbM->nChannel == 3) { - // ¸ß˹ģºý + // ��˹ģ�� if (gfiltFlag == 1) { unsigned char* inputData = NULL; @@ -671,10 +671,10 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi { if (channel_num == 3) { - // ½«RGBͼÏñת»»Îª»Ò¶ÈͼÏñ + // ��RGBͼ��ת��Ϊ�Ҷ�ͼ�� VibeRGBToGray(frameImgData, greyImgData); - // ¸ß˹ģºý + // ��˹ģ�� if (gfiltFlag == 1) { unsigned char* inputData = NULL; @@ -705,7 +705,7 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi } else { - // ¸ß˹ģºý + // ��˹ģ�� if (gfiltFlag == 1) { unsigned char* inputData = NULL; @@ -739,7 +739,7 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi /* - // ÏÔʾ¶þֵͼÏñ + // ��ʾ��ֵͼ�� CvSize a; a.width = GlobelWidth; a.height = GlobelHeight; @@ -756,12 +756,12 @@ void RegionSurveillance::RSDetect(unsigned char* frameImgData, RegionInfo* pRegi /****************************************************************************** * Function: VibeModelDilation -* Description: VIBEÄ£ÐÍÅòÕÍ£¨Èç¹ûµ±Ç°µãΪǰ¾°»òÕßµ±Ç°µãµÄÁÚÓòÖÐÓÐÒ»¸öΪǰ¾°£¬Ôòµ±Ç°µãλǰ¾°£© +* Description: VIBEģ�����ͣ������ǰ��Ϊǰ�����ߵ�ǰ�����������һ��Ϊǰ������ǰ��λǰ���� * Called By: VibeModelUpdateC3 -* Input: inputdata µ±Ç°Í¼Ïñǰ¾°±³¾°£¨Ç°¾°Îª255 ±³¾°Îª0£© - width ͼÏñ¿í¶È - height ͼÏñ¸ß¶È -* Output: inputdata ÅòÕͺóµ±Ç°Í¼Ïñǰ¾°±³¾° +* Input: inputdata ��ǰͼ��ǰ��������ǰ��Ϊ255 ����Ϊ0�� + width ͼ����� + height ͼ��߶� +* Output: inputdata ���ͺ�ǰͼ��ǰ������ *******************************************************************************/ void RegionSurveillance::VibeModelDilation(unsigned char* inputdata, int width, int height) { @@ -805,12 +805,12 @@ void RegionSurveillance::VibeModelDilation(unsigned char* inputdata, int width, /****************************************************************************** * Function: VibeModelErosion -* Description: VIBEÄ£Ð͸¯Ê´£¨Èç¹ûµ±Ç°µã»òµ±Ç°µãµÄijһ¸öÁÚÓòÖÐÓÐÒ»¸öµãΪ±³¾°£¬Ôòµ±Ç°Îª±³¾°£© +* Description: VIBEģ�͸�ʴ�������ǰ���ǰ���ijһ����������һ����Ϊ��������ǰΪ������ * Called By: VibeModelUpdateC3 -* Input: inputdata µ±Ç°Í¼Ïñǰ¾°±³¾°£¨Ç°¾°Îª255 ±³¾°Îª0£© - width ͼÏñ¿í¶È - height ͼÏñ¸ß¶È -* Output: inputdata ¸¯Ê´ºóµ±Ç°Í¼Ïñǰ¾°±³¾° +* Input: inputdata ��ǰͼ��ǰ��������ǰ��Ϊ255 ����Ϊ0�� + width ͼ����� + height ͼ��߶� +* Output: inputdata ��ʴ��ǰͼ��ǰ������ *******************************************************************************/ void RegionSurveillance::VibeModelErosion(unsigned char* inputdata, int width, int height) { @@ -871,7 +871,7 @@ typedef struct _int_128 const _int_128 & int_128_max(const _int_128 & n1, const _int_128 & n2) { - if (platform_little_endian) //С¶Ë + if (platform_little_endian) //�� { if (n1._n2 > n2._n2) { @@ -899,7 +899,7 @@ const _int_128 & int_128_max(const _int_128 & n1, const _int_128 & n2) } else { - if (n1._n1 > n2._n1) //´ó¶Ë + if (n1._n1 > n2._n1) //��� { return n1; } @@ -1100,7 +1100,7 @@ void RegionSurveillance::VibeModelErosion2(unsigned char* inputdata, unsigned ch //} -//°´ÕÕÖÐÐĵãµÄλÖýøÐÐÅÅÐò by zl +//�������ĵ��λ�ý������� by zl void RegionSurveillance::SortForeground(vector &ForegroundArray) { std::sort(ForegroundArray.begin(),ForegroundArray.end(), SortByPoint); @@ -1111,30 +1111,30 @@ int RegionSurveillance::dwGlobalID; /****************************************************************************** * Function: VibeModelGetTrace * Description: -* Calls£º ExtractContours +* Calls�� ExtractContours * Called By: RSDetect -* Input: pSourceImg µ±Ç°Í¼Ïñǰ¾°±³¾°£¨Ç°¾°Îª255 ±³¾°Îª0£© - pRGBIn µ±Ç°Í¼ÏñRGB - width ͼÏñ¿í¶È - height ͼÏñ¸ß¶È - widthStep ͼÏñRGB step -* Output: pRGBIn ½«Ç°¾°Ãè»æ¹ýµÄRGB +* Input: pSourceImg ��ǰͼ��ǰ��������ǰ��Ϊ255 ����Ϊ0�� + pRGBIn ��ǰͼ��RGB + width ͼ����� + height ͼ��߶� + widthStep ͼ��RGB step +* Output: pRGBIn ��ǰ��������RGB m_TargetArray - m_ptArray Ó뵱ǰĿ±êÆ¥Åä³É¹¦µÄËùÓÐǰ¾°µÄÖÐÐĵã - m_VectorDirection µ±Ç°Ä¿±êÓë֮ǰĿ±êµÄÏòÁ¿ + m_ptArray �뵱ǰĿ��ƥ��ɹ�������ǰ�������ĵ� + m_VectorDirection ��ǰĿ����֮ǰĿ������� //m_VectorDirectionNormal dx/sqrt(dx^2+dy^2) dy/sqrt(dx^2+dy^2) - m_CurRefPoint Ä¿±êµÄÖÐÐĵãλÖ㨲»¶Ï¸üУ¬È¡5¸öµÄƽ¾ùÖµ£© - m_LastRefPoint Ä¿±ê֮ǰµÄÖÐÐĵãλÖ㨲»¶Ï¸üУ¬È¡5¸öµÄƽ¾ùÖµ£© - m_PredictionBasePoint ×îºóÒ»¸öÆ¥ÅäµãÖÐÐÄλÖà - m_PredictionPoint ÏÂÒ»Ö¡µÄÔ¤²âλÖà - m_bHaveDirection µ±Ç°Ä¿±êÊÇ·ñÒѾ­¼ÆËã¹ý·½Ïò trueÊÇ flase·ñ - m_dwLostFrame ¾àµ±Ç°Ö¡Î´Æ¥Åäµ½µÄÊýÄ¿£¨ÓÃÀ´ÅжÏÊÇ·ñÄ¿±ê¶ªÊ§£© - m_dwID ID ÓÃÀ´¶Ô²»Í¬µÄǰ¾°»æÍ¼Ê±½øÐÐÑÕÉ«ÉϵÄÇø·Ö - m_dwBestMatch Æ¥Åäµ½µ±Ç°Ö¡µÄǰ¾°ÐòºÅ - m_bCalc ±ê־Ŀ±êÐòÁÐÔÚµ±Ç°Ö¡ÖÐÊÇ·ñÆ¥Åäµ½ trueÆ¥Åäµ½ falseδƥÅäµ½ - m_AlarmState ±¨¾¯×´Ì¬ false·ñ true±¨¾¯ - m_AlarmNum ±¨¾¯±àºÅ - //m_TarBox Ä¿±êµÄÍâ½Ó¾ØÐÎ + m_CurRefPoint Ŀ������ĵ�λ�ã����ϸ��£�ȡ5����ƽ��ֵ�� + m_LastRefPoint Ŀ��֮ǰ�����ĵ�λ�ã����ϸ��£�ȡ5����ƽ��ֵ�� + m_PredictionBasePoint ���һ��ƥ�������λ�� + m_PredictionPoint ��һ֡��Ԥ��λ�� + m_bHaveDirection ��ǰĿ���Ƿ��Ѿ���������� true�� flase�� + m_dwLostFrame �൱ǰ֡δƥ�䵽����Ŀ�������ж��Ƿ�Ŀ�궪ʧ�� + m_dwID ID �����Բ�ͬ��ǰ����ͼʱ������ɫ�ϵ����� + m_dwBestMatch ƥ�䵽��ǰ֡��ǰ����� + m_bCalc ��־Ŀ�������ڵ�ǰ֡���Ƿ�ƥ�䵽 trueƥ�䵽 falseδƥ�䵽 + m_AlarmState ����״̬ false�� true���� + m_AlarmNum ������� + //m_TarBox Ŀ�����Ӿ��� *******************************************************************************/ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *MaskImgCfd, unsigned char* pRGBIn, RegionInfo* pRegionInfo) { @@ -1150,13 +1150,13 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas int m_dwMaxLost = 100; int m_dwMinFrame = 6; int dwTargetSize = 0; - CForeground testTarget; // testForgroundArray ÖеÄtestTarget + CForeground testTarget; // testForgroundArray �е�testTarget - //ǰ¾°Í¼¼¯ºÏ-zhm + //ǰ��ͼ����-zhm vector foreContours; CConExtraction *pConExtraction = new CConExtraction(); - // Âú×ãÌõ¼þµÄ£¨ÏñËØµã Ãæ»ýµÈÌõ¼þ100£©Ç°¾°Íâ½Ó¾ØÐÎ + // ���������ģ����ص� ���������100��ǰ����Ӿ��� if (channel_num == 3) { foreContours = pConExtraction->ExtractContours(pSourceImg, MaskImgCfd,GlobelWidth, GlobelHeight, GlobelWidthstep / 3); @@ -1166,8 +1166,8 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas foreContours = pConExtraction->ExtractContours(pSourceImg, MaskImgCfd, GlobelWidth, GlobelHeight, GlobelWidthstep); } - //¹ì¼£Æ¥Åä-zhm - // ½øÒ»²½ÔÚforeContoursµÄ»ù´¡É϶Ôǰ¾°Íâ½Ó¾ØÐεÄÃæ»ý½øÐÐɸѡ ½«Âú×ãÃæ»ý´óÓÚ300µÄÍâ½Ó¾ØÐÎÌíÈëForegroundArrayÖÐ + //�켣ƥ��-zhm + // ��һ����foreContours�Ļ����϶�ǰ����Ӿ��ε��������ɸѡ �������������300����Ӿ�������ForegroundArray�� int forNum = foreContours.size(); for (int i = 0; i < forNum; i++) { @@ -1180,7 +1180,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas testTarget.m_ptCenter.y = (testTarget.m_rtConnect.top + testTarget.m_rtConnect.bottom) / 2; testTarget.m_cfd = foreContours[i].cfd; - //´óÓÚ×îС¹ýÂËÃæ»ýÇÒСÓÚ×î´ó¹ýÂËÃæ»ý by zl 20160304 + //�������������������������� by zl 20160304 int targetArea = abs((testTarget.m_rtConnect.left - testTarget.m_rtConnect.right) * (testTarget.m_rtConnect.top - testTarget.m_rtConnect.bottom)); if ( targetArea > OBJECT_AREA_MIN && targetArea < OBJECT_AREA_MAX) { @@ -1189,7 +1189,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } - if(ForegroundArray.size() > 0) //ǰ¾°¿â²»¿ÕÔòÅÅÐò´¦Àí by zl 20160307 + if(ForegroundArray.size() > 0) //ǰ���ⲻ���������� by zl 20160307 { SortForeground(ForegroundArray); MergeNeighborBox(ForegroundArray); @@ -1208,14 +1208,14 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas delete pConExtraction; // memory leak for 1 block m_DelArray.clear(); - //ÅжÏÊÇ·ñÖ¡ÄÚÄ¿±ê¶ªÊ§£¬Èô¶ªÊ§dwTargetSize×Ô¼õ + //�ж��Ƿ�֡��Ŀ�궪ʧ������ʧdwTargetSize�Լ� vector::size_type countn = 0; int dwStep = GlobelWidthstep; ///////////////////////////////////////////////////////////////////////////////////////// dwTargetSize = m_TargetArray.size(); for (int i = 0; i < dwTargetSize; i++, countn++) { - // ÈôÒѾ­³¬¹ý100֡δ³öÏÖ¸Ãǰ¾° Ôò½«¸Ãǰ¾°´Óm_TargetArrayÖÐɾ³ý + // ���Ѿ�����100֡δ���ָ�ǰ�� �ò½«¸ï¿½Ç°ï¿½ï¿½ï¿½ï¿½m_TargetArray��ɾ�� if (m_TargetArray[i].m_dwLostFrame++ > m_dwMaxLost) { m_DelArray.push_back(*(m_TargetArray.begin() + countn)); @@ -1247,7 +1247,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas dwTargetSize = m_TargetArray.size(); double * pDistanceMatrix = new double[dwForegroundCount * dwTargetSize]; - // ½«Ã¿Ò»¸öÄ¿±êºÍ¸ÃÖ¡ÖеÄǰ¾°½øÐÐÆ¥Åä + // ��ÿһ��Ŀ��͸�֡�е�ǰ������ƥ�� for (int i = 0; i < dwTargetSize; i++) { //CMPointDouble directionPre; @@ -1279,7 +1279,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas m_FinalArray.clear(); //m_TargetArray.clear(); // Tracking and draw - // ¶Ôµ±Ç°Ö¡µÄÿһ¸öǰ¾°ÓëÄ¿±ê½øÐÐÆ¥Åä + // �Ե�ǰ֡��ÿһ��ǰ����Ŀ�����ƥ�� bool left_flag_c = 1; for (int i = 0; i < dwForegroundCount; i++) { @@ -1307,7 +1307,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } } //m_TargetArray.clear(); - // Èç¹ûÆ¥Åä³É¹¦ m_TargetArray[dwBestMatch].m_ptArray.size() !=500£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿£¿²»Àí½âΪʲô²»ÄܵÈÓÚ500 + // ���ƥ��ɹ� m_TargetArray[dwBestMatch].m_ptArray.size() !=500��������������������������������������������������Ϊʲô���ܵ���500 if (dwBestMatch >= 0 && m_TargetArray[dwBestMatch].m_dwBestMatch == i && m_TargetArray[dwBestMatch].m_ptArray.size() < 500) { // Find it @@ -1335,10 +1335,10 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } // Update last reference point - // Èç¹ûÓëÄ¿±êÆ¥Åä³É¹¦µÄǰ¾°´ïµ½Ò»¶¨ÊýÁ¿ + // �����Ŀ��ƥ��ɹ���ǰ���ﵽһ������ if (dwPointCount > m_dwFrameDist) { - // Ä¿±ê֮ǰµÄÖÐÐĵãλÖã¨5֡֡ƽ¾ù£© + // Ŀ��֮ǰ�����ĵ�λ�ã�5֡֡ƽ���� m_TargetArray[dwBestMatch].m_LastRefPoint.x += (double) m_TargetArray[dwBestMatch].m_ptArray[dwPointCount - m_dwFrameDist - 1].x / m_dwFrameWnd; m_TargetArray[dwBestMatch].m_LastRefPoint.y += @@ -1371,13 +1371,13 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } else { - // ¼ì²âµ½ÐµÄÄ¿±ê + // ��⵽�µ�Ŀ�� // New object found CTarget NewTarget; //NewTarget.GetID(); NewTarget.m_dwID= ++dwGlobalID; // GlobalID assigned for target - // еÄǰ¾°µÄÖÐÐÄλÖà + // �µ�ǰ��������λ�� NewTarget.m_ptArray.push_back(ForegroundArray[i].m_ptCenter); m_TargetArray.push_back(NewTarget); @@ -1392,7 +1392,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas dwBestMatch = m_TargetArray.size() - 1; // Update current reference point - //m_TargetArray-m_CurRefPointµ±Ç°Ç°¾°µÄÖÐÐĵãλÖã¨È¡ÎåÖ¡µÄƽ¾ùÊý£© + //m_TargetArray-m_CurRefPoint��ǰǰ�������ĵ�λ�ã�ȡ��֡��ƽ������ m_TargetArray[dwBestMatch].m_CurRefPoint.x += (double)ForegroundArray[i].m_ptCenter.x / m_dwFrameWnd; m_TargetArray[dwBestMatch].m_CurRefPoint.y += (double)ForegroundArray[i].m_ptCenter.y / m_dwFrameWnd; @@ -1414,7 +1414,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } } - //±£´æ×îÖÕÊä³öÄ¿±ê + //�����������Ŀ�� m_FinalArray.push_back(m_TargetArray[dwBestMatch]); /* // Draw it @@ -1427,8 +1427,8 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas unsigned char bBlue = (unsigned char) ((m_TargetArray[dwBestMatch].m_dwID % 13) * 20 + 15); // Draw rectangle - //ºáÏß - // Ä¿±êÍâ½Ó¾ØÐÎ ºìÉ« + //���� + // Ŀ����Ӿ��� ��ɫ for (int t = ForegroundArray[i].m_rtConnect.left; t <= ForegroundArray[i].m_rtConnect.right; t++) { pRGBIn[ForegroundArray[i].m_rtConnect.top * dwStep + t * 3] = 0; @@ -1455,11 +1455,11 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas int d = ForegroundArray[i].m_rtConnect.right; - // ROI ¼à¿Ø + // ROI ��� for (int ii = 0; ii < m_numROI; ii++) { - // Ä¿±êÍâ½Ó¾ØÐνøÐÐÇøÓòÇÒÄ¿±êÖÐÐĵãÔÚÇøÓòÄÚ£¬Ôò±¨¾¯ - if (pAlarmInfo[ii] == 1) //½ûÖ¹ÇøÓò + // Ŀ����Ӿ��ν���������Ŀ�����ĵ��������ڣ��ò±¨¾ï¿½ + if (pAlarmInfo[ii] == 1) //��ֹ���� { if (pRegion[ii][GlobelWidth * a + c] || pRegion[ii][GlobelWidth * b + c] || @@ -1475,8 +1475,8 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } } } - // ֻҪĿ±êÍâ½Ó¾ØÐÎÓÐÒ»¸öµã½øÈëÇøÓòÔò±¨¾¯ - if (pAlarmInfo[ii] == 2) //°èÏß + // ֻҪĿ����Ӿ�����һ������������ò±¨¾ï¿½ + if (pAlarmInfo[ii] == 2) //���� { int xmin = min(c, d), xmax = max(c, d), ymin = min(a, b), ymax = max(a, b); for (int iy = ymin; iy <= ymax; iy++) @@ -1493,8 +1493,8 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } } - // ֻҪĿ±êÍâ½Ó¾ØÐνøÈëÇøÓòÖУ¬ÇÒÃæ»ý´óÓÚROIÇøÓòÃæ»ýµÄÒ»°ëͬʱÍâ½Ó¾ØÐÎÖÐÐĵãÔÚÇøÓòÄÚ£¬Ôò±¨¾¯ - if (pAlarmInfo[ii] == 3) //ÒÅÁô¼ì²â + // ֻҪĿ����Ӿ��ν��������У����������ROI���������һ��ͬʱ��Ӿ������ĵ��������ڣ��ò±¨¾ï¿½ + if (pAlarmInfo[ii] == 3) //������� { int TotalArea = 0; if (TotalArea == 0) @@ -1522,19 +1522,19 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } } - //±£´æ×îÖÕÊä³öÄ¿±ê + //�����������Ŀ�� m_FinalArray.push_back(m_TargetArray[dwBestMatch]); CMPoint ptLast = m_TargetArray[dwBestMatch].m_ptArray[0]; - // ¶ÔÄ¿±êµÄÿһ¸öÆ¥ÅäÏî½øÐбéÀú + // ��Ŀ���ÿһ��ƥ������б��� for (int l = 1; l < dwPointNum; l++) { ForegroundArray[i].m_ptCenter = m_TargetArray[dwBestMatch].m_ptArray[l]; if (ForegroundArray[i].m_ptCenter == ptLast) { // Draw a point - //Ãè»æÄ¿±êÖÐÐĵã + //���Ŀ�����ĵ� pRGBIn[ForegroundArray[i].m_ptCenter.y * dwStep + ForegroundArray[i].m_ptCenter.x * 3] = bBlue; pRGBIn[ForegroundArray[i].m_ptCenter.y * dwStep + ForegroundArray[i].m_ptCenter.x * 3 + 1] = bGreen; pRGBIn[ForegroundArray[i].m_ptCenter.y * dwStep + ForegroundArray[i].m_ptCenter.x * 3 + 2] = bRed; @@ -1636,10 +1636,10 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas /////////////////////////////////////////////////////////////////////////////////////// // Prediction int dwObjectCount = m_TargetArray.size(); - // ±éÀúËùÓеÄÄ¿±ê + // �������е�Ŀ�� for (int i=0; i < dwObjectCount; i++) { - // Èç¹û¸ÃÄ¿±êÔÚµ±Ç°Ö¡ÖÐûÓÐÆ¥Åä³É¹¦µ«Êǵ±Ç°Ä¿±êÒѾ­¼ÆËã¹ý·½Ïò + // �����Ŀ���ڵ�ǰ֡��û��ƥ��ɹ����ǵ�ǰĿ���Ѿ���������� if (!m_TargetArray[i].m_bCalc && m_TargetArray[i].m_bHaveDirection) { // Record prediction as current point @@ -1700,15 +1700,15 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas /****************************************************************************** * Function: RSRegion -* Description: ¸ÐÐËÈ¤ÇøÓòÉèÖà +* Description: ����Ȥ�������� * Calls: vibeMask * Called By: main -* Input: numROI ROI¸öÊý - pRegionInfo ROIÇøÓò - iflog true:Êä³öÈÕÖ¾ false£º²»Êä³öÈÕÖ¾ -* Output: pRegion 10¸öROIÖ¸Õ루bool£©Ã¿¸ö´óСΪ£¨Í¼Ïñ¿í*ͼÏñ¸ß£©¸ÐÐËÈ¤ÇøÓòֵΪ1 ÆäÓàΪ0 - //regionAlarm 10¸öROI ±¨¾¯±êÖ¾£¨bool£© - pAlarmInfo 10¸öROI ±¨¾¯±êÖ¾£¨int£© +* Input: numROI ROI���� + pRegionInfo ROI���� + iflog true:�����־ false���������־ +* Output: pRegion 10��ROIָ�루bool��ÿ����СΪ��ͼ���*ͼ��ߣ�����Ȥ����ֵΪ1 ����Ϊ0 + //regionAlarm 10��ROI ������־��bool�� + pAlarmInfo 10��ROI ������־��int�� * Return: 3 1 *******************************************************************************/ void printAlarmType(fstream *file, int style) @@ -1716,22 +1716,22 @@ void printAlarmType(fstream *file, int style) switch (style) { case 1: - *file<<"½øÈë½ûÇø, "; + *file<<"�������, "; break; case 2: - *file<<"À뿪½ûÇø, "; + *file<<"�뿪����, "; break; case 3: - *file<<"µ¥ÏòÔ½½ç, "; + *file<<"����Խ��, "; break; case 4: - *file<<"Ë«ÏòÔ½½ç, "; + *file<<"˫��Խ��, "; break; case 5: - *file<<"ÅÇ»², "; + *file<<"�ǻ�, "; break; case 6: - *file<<"¶ª°ü, "; + *file<<"����, "; break; default : break; @@ -1741,12 +1741,12 @@ void printAlarmType(fstream *file, int style) int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) { - //fstream file;//ÓÃÓÚÊä³öÈÕÖ¾ + //fstream file;//���������־ if (numROI > MAXROINUM) { return 0; } - //×Ô¶¯ÉèÖÃÓÃÓÚÈ·¶¨·½ÏòµÄµã + //�Զ���������ȷ������ĵ� //for(int i = 0; i < numROI; i++) //{ // if (iflog) @@ -1760,13 +1760,13 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // // if (pRegionInfo[i].AlarmInfo == 3) // { - // pRegionInfo[i].finaldir = get_ArrowDir(pRegionInfo[i].pROI[0], pRegionInfo[i].pROI[1], pRegionInfo[i].dirPoint);//È·¶¨·½Ïò¼ÆË㣬¼ýÍ·¶Ëµã×ø±ê + // pRegionInfo[i].finaldir = get_ArrowDir(pRegionInfo[i].pROI[0], pRegionInfo[i].pROI[1], pRegionInfo[i].dirPoint);//ȷ��������㣬��ͷ�˵����� // // if (iflog) // file<<", DirPoint("< -1 && y < GlobelHeight && x > -1 && x < GlobelWidth) // { // pRegion[GlobelWidth * y + x] = 1; @@ -1932,7 +1932,7 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // int y = (int) (((LineMin.y - LineMax.y) / (double)(LineMin.x - LineMax.x)) * (double)(x - LineMin.x) + 0.5 + (double)LineMin.y); // //pRegion[GlobelWidth * y + x] = 1; // -// //Ô­³ÌÐò´æÔÚÔ½½ç ËÕÏþÜ¿ÐÞ¸ÄÈçÏ +// //ԭ�������Խ�� ����ܿ�޸����� // if (y > -1 && y < GlobelHeight && x > -1 && x < GlobelWidth) // { // pRegion[GlobelWidth * y + x] = 1; @@ -1947,7 +1947,7 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // { // //pRegion[GlobelWidth * i + pPointList[startp].x] = 1; // -// //Ô­³ÌÐò´æÔÚÔ½½ç ËÕÏþÜ¿ÐÞ¸ÄÈçÏ +// //ԭ�������Խ�� ����ܿ�޸����� // if (i > -1 && i < GlobelHeight && pPointList[startp].x > -1 && pPointList[startp].x < GlobelWidth) // { // pRegion[GlobelWidth * i + pPointList[startp].x] = 1; @@ -1966,7 +1966,7 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // int x = (int) (((LineMin.x - LineMax.x) / (double) (LineMin.y - LineMax.y)) * (double) (y - LineMin.y) + 0.5 + (double)LineMin.x); // //pRegion[GlobelWidth * y + x] = 1; // -// //Ô­³ÌÐò´æÔÚÔ½½ç ËÕÏþÜ¿ÐÞ¸ÄÈçÏ +// //ԭ�������Խ�� ����ܿ�޸����� // if (y > -1 && y < GlobelHeight && x > -1 && x < GlobelWidth) // { // pRegion[GlobelWidth * y + x] = 1; @@ -1982,7 +1982,7 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // int x = (int) (((LineMin.x - LineMax.x) / (double) (LineMin.y - LineMax.y)) * (double) (y - LineMin.y) + 0.5 + (double)LineMin.x); // //pRegion[GlobelWidth * y + x] = 1; // -// //Ô­³ÌÐò´æÔÚÔ½½ç ËÕÏþÜ¿ÐÞ¸ÄÈçÏ +// //ԭ�������Խ�� ����ܿ�޸����� // if (y > -1 && y < GlobelHeight && x > -1 && x < GlobelWidth) // { // pRegion[GlobelWidth * y + x] = 1; @@ -1997,7 +1997,7 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // { // //pRegion[GlobelWidth * pPointList[startp].y + i] = 1; // -// //Ô­³ÌÐò´æÔÚÔ½½ç ËÕÏþÜ¿ÐÞ¸ÄÈçÏ +// //ԭ�������Խ�� ����ܿ�޸����� // if (pPointList[startp].y > -1 && pPointList[startp].y < GlobelHeight && i > -1 && i < GlobelWidth) // { // pRegion[GlobelWidth * pPointList[startp].y + i] = 1; @@ -2007,7 +2007,7 @@ int RegionSurveillance::RSRegion(int numROI, int alarm_info/*, bool iflog*/) // } // } // -// // Ð޸ıê¼Ç·½Ê½ ½«ÇøÓò±ßÔµ±êÖ¾ÖÃΪ0 +// // �޸ı�Ƿ�ʽ �������Ե��־��Ϊ0 // for (int i = 0; i < GlobelHeight; i++) // { // for (int j = 0; j < GlobelWidth; j++) @@ -2153,8 +2153,8 @@ void RegionSurveillance::getObjectInfo(int ObjCount, MS_ObjectInfo* ObjInfo) } */ // unique ID for current object - ObjInfo[i].TarBox = m_FinalArray[i].m_TarBox; //Ä¿±êÍâ½Ó¾ØÐÎ - ObjInfo[i].UniqueID = m_FinalArray[i].m_dwID; //µ±Ç°Ä¿±êµÄÌØµãID + ObjInfo[i].TarBox = m_FinalArray[i].m_TarBox; //Ŀ����Ӿ��� + ObjInfo[i].UniqueID = m_FinalArray[i].m_dwID; //��ǰĿ����ص�ID //printf("UniqueID = %d, cfd = %f\n", ObjInfo[i].UniqueID, ObjInfo[i].confidence); } } @@ -2214,14 +2214,14 @@ void RegionSurveillance::getDeleteInfo(int DelCount, MS_ObjectInfo* ObjInfo) } */ // unique ID for current object - ObjInfo[i].TarBox = m_DelArray[i].m_TarBox; //Ä¿±êÍâ½Ó¾ØÐÎ - ObjInfo[i].UniqueID = m_DelArray[i].m_dwID; //µ±Ç°Ä¿±êµÄÌØµãID + ObjInfo[i].TarBox = m_DelArray[i].m_TarBox; //Ŀ����Ӿ��� + ObjInfo[i].UniqueID = m_DelArray[i].m_dwID; //��ǰĿ����ص�ID ObjInfo[i].confidence = m_DelArray[i].cfd; } } -// ½«Í¼Ïñת»»Îª»Ò¶ÈͼÏñ +// ��ͼ��ת��Ϊ�Ҷ�ͼ�� void RegionSurveillance::VibeRGBToGray(unsigned char* RgbData, unsigned char* GrayData) { int nHeight, nWidth; @@ -2240,11 +2240,11 @@ void RegionSurveillance::VibeRGBToGray(unsigned char* RgbData, unsigned char* Gr -//pAlarmInfo 1½øÈë½ûÇø 2À뿪½ûÇø 3µ¥ÏòÔ½½ç 4Ë«ÏòÔ½½ç 5ÅÇ»² 6¶ª°ü +//pAlarmInfo 1������� 2�뿪���� 3����Խ�� 4˫��Խ�� 5�ǻ� 6���� void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground ForegroundArray_i, int dwBestMatch, RegionInfo* pRegionInfo) { - // Ä¿±êËø¶¨ + // Ŀ������ //ExternalRectangle(pRGBIn, ForegroundArray_i, dwBestMatch, widthStep, 255, 0, 0); /* int dwStep = widthStep; @@ -2254,7 +2254,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore unsigned char bBlue = (unsigned char) ((m_TargetArray[dwBestMatch].m_dwID % 13) * 20 + 15); - // ǰ¾°Ä¿±êÍâ½Ó¾ØÐÎÃè»æ + // ǰ��Ŀ����Ӿ������ for (int t = ForegroundArray_i.m_rtConnect.left; t <= ForegroundArray_i.m_rtConnect.right; t++) { pRGBIn[ForegroundArray_i.m_rtConnect.top * dwStep + t * 3] = 0; @@ -2281,11 +2281,11 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore int c = ForegroundArray_i.m_rtConnect.left; int d = ForegroundArray_i.m_rtConnect.right; - // ÇøÓò¼à¿Ø + // ������ for (int ii = 0; ii < m_numROI; ii++) { - if (pAlarmInfo[ii] == 1) //½øÈë½ûÇø + if (pAlarmInfo[ii] == 1) //������� { //AccessToRestrictedAreas(pRegion[ii], dwBestMatch,a, b, c, d, ii); /* @@ -2295,7 +2295,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore } */ } - else if (pAlarmInfo[ii] == 2) //À뿪½ûÇø + else if (pAlarmInfo[ii] == 2) //�뿪���� { //LeaveTheRestrictedAreas(pRegion[ii], dwBestMatch,a, b, c, d, ii); /* @@ -2306,7 +2306,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore */ } - else if (pAlarmInfo[ii] == 3) //µ¥ÏòÔ½½ç + else if (pAlarmInfo[ii] == 3) //����Խ�� { //OneWayCrossBorder(pRegion[ii], dwBestMatch, a, b, c, d, ii, pRegionInfo); /* @@ -2317,7 +2317,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore */ } - else if (pAlarmInfo[ii] == 4) //Ë«ÏòÔ½½ç + else if (pAlarmInfo[ii] == 4) //˫��Խ�� { //TwoWayCrossBorder(pRegion[ii], dwBestMatch, a, b, c, d, ii); /* @@ -2328,7 +2328,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore */ } - else if (pAlarmInfo[ii] == 5) //ÅÇ»² + else if (pAlarmInfo[ii] == 5) //�ǻ� { //WanderMonitoring(pRegion[ii], dwBestMatch, a, b, c, d, ii, pRegionInfo, pRGBIn); /* @@ -2338,7 +2338,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore } */ } - else if (pAlarmInfo[ii] == 6) //¶ª°ü + else if (pAlarmInfo[ii] == 6) //���� { StayMonitoring( dwBestMatch, a, b, c, d, ii, pRegionInfo, pRGBIn); /* @@ -2357,7 +2357,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore - // ¹ì¼£Ãè»æ + // �켣��� //Trajectory(pRGBIn, ForegroundArray_i, dwBestMatch, width, height, widthStep); /* int dwStep = widthStep; @@ -2368,14 +2368,14 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore int dwPointNum = m_TargetArray[dwBestMatch].m_ptArray.size(); CMPoint ptLast = m_TargetArray[dwBestMatch].m_ptArray[0]; - // ¶ÔÄ¿±êµÄÿһ¸öÆ¥ÅäÏî½øÐбéÀú + // ��Ŀ���ÿһ��ƥ������б��� for (int l = 1; l < dwPointNum; l++) { ForegroundArray_i.m_ptCenter = m_TargetArray[dwBestMatch].m_ptArray[l]; if (ForegroundArray_i.m_ptCenter == ptLast) { // Draw a point - //Ãè»æÄ¿±êÖÐÐĵã + //���Ŀ�����ĵ� pRGBIn[ForegroundArray_i.m_ptCenter.y * dwStep + ForegroundArray_i.m_ptCenter.x * 3] = bBlue; pRGBIn[ForegroundArray_i.m_ptCenter.y * dwStep + ForegroundArray_i.m_ptCenter.x * 3 + 1] = bGreen; pRGBIn[ForegroundArray_i.m_ptCenter.y * dwStep + ForegroundArray_i.m_ptCenter.x * 3 + 2] = bRed; @@ -2458,13 +2458,13 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore } /* -//Íâ½Ó¾ØÐÎÃè»æ +//��Ӿ������ void RegionSurveillance::ExternalRectangle(unsigned char* pRGBIn, CForeground ForegroundArray_i, int dwBestMatch, int widthStep, int rgb_b, int rgb_g, int rgb_r) { int dwStep = widthStep; - // ǰ¾°Ä¿±êÍâ½Ó¾ØÐÎÃè»æ + // ǰ��Ŀ����Ӿ������ for (int t = ForegroundArray_i.m_rtConnect.left; t <= ForegroundArray_i.m_rtConnect.right; t++) { pRGBIn[ForegroundArray_i.m_rtConnect.top * dwStep + t * 3] = rgb_b; @@ -2487,7 +2487,7 @@ void RegionSurveillance::ExternalRectangle(unsigned char* pRGBIn, CForeground Fo void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground ForegroundArray_i, int dwBestMatch, int width, int height, int widthStep) { - // ¹ì¼£Ãè»æ + // �켣��� int dwStep = widthStep; unsigned char bRed = (unsigned char) ((m_TargetArray[dwBestMatch].m_dwID % 3) * 85 + 85); unsigned char bGreen = (unsigned char) ((m_TargetArray[dwBestMatch].m_dwID % 7) * 36 + 36); @@ -2496,14 +2496,14 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun int dwPointNum = m_TargetArray[dwBestMatch].m_ptArray.size(); CMPoint ptLast = m_TargetArray[dwBestMatch].m_ptArray[0]; - // ¶ÔÄ¿±êµÄÿһ¸öÆ¥ÅäÏî½øÐбéÀú + // ��Ŀ���ÿһ��ƥ������б��� for (int l = 1; l < dwPointNum; l++) { ForegroundArray_i.m_ptCenter = m_TargetArray[dwBestMatch].m_ptArray[l]; if (ForegroundArray_i.m_ptCenter == ptLast) { // Draw a point - //Ãè»æÄ¿±êÖÐÐĵã + //���Ŀ�����ĵ� pRGBIn[ForegroundArray_i.m_ptCenter.y * dwStep + ForegroundArray_i.m_ptCenter.x * 3] = bBlue; pRGBIn[ForegroundArray_i.m_ptCenter.y * dwStep + ForegroundArray_i.m_ptCenter.x * 3 + 1] = bGreen; pRGBIn[ForegroundArray_i.m_ptCenter.y * dwStep + ForegroundArray_i.m_ptCenter.x * 3 + 2] = bRed; @@ -2589,26 +2589,26 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun /****************************************************************************** * Function: RAccessToRestrictedAreas -* Description: ½øÈë½ûÇø¼à²â -* Input: pRegion_i ¸ÐÐËÈ¤ÇøÓò±ê¼Ç - dwBestMatch Ä¿±êË÷Òý - ForBottom µ±Ç°Ç°¾°Íâ½Ó¾ØÐÎ×Ý×ø±ê×îСֵ - ForTop µ±Ç°Ç°¾°Íâ½Ó¾ØÐÎ×Ý×ø±ê×î´óÖµ - ForLeft µ±Ç°Ç°¾°Íâ½Ó¾ØÐκá×ø±ê×îСֵ - ForRight µ±Ç°Ç°¾°Íâ½Ó¾ØÐκá×ø±ê×î´óÖµ - indexROI ROI Ë÷Òý -* Output: m_TargetArray Ä¿±êÐÅÏ¢ +* Description: ���������� +* Input: pRegion_i ����Ȥ������ + dwBestMatch Ŀ������ + ForBottom ��ǰǰ����Ӿ�����������Сֵ + ForTop ��ǰǰ����Ӿ������������ֵ + ForLeft ��ǰǰ����Ӿ��κ�������Сֵ + ForRight ��ǰǰ����Ӿ��κ��������ֵ + indexROI ROI ���� +* Output: m_TargetArray Ŀ����Ϣ *******************************************************************************/ //void RegionSurveillance::AccessToRestrictedAreas(bool *pRegion_i, int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI) //{ // -// // Ä¿±êÍâ½Ó¾ØÐÎÓÐÒ»¸ö±ß½øÈë½ûÇøÇÒÍâ½Ó¾ØÐÎÖÐÐĵãλÓÚ½ûÇøÄÚ +// // Ŀ����Ӿ�����һ���߽����������Ӿ������ĵ�λ�ڽ����� // //if (pRegion_i[GlobelWidth * ForBottom + ForLeft] || // // pRegion_i[GlobelWidth * ForTop + ForLeft] || // // pRegion_i[GlobelWidth * ForTop + ForRight] || // // pRegion_i[GlobelWidth * ForBottom + ForRight]) // { -// //½«ÅжÏÊÇ·ñ½øÈë¸ÐÐËÈ¤ÇøÓò¸Ä³ÉÁ˾ØÐÎÖÐÐĵãµÄÉÏÏÂ×óÓÒºÍÖÐÐÄÎå¸öµã¶¼½øÈëÇøÓò£¬Åж¨Îª½øÈë +// //���ж��Ƿ�������Ȥ����ij��˾������ĵ���������Һ���������㶼���������ж�Ϊ���� // if (pRegion_i[GlobelWidth * (int) ((ForBottom + ForTop) / 2) + (ForLeft + ForRight) / 2] && \ // pRegion_i[GlobelWidth * (int)((ForBottom + ForTop) / 2) + (ForLeft + ForRight) / 2 + 1] && \ // pRegion_i[GlobelWidth * (int)((ForBottom + ForTop) / 2) + (ForLeft + ForRight) / 2 - 1] && \ @@ -2626,7 +2626,7 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun // //} -//À뿪½ûÇø +//�뿪���� //void RegionSurveillance::LeaveTheRestrictedAreas(bool *pRegion_i, int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI) //{ // if (pRegion_i[GlobelWidth * ForBottom + ForLeft] || @@ -2664,11 +2664,11 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun // m_TargetArray[dwBestMatch].pbAlarmType[indexROI] = 0; //} -//µ¥ÏòÔ½½ç -//dir: 1 Õý·½Ïò£¨Ïà¶ÔÓÚͨ³£×ø±êϵ£© 0¸º·½Ïò +//����Խ�� +//dir: 1 �����������ͨ������ϵ�� 0������ //void RegionSurveillance::OneWayCrossBorder(bool *pRegion_i, int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI, RegionInfo* pRegionInfo) //{ -// // ֻҪĿ±êÍâ½Ó¾ØÐÎÓÐÒ»¸öµã½øÈëÇøÓòÔò±¨¾¯ +// // ֻҪĿ����Ӿ�����һ������������ò±¨¾ï¿½ // int tar_size = m_TargetArray[dwBestMatch].m_ptArray.size(); // int xmin = min(ForLeft, ForRight), xmax = max(ForLeft, ForRight), ymin = min(ForBottom, ForTop), ymax = max(ForBottom, ForTop); // for (int iy = ymin; iy <= ymax; iy++) @@ -2681,7 +2681,7 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun // point_x = m_TargetArray[dwBestMatch].m_ptArray[tar_size - 4].x; // point_y = m_TargetArray[dwBestMatch].m_ptArray[tar_size - 4].y; // -// // ÅжϷ½Ïò +// // �жϷ��� // if (indexROI >= 0 && indexROI < m_numROI && pRegionInfo[indexROI].nPointNum >= 2) // { // if (abs(pRegionInfo[indexROI].pROI[0].x - pRegionInfo[indexROI].pROI[1].x) >= 1) @@ -2916,10 +2916,10 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun // m_TargetArray[dwBestMatch].pbAlarmType[indexROI] = 0; //} -////Ë«ÏòÔ½½ç +////˫��Խ�� //void RegionSurveillance::TwoWayCrossBorder(bool *pRegion_i, int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI) //{ -// // ֻҪĿ±êÍâ½Ó¾ØÐÎÓÐÒ»¸öµã½øÈëÇøÓòÔò±¨¾¯ +// // ֻҪĿ����Ӿ�����һ������������ò±¨¾ï¿½ // int xmin = min(ForLeft, ForRight), xmax = max(ForLeft, ForRight), ymin = min(ForBottom, ForTop), ymax = max(ForBottom, ForTop); // for (int iy = ymin; iy <= ymax; iy++) // { @@ -2937,10 +2937,10 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun // m_TargetArray[dwBestMatch].pbAlarmType[indexROI] = 0; //} -////Ë«ÏòÔ½½ç +////˫��Խ�� //void RegionSurveillance::TwoWayCrossBorder(bool *pRegion_i, int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI) //{ -// // ֻҪĿ±êÍâ½Ó¾ØÐÎÓÐÒ»¸öµã½øÈëÇøÓòÔò±¨¾¯ +// // ֻҪĿ����Ӿ�����һ������������ò±¨¾ï¿½ // int xmin = min(ForLeft, ForRight), xmax = max(ForLeft, ForRight), ymin = min(ForBottom, ForTop), ymax= max(ForBottom, ForTop); // for (int iy = ymin; iy <= ymax; iy++) // { @@ -2958,7 +2958,7 @@ void RegionSurveillance::Trajectory(unsigned char* pRGBIn, CForeground Foregroun // m_TargetArray[dwBestMatch].pbAlarmType[indexROI] = -1; //} -// ¼à²âÒÅÁô»òÒÆ³ý 0 ÒÅÁô 1ÒÆ³ý +// ����������Ƴ� 0 ���� 1�Ƴ� bool RegionSurveillance::detectLeftRemove(unsigned char* pRGBIn, int ForBottom, int ForTop, int ForLeft, int ForRight) { bool flag; @@ -3071,11 +3071,11 @@ bool RegionSurveillance::detectLeftRemove(unsigned char* pRGBIn, int ForBottom, } } - if (ratio >= 0.85 && ratio <= 1.0) //Ïà½ü±íÊ¾ÒÆ³ý + if (ratio >= 0.85 && ratio <= 1.0) //�����ʾ�Ƴ� { flag = 1; } - else // ·ñÔò±íʾÒÅÁô + else // �����ʾ���� { flag = 0; } @@ -3091,10 +3091,10 @@ bool CTargetFunc (CTarget &a, CTarget &b) else return false; } -// ÅÇ»²¼à²â +// �ǻ���� void RegionSurveillance::WanderMonitoring(bool *pRegion_i, int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI, RegionInfo* pRegionInfo, unsigned char* pRGBIn) { - // Ä¿±êÍâ½Ó¾ØÐÎÓÐÒ»¸ö±ß½øÈë½ûÇøÇÒÍâ½Ó¾ØÐÎÖÐÐĵãλÓÚ½ûÇøÄÚ + // Ŀ����Ӿ�����һ���߽����������Ӿ������ĵ�λ�ڽ����� bool flag = 0; if ((pRegion_i[GlobelWidth * ForBottom + ForLeft] || @@ -3121,7 +3121,7 @@ void RegionSurveillance::WanderMonitoring(bool *pRegion_i, int dwBestMatch, int m_TargetArray[dwBestMatch].lastFrame = 0; } } - if ((1 == m_TargetArray[dwBestMatch].m_ptArray.size() && m_TargetArray[dwBestMatch].nFrameCurr == 1) && m_TargetArray[dwBestMatch].m_bFirstInWander == true ) //ÒòÔÚÅÇ»²ÇøÓòÄÚ£¬¼ì²âÄ¿±ê¶ÔÏóÅж¨ÎªÐ¶ÔÏ󣬽«¸ÃжÔÏóµÄnFrameCurr£¬ÉèÖÃΪ¸ÃÇøÓòÄÚ×î½Ó½üµÄ¶ÔÏóµÄnFrameCurr + if ((1 == m_TargetArray[dwBestMatch].m_ptArray.size() && m_TargetArray[dwBestMatch].nFrameCurr == 1) && m_TargetArray[dwBestMatch].m_bFirstInWander == true ) //�����ǻ������ڣ����Ŀ������ж�Ϊ�¶��󣬽����¶����nFrameCurr������Ϊ����������ӽ��Ķ����nFrameCurr { double bestDistance = 0; CTarget best; @@ -3199,7 +3199,7 @@ void RegionSurveillance::WanderMonitoring(bool *pRegion_i, int dwBestMatch, int m_TargetArray[dwBestMatch].m_bFirstInWander = false; - // ÅжÏÄ£°åÊÇ·ñ½øÐиüР0 ÒÅÁô 1ÒÆ³ý + // �ж�ģ���Ƿ���и��� 0 ���� 1�Ƴ� left_flag_now_w = detectLeftRemove(pRGBIn, ForBottom, ForTop, ForLeft, ForRight); } else @@ -3227,10 +3227,10 @@ void RegionSurveillance::WanderMonitoring(bool *pRegion_i, int dwBestMatch, int } -// ¶ª°ü¼à²â +// ������� void RegionSurveillance::StayMonitoring( int dwBestMatch, int ForBottom, int ForTop, int ForLeft, int ForRight, int indexROI, RegionInfo* pRegionInfo, unsigned char* pRGBIn) { - // Ä¿±êÍâ½Ó¾ØÐÎÓÐÒ»¸ö±ß½øÈë½ûÇøÇÒÍâ½Ó¾ØÐÎÖÐÐĵãλÓÚ½ûÇøÄÚ + // Ŀ����Ӿ�����һ���߽����������Ӿ������ĵ�λ�ڽ����� int tar_size = m_TargetArray[dwBestMatch].m_ptArray.size(); int cur_dis; bool flag = 0; @@ -3290,7 +3290,7 @@ void RegionSurveillance::StayMonitoring( int dwBestMatch, int ForBottom, int For } } - // ÅжÏÄ£°åÊÇ·ñ½øÐиüР0 ÒÅÁô 1ÒÆ³ý + // �ж�ģ���Ƿ���и��� 0 ���� 1�Ƴ� left_flag_now_s = detectLeftRemove(pRGBIn, ForBottom, ForTop, ForLeft, ForRight); } //else @@ -3330,7 +3330,7 @@ void RegionSurveillance::RSrelease() pAlarmInfo = NULL; } - // ÊÍ·Åm_TargetArray + // �ͷ�m_TargetArray int i; for (i = 0; i < (int)m_TargetArray.size(); i++) { diff --git a/win/.vs/leftover/v14/.suo b/win/.vs/leftover/v14/.suo index 26111ff..a6df3a2 100644 --- a/win/.vs/leftover/v14/.suo +++ b/win/.vs/leftover/v14/.suo diff --git a/win/leftover.VC.VC.opendb b/win/leftover.VC.VC.opendb deleted file mode 100644 index 839dc36..0000000 --- a/win/leftover.VC.VC.opendb +++ /dev/null diff --git a/win/leftover.VC.db b/win/leftover.VC.db index da79aeb..19f25f4 100644 --- a/win/leftover.VC.db +++ b/win/leftover.VC.db