diff --git a/src/left_over/MSRegionSurveilance.cpp b/src/left_over/MSRegionSurveilance.cpp index 3120082..7aebe1f 100644 --- a/src/left_over/MSRegionSurveilance.cpp +++ b/src/left_over/MSRegionSurveilance.cpp @@ -14,7 +14,7 @@ IRegionSurveillance *MS_RegionSurveillance::GetMS_RS() return MS_RS; else { - exit(0); + exit(0); return NULL; } } diff --git a/src/left_over/help.cpp b/src/left_over/help.cpp index e0b5790..c35bfa8 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 != 2021)//2017��1��1�հ汾���� + if (nYear != 2021)//2017??1??1??·Ú???? { - printf("�汾���ڣ�\n"); + printf("°æ±¾¹ýÆÚ£¡\n"); return -1; } else diff --git a/src/left_over/left_over_det.h b/src/left_over/left_over_det.h index 820aada..aaa4b1b 100644 --- a/src/left_over/left_over_det.h +++ b/src/left_over/left_over_det.h @@ -117,7 +117,7 @@ typedef struct ms_trace { ms_trace trace; // ¹ì¼£¼°±¨¾¯×´Ì¬ int unique_id; // µ±Ç°Ä¿±êµÄÌØµãID sy_rect tar_box; // Ä¿±êÍâ½Ó¾ØÐÎ - float confidence; // ÖÃÐÅ¶È + float confidence; // ÖÃÐÅ¶È bool pb_alarm_state[MAXROINUM]; // ¶ÔÓ¦ÇøÓòÊÇ·ñ±¨¾¯ int pb_alarm_type[MAXROINUM]; // ¶ÔÓ¦ÇøÓòÊÇÄÄÖÖ±¨¾¯ }ms_object_info; diff --git a/src/left_over/svibe.cpp b/src/left_over/svibe.cpp index bd7d833..a2c2867 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,26 +116,26 @@ 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 + //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; } @@ -933,21 +933,21 @@ void int_128_store(_int_128 * n1, _int_128 & n2) void RegionSurveillance::VibeModelDilation2(unsigned char* inputdata, unsigned char *output, int width, int height) { memset(output, 0, sizeof(output[0])*width*height); - if (width<32 || height<32 || inputdata == NULL || output == NULL) + if (width<32 || height<32 || inputdata==NULL || output==NULL) return; unsigned char *src = inputdata; unsigned char *dst = output; //memcpy(output, inputdata, width*height); - for (int i = 0; i &ForegroundArray) { std::sort(ForegroundArray.begin(),ForegroundArray.end(), SortByPoint); @@ -1111,30 +1027,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 +1066,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 +1082,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 +1096,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 +1105,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 +1124,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 +1163,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 +1195,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 +1223,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 +1251,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 +1287,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 +1308,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 +1330,7 @@ void RegionSurveillance::VibeModelGetTrace(unsigned char* pSourceImg, float *Mas } } - //�����������Ŀ�� + //±£´æ×îÖÕÊä³öÄ¿±ê m_FinalArray.push_back(m_TargetArray[dwBestMatch]); /* // Draw it @@ -1427,8 +1343,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 +1371,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 +1391,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 +1409,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 +1438,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 +1552,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 +1616,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 +1632,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 +1657,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 +1676,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 +1848,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 +1863,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 +1882,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 +1898,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 +1913,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 +1923,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,9 +2069,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 - //printf("UniqueID = %d, cfd = %f\n", ObjInfo[i].UniqueID, ObjInfo[i].confidence); + ObjInfo[i].TarBox = m_FinalArray[i].m_TarBox; //Ä¿±êÍâ½Ó¾ØÐÎ + ObjInfo[i].UniqueID = m_FinalArray[i].m_dwID; //µ±Ç°Ä¿±êµÄÌØµãID } } @@ -2167,7 +2082,6 @@ void RegionSurveillance::getDeleteInfo(int DelCount, MS_ObjectInfo* ObjInfo) { int dwPointCount = m_DelArray[i].m_ptArray.size(); ObjInfo[i].curPos = m_DelArray[i].m_ptArray[dwPointCount - 1]; - int temp_dwPointCount = dwPointCount; if (dwPointCount > MAXTRACENUM) { @@ -2214,14 +2128,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 +2154,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 +2168,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 +2195,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 +2209,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 +2220,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 +2231,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 +2242,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 +2252,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 +2271,7 @@ void RegionSurveillance::MonitoringAlarm(unsigned char* pRGBIn, CForeground Fore - // �켣��� + // ¹ì¼£Ãè»æ //Trajectory(pRGBIn, ForegroundArray_i, dwBestMatch, width, height, widthStep); /* int dwStep = widthStep; @@ -2368,14 +2282,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 +2372,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 +2401,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 +2410,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 +2503,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 +2540,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 +2578,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 +2595,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 +2830,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 +2851,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 +2872,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 +2985,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 +3005,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 +3035,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 +3113,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 +3141,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 +3204,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 +3244,7 @@ void RegionSurveillance::RSrelease() pAlarmInfo = NULL; } - // �ͷ�m_TargetArray + // ÊÍ·Åm_TargetArray int i; for (i = 0; i < (int)m_TargetArray.size(); i++) {