⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 integralfeaturessame.cpp

📁 tracciatore di mani con webcam
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//// CSevenColumnsSimilarIF classes implementation///////////////////////////////////////////////////////////////////////////////CSevenColumnsSimilarIF::CSevenColumnsSimilarIF(int templateWidth, int templateHeight)  : CSevenColumnsIF(templateWidth, templateHeight) {}CSevenColumnsSimilarIF::CSevenColumnsSimilarIF(int templateWidth, int templateHeight,                                 int _toprow, int _bottomrow,                                 int _1, int _2, int _3, int _4, int _5, int _6,                                 int _7, int _8)  : CSevenColumnsIF(templateWidth, templateHeight) {  toprow = _toprow;  bottomrow = _bottomrow;  col1_left = _1;  col2_left = _2;  col3_left = _3;  col4_left = _4;  col5_left = _5;  col6_left = _6;  col7_left = _7;  col7_right = _8;  SetNonOverlap();}CSevenColumnsSimilarIF::CSevenColumnsSimilarIF(const CSevenColumnsSimilarIF& frm)  : CSevenColumnsIF(frm) {}CSevenColumnsSimilarIF::CSevenColumnsSimilarIF(istream& is, int template_width, int template_height)  : CSevenColumnsIF(is, template_width, template_height){}bool CSevenColumnsSimilarIF::SetToNextIncarnation(){	if (m_is_partial) {		if (m_remaining_incarnations) {			m_remaining_incarnations--;		} else {			return false;		}	}	col2_left += 1;	col3_left += 1;	col4_left += 2;	col5_left += 2;	col6_left += 3;	col7_left += 3;	col7_right+= 4;	if (col7_right>=m_template_width) {		int new_even_width = col3_left-col2_left+1;		col2_left = col1_left+1;		col3_left = col2_left+new_even_width;		col4_left = col3_left+1;		col5_left = col4_left+new_even_width;		col6_left = col5_left+1;		col7_left = col6_left+new_even_width;		col7_right= col7_left+1;		if (col7_right>=m_template_width) {			col1_left += 1;			if (col1_left>=m_template_width-7) {				bottomrow++;				if (bottomrow==m_template_height) {					toprow++;					if (toprow==m_template_height-1) {						return false;					}					bottomrow = toprow+1;				}				col1_left = -1;			}			col2_left = col1_left+1;			col3_left = col2_left+1;			col4_left = col3_left+1;			col5_left = col4_left+1;			col6_left = col5_left+1;			col7_left = col6_left+1;			col7_right = col7_left+1;		}	}	SetNonOverlap();	return true;}CIntegralFeature* CSevenColumnsSimilarIF::Copy() const{	return new CSevenColumnsSimilarIF(*this);}ostream& CSevenColumnsSimilarIF::output(ostream& os) const{  os << "SevenColumnsSimilar " << toprow << "," << bottomrow << " x ";  os << col1_left << "," << col2_left << "," << col3_left << "," << col4_left << ",";  os << col5_left << "," << col6_left << "," << col7_left << "," << col7_right;  return os;}///////////////////////////////////////////////////////////////////////////////// CDiagSameIF classes implementation///////////////////////////////////////////////////////////////////////////////CDiagSameIF::CDiagSameIF(int templateWidth, int templateHeight)  : CDiagIF(templateWidth, templateHeight) {}CDiagSameIF::CDiagSameIF(int templateWidth, int templateHeight,        int _toprect_toprow, int _centerrow,        int _bottomrect_bottomrow,        int _leftrect_leftcol, int _centercol,        int _rightrect_rightcol)  : CDiagIF(templateWidth, templateHeight) {  toprect_toprow = _toprect_toprow;  centerrow = _centerrow;  bottomrect_bottomrow = _bottomrect_bottomrow;  leftrect_leftcol = _leftrect_leftcol;  centercol = _centercol;  rightrect_rightcol = _rightrect_rightcol;  SetNonOverlap();}CDiagSameIF::CDiagSameIF(const CDiagSameIF& frm)  : CDiagIF(frm) {}CDiagSameIF::CDiagSameIF(istream& is, int templateWidth, int templateHeight)  : CDiagIF(templateWidth, templateHeight) {  char a, b, c, d;  string str;  is >> toprect_toprow >> a >> centerrow >> b     >> bottomrect_bottomrow >> str     >> leftrect_leftcol >> c >> centercol >> d     >> rightrect_rightcol;  if (a!=',' || b!=',' || str!="x" || c!=',' || d!=',') {    char* buf = (char*) alloca((256+str.length())*sizeof(char));    sprintf(buf, "error during construction of DiagSameIF (%c|%c|%s|%c|%c)\n",	   a, b, str.c_str(), c, d);    throw ITException(buf);  }  SetNonOverlap();}bool CDiagSameIF::SetToNextIncarnation(){  if (m_is_partial) {    if (m_remaining_incarnations) {      m_remaining_incarnations--;    } else {      return false;    }  }  bottomrect_bottomrow+=2;  centerrow++;  if (bottomrect_bottomrow>=m_template_height) {    toprect_toprow++;    if (toprect_toprow==m_template_height-2) {      rightrect_rightcol+=2;      centercol++;      if (rightrect_rightcol>=m_template_width) {	leftrect_leftcol++;	if (leftrect_leftcol==m_template_width-2) {	  return false;	}	centercol=leftrect_leftcol+1;	rightrect_rightcol=centercol+1;      }      toprect_toprow=-1;    }    centerrow=toprect_toprow+1;    bottomrect_bottomrow=centerrow+1;  }  SetNonOverlap();  return true;}CIntegralFeature* CDiagSameIF::Copy() const{  return new CDiagSameIF(*this);}ostream& CDiagSameIF::output(ostream& os) const{  os << "DiagSame " << toprect_toprow << "," << centerrow      << "," << bottomrect_bottomrow << " x ";  os << leftrect_leftcol << "," << centercol     << "," << rightrect_rightcol;  return os;}///////////////////////////////////////////////////////////////////////////////// CDiagSimilarIF classes implementation///////////////////////////////////////////////////////////////////////////////CDiagSimilarIF::CDiagSimilarIF(int templateWidth, int templateHeight)  : CDiagIF(templateWidth, templateHeight) {}CDiagSimilarIF::CDiagSimilarIF(int templateWidth, int templateHeight,        int _toprect_toprow, int _centerrow,        int _bottomrect_bottomrow,        int _leftrect_leftcol, int _centercol,        int _rightrect_rightcol)  : CDiagIF(templateWidth, templateHeight) {  toprect_toprow = _toprect_toprow;  centerrow = _centerrow;  bottomrect_bottomrow = _bottomrect_bottomrow;  leftrect_leftcol = _leftrect_leftcol;  centercol = _centercol;  rightrect_rightcol = _rightrect_rightcol;  SetNonOverlap();}CDiagSimilarIF::CDiagSimilarIF(const CDiagSimilarIF& frm)  : CDiagIF(frm) {}CDiagSimilarIF::CDiagSimilarIF(istream& is, int templateWidth, int templateHeight)  : CDiagIF(templateWidth, templateHeight) {  char a, b, c, d;  string str;  is >> toprect_toprow >> a >> centerrow >> b     >> bottomrect_bottomrow >> str     >> leftrect_leftcol >> c >> centercol >> d     >> rightrect_rightcol;  if (a!=',' || b!=',' || str!="x" || c!=',' || d!=',') {    char* buf = (char*) alloca((256+str.length())*sizeof(char));    sprintf(buf, "error during construction of DiagSimilarIF (%c|%c|%s|%c|%c)\n",	   a, b, str.c_str(), c, d);    throw ITException(buf);  }  SetNonOverlap();}bool CDiagSimilarIF::SetToNextIncarnation(){  if (m_is_partial) {    if (m_remaining_incarnations) {      m_remaining_incarnations--;    } else {      return false;    }  }  bottomrect_bottomrow+=2;  centerrow++;  if (bottomrect_bottomrow>=m_template_height) {    toprect_toprow++;    if (toprect_toprow==m_template_height-2) {      rightrect_rightcol++;      if (rightrect_rightcol==m_template_width) {	centercol++;	if (centercol==m_template_width-1) {	  leftrect_leftcol++;	  if (leftrect_leftcol==m_template_width-2) {	    return false;	  }	  centercol=leftrect_leftcol+1;	}	rightrect_rightcol=centercol+1;      }      toprect_toprow=-1;    }    centerrow=toprect_toprow+1;    bottomrect_bottomrow=centerrow+1;  }  SetNonOverlap();  return true;}CIntegralFeature* CDiagSimilarIF::Copy() const{  return new CDiagSimilarIF(*this);}ostream& CDiagSimilarIF::output(ostream& os) const{  os << "DiagSimilar " << toprect_toprow << "," << centerrow      << "," << bottomrect_bottomrow << " x ";  os << leftrect_leftcol << "," << centercol     << "," << rightrect_rightcol;  return os;}///////////////////////////////////////////////////////////////////////////////// CFourBoxesSameIF classes implementation///////////////////////////////////////////////////////////////////////////////CFourBoxesSameIF::CFourBoxesSameIF(int templateWidth, int templateHeight)  : CFourBoxesIF(templateWidth, templateHeight) {}CFourBoxesSameIF::CFourBoxesSameIF(int templateWidth, int templateHeight,             const CRect* pB1, const CRect* pB2,             const CRect* pB3, const CRect* pB4)  : CFourBoxesIF(templateWidth, templateHeight) {  b1_left = pB1->left;  b1_top = pB1->top;  b1_right = pB1->right;  b1_bottom = pB1->bottom;  b2_left = pB2->left;  b2_top = pB2->top;  b2_right = pB2->right;  b2_bottom = pB2->bottom;  b3_left = pB3->left;  b3_top = pB3->top;  b3_right = pB3->right;  b3_bottom = pB3->bottom;  b4_left = pB4->left;  b4_top = pB4->top;  b4_right = pB4->right;  b4_bottom = pB4->bottom;  SetNonOverlap();}CFourBoxesSameIF::CFourBoxesSameIF(const CFourBoxesSameIF& frm)  : CFourBoxesIF(frm){}CFourBoxesSameIF::CFourBoxesSameIF(istream& is, int template_width, int template_height)  : CFourBoxesIF(template_width, template_height){  char a, b, c, d, e, f;  is >> e >> b1_left >> a >> b1_top >> b >> b1_right >> c >> b1_bottom >> f >> d;  if (a!=',' || b!=',' || c!=',' || d!=',' || e!='(' || f!=')') {    char* buf = (char*) alloca(256*sizeof(char));    sprintf(buf, "error during construction of FourBoxesSameIF (%c|%c|%c|%c|%c)\n",	   e, a, b, c, f);    throw ITException(buf);  }  is >> e >> b2_left >> a >> b2_top >> b >> b2_right >> c >> b2_bottom >> f >> d;  if (a!=',' || b!=',' || c!=',' || d!=',' || e!='(' || f!=')') {    char* buf = (char*) alloca(256*sizeof(char));    sprintf(buf, "error during construction of FourBoxesSameIF (%c|%c|%c|%c|%c)\n",	   e, a, b, c, f);    throw ITException(buf);  }  is >> e >> b3_left >> a >> b3_top >> b >> b3_right >> c >> b3_bottom >> f >> d;  if (a!=',' || b!=',' || c!=',' || d!=',' || e!='(' || f!=')') {    char* buf = (char*) alloca(256*sizeof(char));    sprintf(buf, "error during construction of FourBoxesSameIF (%c|%c|%c|%c|%c)\n",	   e, a, b, c, f);    throw ITException(buf);  }  is >> e >> b4_left >> a >> b4_top >> b >> b4_right >> c >> b4_bottom >> f;  if (a!=',' || b!=',' || c!=',' || e!='(' || f!=')') {    char* buf = (char*) alloca(256*sizeof(char));    sprintf(buf, "error during construction of FourBoxesSameIF (%c|%c|%c|%c|%c)\n",	   e, a, b, c, f);    throw ITException(buf);  }  SetNonOverlap();}void CFourBoxesSameIF::SetToFirstIncarnation(){  if (m_is_partial) {    b1_left = start_b1_left;  b1_top = start_b1_top;    b1_right = start_b1_right;  b1_bottom = start_b1_bottom;    b2_left = start_b2_left;  b2_top = start_b2_top;    b2_right = start_b2_right;  b2_bottom = start_b2_bottom;    b3_left = start_b3_left;  b3_top = start_b3_top;    b3_right = start_b3_right;  b3_bottom = start_b3_bottom;    b4_left = start_b4_left;  b4_top = start_b4_top;    b4_right = start_b4_right;  b4_bottom = start_b4_bottom;    m_remaining_incarnations = m_stop_after_num_incarnations;  } else {    b1_left  =-1;  b1_top    = 0;    b1_right = 1;  b1_bottom = 2;    b2_left  = 0;  b2_top    = 2;    b2_right = 2;  b2_bottom = 4;    b3_left  = 0;  b3_top    =-1;    b3_right = 2;  b3_bottom = 1;    b4_left  = 1;  b4_top    = 0;    b4_right = 3;  b4_bottom = 2;  }  SetNonOverlap();}bool CFourBoxesSameIF::SetToNextIncarnation(){	if (m_is_partial) {		if (m_remaining_incarnations) {			m_remaining_incarnations--;		} else {			return false;		}	}          int width = b1_right-b1_left;  b2_right++;  b2_left++;  b3_right++;  b3_left++;  if (b3_right>=m_template_width-2 || b3_left>=b1_right) {    b1_right++;    b1_left++;    b4_right++;    b4_left++;    if (b1_right>=m_template_width-3) {      int height = b1_bottom-b1_top;      b3_bottom++;      b3_top++;      b4_bottom++;      b4_top++;      if (b3_bottom>=m_template_height-3) {        b1_bottom++;        b1_top++;        b2_bottom++;        b2_top++;        if (b1_bottom>=m_template_height-2 || b1_top>=b3_bottom) {          width++;          if (width>m_template_width-3) {            height++;            if (height>m_template_height-2) {              return false;            }            width = 2;          }          b1_top = 0; b1_bottom = b1_top+height;          b2_top = 1; b2_bottom = b2_top+height;        }        b3_top =-1; b3_bottom = b3_top+height;        b4_top = 1; b4_bottom = b4_top+height;      }      b1_left =-1; b1_right = b1_left+width;      b4_left = 1; b4_right = b4_left+width;    }    b3_left = 0; b3_right = b3_left+width;    b2_left = 0; b2_right = b2_left+width;  }  SetNonOverlap();	return true;}CIntegralFeature* CFourBoxesSameIF::Copy() const{	return new CFourBoxesSameIF(*this);}ostream& CFourBoxesSameIF::output(ostream& os) const{  os << "FourBoxesSame "      << "(" << b1_left << "," << b1_top << "," << b1_right << "," << b1_bottom << "),"     << "(" << b2_left << "," << b2_top << "," << b2_right << "," << b2_bottom << "),"     << "(" << b3_left << "," << b3_top << "," << b3_right << "," << b3_bottom << "),"     << "(" << b4_left << "," << b4_top << "," << b4_right << "," << b4_bottom << ")";  return os;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -