当前位置: 首页>>代码示例>>C++>>正文


C++ Rect::br方法代码示例

本文整理汇总了C++中cv::Rect::br方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::br方法的具体用法?C++ Rect::br怎么用?C++ Rect::br使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cv::Rect的用法示例。


在下文中一共展示了Rect::br方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: findTop

bool findTop(cv::Point& top, int& topVal, cv::Mat* src, cv::Rect rect){
	cv::Point res(0, 0);
	int x = 0, y = 0;
	bool bFound = false;

	topVal = 65535;

	if (!src->empty()){
		try
		{
			for (int i = rect.tl().y; i < rect.br().y; ++i){
				for (int j = rect.tl().x; j < rect.br().x; ++j){
						{
							Int16 curVarVec = Convert::ToInt16((src->at<Int16>(cv::Point(j, i))) * 255.0f / 8191.0f);
							if (curVarVec < topVal && curVarVec > 0)
							{
								topVal = curVarVec;
								x = j;
								y = i;
								bFound = true;
							}
						}
				}
			}
		}
		catch(...)
		{
			// DO NOTHING
		}
	}
	//ht.nNose = src->at<Int16>(0,0);
	if(bFound) top = cv::Point(x,y);

	return bFound;
}
开发者ID:einbrain,项目名称:ProphetCursor,代码行数:35,代码来源:Common.cpp

示例2: contient

//retourne vrai si la boundingBox a contient la bounding box b
bool contient(cv::Rect a, cv::Rect b)
{
	if ((a.tl().x < b.tl().x) &&
		(a.tl().y < b.tl().y) &&
		(a.br().x > b.br().x) &&
		(a.br().y > b.br().y))
		return true;
	return false;
}
开发者ID:Ensiss,项目名称:pima-embarque,代码行数:10,代码来源:main.cpp

示例3: update

void BlobPeople::update(const cv::Rect& track) {
    cur = toOf(track).getCenter();
    smooth.interpolate(cur, 0.5);
    height = track.tl().y-track.br().y;
    bottom = track.br().y;
    left = track.tl().x;
    right = track.br().x;

    
}
开发者ID:crx091081gb,项目名称:still-breathing,代码行数:10,代码来源:ofApp.cpp

示例4: jaccardSimilarity

float jaccardSimilarity(cv::Rect bbox1, cv::Rect bbox2) {
	cv::Vec4i bi(std::max(bbox1.x, bbox2.x), std::max(bbox1.y,bbox2.y), std::min(bbox1.br().x,bbox2.br().x), std::min(bbox1.br().y,bbox2.br().y));
	int iw = bi[2] - bi[0];
	int ih = bi[3] - bi[1];
	if (iw > 0 && ih > 0) {
		int un = (bbox1.br().x - bbox1.x) * (bbox1.br().y - bbox1.y) +
		(bbox2.br().x - bbox2.x) * (bbox2.br().y - bbox2.y) - iw * ih;
		return iw * ih / float(un);
	}

	return 0.f;
}
开发者ID:hgaiser,项目名称:MasterThesis,代码行数:12,代码来源:main.cpp

示例5: setRegion

void LevelTracker::setRegion(const cv::Rect &roi)
{
    topLeft=roi.tl();
    bottonRight=roi.br();
    if(topLeft.x<bottonRight.x && topLeft.y<bottonRight.y)
        regOk=true;
}
开发者ID:fieldvisionfurg,项目名称:fieldvision_altus,代码行数:7,代码来源:LevelTracker.cpp

示例6: checkColision

static bool checkColision(const cv::Rect &a, const cv::Rect &b){
	if (b.contains(a.tl())) return true;
	if (b.contains(a.br())) return true;
	if (b.contains(cv::Point(a.x+a.width,a.y))) return true;
	if (b.contains(cv::Point(a.x,a.y+a.height))) return true;
	return false;
}
开发者ID:m4dm4x,项目名称:FaceInvaders,代码行数:7,代码来源:faceinvaders.cpp

示例7: addMouseObject

bool GeoMapEditor::addMouseObject( // пытаемся добавить новый объект вытянув или кликнув мышкой
    cv::Rect& rect, // note: in-out -- подкручиваем ректангл по законам первого рождения для данного объекта
    int flags )
{
  
  if (objType() == "AGM_Segm")
  {
    Point xyTL = rect.tl();
    Point xyBR = rect.br();
    GeoSheet& sh = gm.sheets[ cur_sheet ];
    Point2d enTL = sh.xy2en( xyTL );
    Point2d enBR = sh.xy2en( xyBR );

    AGM_Segm* ps = new AGM_Segm(enTL, enBR);
    gm.objects.push_back(cv::Ptr<AGM_Segm>(ps));
  }
  else
  {
    Point xy = center( rect );
    GeoSheet& sh = gm.sheets[ cur_sheet ];
    Point2d en = sh.xy2en( xy );
    AGM_Point* pp = new AGM_Point( en );
    gm.objects.push_back(cv::Ptr<AGM_Point>(pp));
  }

  return true;
};
开发者ID:vokintsop,项目名称:visiworld,代码行数:27,代码来源:geomapeditor.cpp

示例8: center

inline static cv::Point center(const cv::Rect &rc)
{
	std::vector<cv::Point> pts;
	pts.push_back(rc.tl());
	pts.push_back(rc.br());

	return center(pts);
}
开发者ID:chenyq123,项目名称:3516a_sample,代码行数:8,代码来源:DetectWithOF5.cpp

示例9: draw_box

// A litte subroutine to draw a box onto an image
//
void draw_box(cv::Mat& img, cv::Rect box) {
	cv::rectangle(
		img,
		box.tl(),
		box.br(),
		cv::Scalar(0x00, 0x00, 0xff) /* red */
		);
}
开发者ID:huyunf,项目名称:opencv,代码行数:10,代码来源:main.cpp

示例10: set

void Rectangle::set(const cv::Rect &_rect)
{
    rect = _rect;
    tl = _rect.tl();
    br = _rect.br();
    left->set(tl, cv::Point(tl.x, br.y));
    top->set(tl, cv::Point(br.x, tl.y));
    bottom->set(tl, cv::Point(tl.x, br.y));
    right->set(cv::Point(br.x, tl.y), cv::Point(tl.x, br.y));
    info.set(_rect);
}
开发者ID:apennisi,项目名称:annotationtool,代码行数:11,代码来源:rectangle.cpp

示例11: rescale_facebox

/**
 * @brief Scales and translates a facebox. Useful for converting
 * between face boxes from different face detectors.
 *
 * To convert from V&J faceboxes to ibug faceboxes, use a scaling
 * of 0.85 and a translation_y of 0.2.
 * Ideally, we would learn the exact parameters from data.
 *
 * @param[in] facebox Input facebox.
 * @param[in] scaling The input facebox will be scaled by this factor.
 * @param[in] translation_y How much, in percent of the original facebox's width, the facebox will be translated in y direction. A positive value means facebox moves downwards.
 * @return The rescaled facebox.
 */
cv::Rect rescale_facebox(cv::Rect facebox, float scaling, float translation_y)
{
	// Assumes a square input facebox to work? (width==height)
	const auto new_width = facebox.width * scaling;
	const auto smaller_in_px = facebox.width - new_width;
	const auto new_tl = facebox.tl() + cv::Point2i(smaller_in_px / 2.0f, smaller_in_px / 2.0f);
	const auto new_br = facebox.br() - cv::Point2i(smaller_in_px / 2.0f, smaller_in_px / 2.0f);
	cv::Rect rescaled_facebox(new_tl, new_br);
	rescaled_facebox.y += facebox.width * translation_y;
	return rescaled_facebox;
};
开发者ID:Amos-zq,项目名称:4dface,代码行数:24,代码来源:helpers.hpp

示例12: expandROI

/** expand a roi **/
void Cropper::expandROI(cv::Rect &r) {
    bool canExpand = true;
    Point2i p1, p2;
    cv::Rect rp;
    
    while(canExpand){
        canExpand = false;
        Point2i stp = (rect.tl() - r.tl());
        stp.x /=2; stp.y /=2;
        p2 = r.br();
        while(abs(stp.x) + abs(stp.y)>=1){
            p1 = r.tl() + stp;
            rp = cv::Rect(p1, p2);
            if(!rectHasBlankPixels(rp)){
                r = rp;
                canExpand = true;
                break;
            }
            stp.x /= 2; stp.y /=2;
        }
        
        stp = (rect.br() - r.br());
        stp.x /=2; stp.y /=2;
        p1 = r.tl();
        while(abs(stp.x) + abs(stp.y)>=1){
            p2 = r.br() + stp;
            rp = cv::Rect(p1, p2);
            if(!rectHasBlankPixels(rp)){
                r = rp;
                canExpand = true;
                break;
            }
            stp.x /=2; stp.y/=2;
        }
    }
}
开发者ID:TonyJianguestc,项目名称:crop-images,代码行数:37,代码来源:cropper.cpp

示例13: make_pair

std::pair<double, cv::Point> DescribeMaximum(const cv::Mat &surface,
                                             const cv::Rect &boundingBox) {
  // assert surface double
  cv::Point position = boundingBox.tl();
  cv::Point end = boundingBox.br();
  size_t x = position.x, y = position.y;
  double value = surface.at<double>(position);
  for (; x <= end.x; x++) {
    for (; y <= end.y; y++) {
      if (surface.at<double>(y, x) > value) {
        value = surface.at<double>(y, x);
        position = cv::Point(x, y);
      }
    }
  }
  return std::make_pair(value, position);
}
开发者ID:alexanderkuk,项目名称:polyp-detector,代码行数:17,代码来源:detector.cpp

示例14: rect

Rectangle::Rectangle(const cv::Rect &_rect, const int &_id) :
    rect(_rect)
{
    tl = _rect.tl();
    br = _rect.br();
    left = new VerticalLine();
    left->set(tl, cv::Point(tl.x, br.y));
    top = new HorizontalLine();
    top->set(tl, cv::Point(br.x, tl.y));
    bottom = new HorizontalLine();
    bottom->set(cv::Point(tl.x, br.y), br);
    right = new VerticalLine();
    right->set(cv::Point(br.x, tl.y), br);
    info.set(_id, _rect);
    selected = false;
    selected_color = RED_COLOR;
    offset = 4;
    lineOffset = LINE_WEIGHT;
    color = cv::Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );

}
开发者ID:apennisi,项目名称:annotationtool,代码行数:21,代码来源:rectangle.cpp

示例15: tmp

void singleeyefitter::cvx::getROI(const cv::Mat& src, cv::Mat& dst, const cv::Rect& roi, int borderType)
{
    cv::Rect bbSrc = boundingBox(src);
    cv::Rect validROI = roi & bbSrc;
    if (validROI == roi)
    {
        dst = cv::Mat(src, validROI);
    }
    else
    {
        // Figure out how much to add on for top, left, right and bottom
        cv::Point tl = roi.tl() - bbSrc.tl();
        cv::Point br = roi.br() - bbSrc.br();

        int top = std::max(-tl.y, 0);  // Top and left are negated because adding a border
        int left = std::max(-tl.x, 0); // goes "the wrong way"
        int right = std::max(br.x, 0);
        int bottom = std::max(br.y, 0);

        cv::Mat tmp(src, validROI);
        cv::copyMakeBorder(tmp, dst, top, bottom, left, right, borderType);
    }
}
开发者ID:LeszekSwirski,项目名称:singleeyefitter,代码行数:23,代码来源:cvx.cpp


注:本文中的cv::Rect::br方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。