• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ point_t类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中point_t的典型用法代码示例。如果您正苦于以下问题:C++ point_t类的具体用法?C++ point_t怎么用?C++ point_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: queryLine

void World::queryLine(point_t v1, point_t v2, QueryCallback* qc) {
	if (use_partitioning) {
		//spatial hash version: check every rect in bucket intersecting line
		int min_x = (v1.getX()) / bucket_width;
		int max_x = (v2.getX()) / bucket_width;
		if (min_x > max_x)
			std::swap(min_x, max_x);
		int min_y = (v1.getY()) / bucket_height;
		int max_y = (v2.getY()) / bucket_height;
		if (min_y > max_y)
			std::swap(min_y, max_y);

		//todo: iterates over full box containing line; just iterate over any bucket intersecting.
		//iterate over all buckets intersecting line:
		for (int i = min_x; i <= max_x; i++)
			for (int j = min_y; j <= max_y; j++)
				if (bucket* b = getBucket(i, j))
					//iterate over all rects in bucket:
					for (auto iter : b->rect_v)
						//check if rect intersects the line:
						if (iter->queryOnLine(v1, v2))
							//halt if QueryCallback returns false.
							if (!qc->onMatch(iter,
									iter->getContactPointOnLine(v1, v2)))
								return;
	} else {
		//non spatial hash version: check every rect
		for (auto iter : v_rect) {
			if (iter->queryOnLine(v1, v2))
				if (!qc->onMatch(iter, iter->getContactPointOnLine(v1, v2)))
					return;
		}
	}
}
开发者ID:nstbayless,项目名称:sdlgame,代码行数:34,代码来源:World.cpp


示例2: _crossTwoCircles

static int _crossTwoCircles(point_t& pt1, point_t& pt2,
                            const point_t& c1, double r1,
                            const point_t& c2, double r2)
{
    double d, a, b, c, p, q, r;
    double cos_value[2], sin_value[2];
    
    if (mgEquals(c1.x, c2.x) && mgEquals(c1.y, c2.y) && mgEquals(r1, r2)) {
        return -1;
    }
    
    d = c1.distanceTo(c2);
    if (d > r1 + r2 || d < fabs(r1 - r2)) {
        return 0;
    }
    
    a = 2.0 * r1 * (c1.x - c2.x);
    b = 2.0 * r1 * (c1.y - c2.y);
    c = r2 * r2 - r1 * r1 - c1.distanceSquare(c2);
    p = a * a + b * b;
    q = -2.0 * a * c;
    if (mgEquals(d, r1 + r2) || mgEquals(d, fabs(r1 - r2))) {
        cos_value[0] = -q / p / 2.0;
        sin_value[0] = sqrt(1 - cos_value[0] * cos_value[0]);
        
        pt1.x = r1 * cos_value[0] + c1.x;
        pt1.y = r1 * sin_value[0] + c1.y;
        
        if (!mgEquals(pt1.distanceSquare(c2), r2 * r2)) {
            pt1.y = c1.y - r1 * sin_value[0];
        }
        return 1;
    }
    
    r = c * c - b * b;
    cos_value[0] = (sqrt(q * q - 4.0 * p * r) - q) / p / 2.0;
    cos_value[1] = (-sqrt(q * q - 4.0 * p * r) - q) / p / 2.0;
    sin_value[0] = sqrt(1 - cos_value[0] * cos_value[0]);
    sin_value[1] = sqrt(1 - cos_value[1] * cos_value[1]);
    
    pt1.x = r1 * cos_value[0] + c1.x;
    pt2.x = r1 * cos_value[1] + c1.x;
    pt1.y = r1 * sin_value[0] + c1.y;
    pt2.y = r1 * sin_value[1] + c1.y;
    
    if (!mgEquals(pt1.distanceSquare(c2), r2 * r2)) {
        pt1.y = c1.y - r1 * sin_value[0];
    }
    if (!mgEquals(pt2.distanceSquare(c2), r2 * r2)) {
        pt2.y = c1.y - r1 * sin_value[1];
    }
    if (mgEquals(pt1.y, pt2.y) && mgEquals(pt1.x, pt2.x)) {
        if (pt1.y > 0) {
            pt2.y = -pt2.y;
        } else {
            pt1.y = -pt1.y;
        }
    }
    return 2;
}
开发者ID:CharlyZhang,项目名称:vgcore,代码行数:60,代码来源:mgcurv.cpp


示例3: while

void fill_t::solid_fill(point_t p,float width,float height){
	//std::cout<<"width  "<<width<<" and height "<<height<<std::endl;
	std::queue <point_t> fillQueue;
	fillQueue.push(p);
	float pointx=p.getX();
	float pointy=p.getY();
	color_t c=colorArray[(int)pointx][(int)pointy];
	
    color_t pixels;
    
    while(!fillQueue.empty()){
    	// std::cout<<c.getR()<<" ANSSS"<<std::endl;
    	// exit(0);
		p=fillQueue.front();
		pointx=p.getX();
		pointy=p.getY();
		fillQueue.pop();
		
		//Added Canvas size check
		if(pointx>=width || pointy>=height || pointx<0 || pointy<0)
			continue;
		pixels = colorArray[(int)pointx][(int)pointy];
		
		if( (pixels.getR()==c.getR()) && (pixels.getG()==c.getG()) && (pixels.getB()==c.getB()) )
		{
			
			point_t p1(pointx, pointy);
			p1.draw(pen_t(color1,1));
			fillQueue.push(point_t(pointx+1,pointy));
			fillQueue.push(point_t(pointx,pointy+1));
			fillQueue.push(point_t(pointx-1,pointy));
			fillQueue.push(point_t(pointx,pointy-1));
		}
	}
}
开发者ID:Rahul-Singhal,项目名称:MyPaint,代码行数:35,代码来源:fill_t.cpp


示例4: queryOnLine

bool Rect::queryOnLine(point_t v1, point_t v2) {
	//checks each edge of rect to see if line intersects
	return (lineSegmentsIntersect({x,y},{x+w,y},v1,v2) ||
			lineSegmentsIntersect({x,y},{x,y+h},v1,v2) ||
			lineSegmentsIntersect({x,y+h},{x+w,y+h},v1,v2) ||
			lineSegmentsIntersect({x+w,y},{x+w,y+h},v1,v2) ||

			//checks if line contained within rect
			queryContains(v1.getX(),v1.getY()));
}
开发者ID:nstbayless,项目名称:sdlgame,代码行数:10,代码来源:Rect.cpp


示例5: get_integral_channels

/// the out integral channel will be resized to the required dimensions
void get_integral_channels(const integral_channels_t &in,
                           const point_t &modelWindowSize, const point_t &dataOffset, const int resizing_factor,
                           integral_channels_t &out)
{
    get_integral_channels(in,
                          dataOffset.x(), dataOffset.y(),
                          modelWindowSize.x(), modelWindowSize.y(),
                          resizing_factor,
                          out);
    return;
}
开发者ID:HaoLiuHust,项目名称:doppia,代码行数:12,代码来源:integral_channels_helpers.cpp


示例6: addPositiveSamples

void TrainingData::addPositiveSamples(const std::vector<std::string> &filenamesPositives,
                                      const point_t &modelWindowSize, const point_t &dataOffset)
{
    const size_t
            initialNumberOfTrainingSamples = getNumExamples(), // yl images number have been added to the training set
            finalNumberOfTrainingSamples = initialNumberOfTrainingSamples + filenamesPositives.size();
    if(finalNumberOfTrainingSamples > getMaxNumExamples())
    {
        throw std::runtime_error("TrainingData::addPositiveSamples is trying to add more data than initially specified");
    }


    printf("\nCollecting %zi positive samples\n", filenamesPositives.size());
    boost::progress_display progress_indicator(filenamesPositives.size());


    meta_datum_t  metaDatum;
    integral_channels_t sampleIntegralChannels;

    // integralChannelsComputer is already multithreaded, so no benefit on paralelizing this for loop
    for (size_t filenameIndex = 0; filenameIndex < filenamesPositives.size(); filenameIndex +=1)
    {
        gil::rgb8_image_t image;
        gil::rgb8c_view_t image_view = doppia::open_image(filenamesPositives[filenameIndex].c_str(), image);

        _integralChannelsComputer.set_image(image_view);
        _integralChannelsComputer.compute();

        get_integral_channels(_integralChannelsComputer.get_integral_channels(),
                              modelWindowSize, dataOffset, _integralChannelsComputer.get_shrinking_factor(),// shrinking factor = 4
                              sampleIntegralChannels);

        metaDatum.filename = filenamesPositives[filenameIndex];
        metaDatum.imageClass = 1;//classes[k];
        metaDatum.x = dataOffset.x();
        metaDatum.y = dataOffset.y();

        setDatum(initialNumberOfTrainingSamples + filenameIndex,
                 metaDatum, sampleIntegralChannels);

        ++progress_indicator;
    } // end of "for each filename"

    return;
}
开发者ID:mdqyy,项目名称:main_demo_cmake,代码行数:45,代码来源:TrainingData.cpp


示例7: onMatch

chassis_id PhysicsRegion::queryFirstPoint(point_t point,
		flag_plane p) {
	struct : public rects::QueryCallback {
		const PhysicsRegion* parent;
		chassis_id ret=NO_CHASSIS;
		bool onMatch(rects::Rect* r, point_t at) {
			ret = parent->getChassisFromRect(r);
			return false;
		}
	} qc;
	qc.parent = this;
	for (byte i = 0; i < getPlaneCount(); i++) {
		flag_plane p_it = 1 << i;
		if (p_it & p)
			planes[i].queryPoint(point.getX(), point.getY(), &qc);
		if (qc.ret!=NO_CHASSIS)
			return qc.ret;
	}
	return qc.ret;
}
开发者ID:nstbayless,项目名称:sdlgame,代码行数:20,代码来源:PhysicsRegion.cpp


示例8: within_n

    bool Polygon::within_n(const point_t &p, double d2) const
    {
        if (_in_mbr(p)) {
            for (size_t i = 0; i < outer_.size(); ++i)
                if (outer_[i].contains(p))
                    return outer_[i].within_n(p, d2);

            for (size_t i = 0; i < inner_.size(); ++i)
                if (inner_[i].contains(p))
                    return inner_[i].within_n(p, d2);

            return true;
        } else {
            if (p.y() >= mbr_[0]) return _within_n(p, d2, 0);
            if (p.x() <= mbr_[1]) return _within_n(p, d2, 1);
            if (p.y() <= mbr_[2]) return _within_n(p, d2, 2);
            if (p.x() >= mbr_[3]) return _within_n(p, d2, 3);
        }

        // not reachable
        return true;
    }
开发者ID:gongzhitaao,项目名称:sigspatial2013,代码行数:22,代码来源:polygon.cpp


示例9: initWrite

void ModelIO::initWrite(const std::string datasetName,
                        const DetectorModel::DetectorTypes type,
                        const std::string detectorName,
                        const point_t modelWindow,
                        const rectangle_t objectWindow)
{

    doppia_protobuf::Point2d *model_window = _model.mutable_model_window_size();
    model_window->set_x(modelWindow.x());
    model_window->set_y(modelWindow.y());

    doppia_protobuf::Box *b = _model.mutable_object_window();
    b->mutable_min_corner()->set_x(objectWindow.min_corner().x());
    b->mutable_min_corner()->set_y(objectWindow.min_corner().y());
    b->mutable_max_corner()->set_x(objectWindow.max_corner().x());
    b->mutable_max_corner()->set_y(objectWindow.max_corner().y());

    _model.set_training_dataset_name(datasetName.c_str());
    _model.set_detector_type(type);
    _model.set_detector_name(detectorName);

    return;
}
开发者ID:HaoLiuHust,项目名称:doppia,代码行数:23,代码来源:ModelIO.cpp


示例10: _crossLineCircle

// http://mathworld.wolfram.com/Circle-LineIntersection.html
int _crossLineCircle(point_t& pt1, point_t& pt2, const point_t& a,
                     const point_t& b, double r)
{
    point_t d(b - a);
    double d2 = d.lengthSquare();
    double dz = a.crossProduct(b);
    double z2 = dz * dz;
    double delta = r * r * d2 - z2;
    
    if (delta < 0)
        return 0;
    
    double s = sqrt(delta) / d2;
    double sx = (d.y < 0 ? -d.x : d.x) * s;
    double sy = fabs(d.y) * s;
    double tx = dz * d.y / d2;
    double ty = -dz * d.x / d2;
    
    pt1 = point_t(tx + sx, ty + sy);
    pt2 = point_t(tx - sx, ty - sy);
    
    return delta < 1e-8 ? 1 : 2;
}
开发者ID:CharlyZhang,项目名称:vgcore,代码行数:24,代码来源:mgcurv.cpp


示例11: is_in

    bool Plane::is_in(const point_t &p) const
    {
        assert(p.size() == a.size());
        double sum = 0;

        for (unsigned i=0; i<a.size(); ++i)
            sum += a[i] * p[i];

        //std::cerr << "Sum = " << sum << std::endl;

        switch(sign) {
        case lt: return (sum < b);
            break;
        case lte: return (sum <= b);
            break;
        case gt: return (sum > b);
            break;
        case gte: return (sum >= b);
            break;
        }
        assert(false);
        return false;
    }
开发者ID:YIYAYIYAYOUCHENG,项目名称:rtscan,代码行数:23,代码来源:constraint_space.cpp


示例12:

	inline bool operator==( point_t<origin_type::screen> const& lhs, point_t<origin_type::screen> const& rhs ) noexcept
	{
		return lhs.x() == rhs.x() && lhs.y() == rhs.y();
	}
开发者ID:LNSEAB,项目名称:mmaccel,代码行数:4,代码来源:point.hpp


示例13: lineSegmentsIntersect

/** Returns true if intersection between the two line segments.*/
bool lineSegmentsIntersect(point_t a1, point_t a2,point_t b1,point_t b2) {
	//if lines vertical:
	if (a1.getX()==a2.getX())
		if ((a1.getX()>b1.getX()&&a1.getX()<b2.getX())
				||(a1.getX()>b2.getX()&&a1.getX()<b1.getX())) {
			float m_b = (b1-b2).getSlope();
			float b_b = b1.getY()-b1.getX()*m_b;
			float y_intersect = b_b + m_b*a1.getX();
			return ((y_intersect>a1.getY())!=(y_intersect>a2.getY()));
		}
	if (b1.getX()==b2.getX())
		if ((b1.getX()>a1.getX()&&b1.getX()<a2.getX())
				||(b1.getX()>a2.getX()&&b1.getX()<a1.getX())) {
			float m_a = (a1-a2).getSlope();
			float b_a = a1.getY()-a1.getX()*m_a;
			float y_intersect = b_a + m_a*b1.getX();
			return ((y_intersect>b1.getY())!=(y_intersect>b2.getY()));
		}
	//solve for intersection:
	float m_a = (a1-a2).getSlope();
	float m_b = (b1-b2).getSlope();
	float b_a = a1.getY()-a1.getX()*m_a;
	float b_b = b1.getY()-b1.getX()*m_b;

	//overlapping lines do not intersect.
	if (m_a==m_b) return false;

	float x_intersect = (b_a+b_b)/(m_a-m_b);
	return ((x_intersect>a1.getX()&&x_intersect<a2.getX())||(x_intersect>a2.getX()&&x_intersect<a1.getX())) &&
			((x_intersect>b1.getX()&&x_intersect<b2.getX())||(x_intersect>b2.getX()&&x_intersect<b1.getX()));
}
开发者ID:nstbayless,项目名称:sdlgame,代码行数:32,代码来源:Rect.cpp


示例14: lineSegmentsIntersectCoord

/** Returns point of intersection between the two line segments.*/
point_t lineSegmentsIntersectCoord(point_t a1, point_t a2,point_t b1,point_t b2) {
	point_t DEFAULT_RETURN = {-1,-1};
	//solve for intersection:
	float m_a;
	float b_a;
	if (a1.getX()!=a2.getX()) {
		m_a = (a1-a2).getSlope();
		b_a = a1.getY()-a1.getX()*m_a;
	}
	float m_b;
	float b_b;
	if (b1.getX()!=b2.getX()) {
		m_b = (b1-b2).getSlope();
		b_b = b1.getY()-b1.getX()*m_b;
	}
	if (a1.getX()==a2.getX()&&b1.getX()==b2.getX())
		return DEFAULT_RETURN;
	if (a1.getX()==a2.getX())
		return {a1.getX(),b_b+m_b*a1.getX()};
	if (b1.getX()==b2.getX())
		return {b1.getX(),b_a+m_a*b1.getX()};

	//overlapping lines do not intersect.
	if (m_a==m_b) return DEFAULT_RETURN;

	float x_intersect = (b_a+b_b)/(m_a-m_b);
	return {x_intersect, b_a + x_intersect*m_a};
}
开发者ID:nstbayless,项目名称:sdlgame,代码行数:29,代码来源:Rect.cpp


示例15: get_angle

double get_angle(point_t v1, point_t v2) {
  return atan2(v1.dot(v2), v1.cross(v2));
}
开发者ID:pufe,项目名称:aulinhas-spoj-br,代码行数:3,代码来源:cercamg.cpp


示例16: printPointColor

void fill_t::printPointColor(point_t p){
	std::cout<<"COLOR "<<colorArray[(int)p.getX()][(int)p.getY()].getR()<<std::endl;
}
开发者ID:Rahul-Singhal,项目名称:MyPaint,代码行数:3,代码来源:fill_t.cpp


示例17: getNumExamples

void TrainingData::addNegativeSamples(const std::vector<std::string> &filenamesBackground,
                                      const point_t &modelWindowSize, const point_t &dataOffset,
                                      const size_t numNegativeSamplesToAdd)
{

    const size_t
            initialNumberOfTrainingSamples = getNumExamples(),
            finalNumberOfTrainingSamples = initialNumberOfTrainingSamples + numNegativeSamplesToAdd;
    if(finalNumberOfTrainingSamples > getMaxNumExamples())
    {
        throw std::runtime_error("TrainingData::addNegativeSamples is trying to add more data than initially specified");
    }

    printf("\nCollecting %zi random negative samples\n", numNegativeSamplesToAdd);
    boost::progress_display progress_indicator(numNegativeSamplesToAdd);

    meta_datum_t  metaDatum;
    integral_channels_t sampleIntegralChannels;

#if defined(DEBUG)
    srand(1);
#else
    srand(time(NULL));
#endif
    srand(1);

    const int samplesPerImage = std::max<int>(1, numNegativeSamplesToAdd / filenamesBackground.size());

    // FIXME no idea what the +1 does
    const int
            minWidth = (modelWindowSize.x()+1 + 2*dataOffset.x()),
            minHeight = (modelWindowSize.y()+1 + 2*dataOffset.y());

    const float maxSkippedFraction = 0.25;

    size_t numNegativesSamplesAdded = 0, numSkippedImages = 0, filenameIndex = 0;

    // integralChannelsComputer is already multithreaded, so no benefit on paralelizing this for loop
    while (numNegativesSamplesAdded < numNegativeSamplesToAdd)
    {
        if (filenameIndex >= filenamesBackground.size())
        {
            // force to loop until we have reached the desired number of samples
            filenameIndex = 0;
        }

        const string &filename = filenamesBackground[filenameIndex];
        filenameIndex +=1;

        gil::rgb8c_view_t imageView;
        gil::rgb8_image_t image;
        imageView = doppia::open_image(filename.c_str(), image);

        if ((imageView.width() < minWidth) or (imageView.height() < minHeight))
        {
            // if input image is too small, we skip it
            //printf("Skipping negative sample %s, because it is too small\n", filename.c_str());
            numSkippedImages += 1;

            const float skippedFraction = static_cast<float>(numSkippedImages) / filenamesBackground.size();
            if (skippedFraction > maxSkippedFraction)
            {
                printf("Skipped %i images (out of %zi, %.3f%%) because they where too small\n",
                       numSkippedImages, filenamesBackground.size(), skippedFraction*100);

                throw std::runtime_error("Too many negatives images where skipped. Dataset needs to be fixed");
            }
            continue;
        }

        const int
                maxRandomX = (imageView.width() - modelWindowSize.x()+1 - 2*dataOffset.x()),
                maxRandomY = (imageView.height() - modelWindowSize.y()+1 - 2*dataOffset.y());

        _integralChannelsComputer.set_image(imageView);
        _integralChannelsComputer.compute();

        metaDatum.filename = filename;
        metaDatum.imageClass = _backgroundClassLabel;

        size_t numSamplesForImage = std::min<size_t>(samplesPerImage,
                                                           (numNegativeSamplesToAdd - numNegativesSamplesAdded));
                numSamplesForImage = 1;
        for (size_t randomSampleIndex = 0; randomSampleIndex < numSamplesForImage; randomSampleIndex += 1)
        {
            //const point_t::coordinate_t
            size_t
			x = dataOffset.x() + rand() % maxRandomX, 
				  y = dataOffset.y() + rand() % maxRandomY;
            //printf("random x,y == %i, %i\n", x,y);
                        const point_t randomOffset(x,y);
            metaDatum.x = randomOffset.x(); metaDatum.y = randomOffset.y();
            get_integral_channels(_integralChannelsComputer.get_integral_channels(),
                                  modelWindowSize, randomOffset, _integralChannelsComputer.get_shrinking_factor(),
                                  sampleIntegralChannels);

            setDatum(initialNumberOfTrainingSamples + numNegativesSamplesAdded,
                     metaDatum, sampleIntegralChannels);

            numNegativesSamplesAdded += 1;
//.........这里部分代码省略.........
开发者ID:mdqyy,项目名称:main_demo_cmake,代码行数:101,代码来源:TrainingData.cpp


示例18: get_num_examples

void TrainingData::addNegativeSamples(const std::vector<std::string> &filenamesBackground,
                                      const point_t &modelWindowSize, const point_t &dataOffset,
                                      const size_t numNegativeSamplesToAdd)
{

    int feature_extraction_time = 0, image_loading_time = 0, tmp_time;

    const size_t
            initialNumberOfTrainingSamples = get_num_examples(),
            finalNumberOfTrainingSamples = initialNumberOfTrainingSamples + numNegativeSamplesToAdd;
    if(finalNumberOfTrainingSamples > getMaxNumExamples())
    {
        throw std::runtime_error("TrainingData::addNegativeSamples is trying to add more data than initially specified");
    }

    printf("\nCollecting %zi random negative samples\n", numNegativeSamplesToAdd);
    doppia::progress_display_with_eta progress_indicator(numNegativeSamplesToAdd);

    meta_datum_t  metaDatum;
    integral_channels_t sampleIntegralChannels;

#if defined(DEBUG)
    srand(1);
#else
    srand(time(NULL));
#endif
    srand(1);

    const int samplesPerImage = std::max<int>(1, numNegativeSamplesToAdd / filenamesBackground.size());

    // FIXME no idea what the +1 does
    const int
            minWidth = (modelWindowSize.x()+1 + 2*dataOffset.x()),
            minHeight = (modelWindowSize.y()+1 + 2*dataOffset.y());

    const float maxSkippedFraction = 0.25;

    size_t numNegativesSamplesAdded = 0, numSkippedImages = 0, filenameIndex = 0;

    // integralChannelsComputer is already multithreaded, so no benefit on paralelizing this for loop
    while (numNegativesSamplesAdded < numNegativeSamplesToAdd)
    {
        if (filenameIndex >= filenamesBackground.size())
        {
            // force to loop until we have reached the desired number of samples
            filenameIndex = 0;
        }
        const string &background_image_path = filenamesBackground[filenameIndex];
        filenameIndex +=1;

        gil::rgb8c_view_t imageView;
        gil::rgb8_image_t image;
//tmp_time = (int)round(omp_get_wtime());
        imageView = doppia::open_image(background_image_path.c_str(), image);
//image_loading_time += (int)round(omp_get_wtime()) - tmp_time;

        if ((imageView.width() < minWidth) or (imageView.height() < minHeight))
        {
            // if input image is too small, we skip it
            //printf("Skipping negative sample %s, because it is too small\n", filename.c_str());
            numSkippedImages += 1;

            const float skippedFraction = static_cast<float>(numSkippedImages) / filenamesBackground.size();
            if (skippedFraction > maxSkippedFraction)
            {
                printf("Skipped %zi images (out of %zi, %.3f%%) because they where too small (or too big to process)\n",
                       numSkippedImages, filenamesBackground.size(), skippedFraction*100);

                throw std::runtime_error("Too many negatives images where skipped. Dataset needs to be fixed");
            }
            continue;
        }

        const int
                maxRandomX = (imageView.width() - modelWindowSize.x()+1 - 2*dataOffset.x()),
                maxRandomY = (imageView.height() - modelWindowSize.y()+1 - 2*dataOffset.y());

        try
        {
            // FIXME harcoded values
            const size_t
                    expected_channels_size = imageView.size()*10,
                    max_texture_size = 134217728; // 2**27 for CUDA capability 2.x
            if(expected_channels_size > max_texture_size)
            {
                throw std::invalid_argument("The image is monstruously big!");
            }

            const boost::filesystem::path file_path = background_image_path;
#if BOOST_VERSION <= 104400
            const std::string filename = file_path.filename();
#else
            const std::string filename = file_path.filename().string();
#endif
tmp_time = (int)round(omp_get_wtime());
            _integralChannelsComputer->set_image(imageView, filename);
image_loading_time += (int)round(omp_get_wtime()) - tmp_time;
tmp_time = (int)round(omp_get_wtime());
            _integralChannelsComputer->compute();
feature_extraction_time += (int)round(omp_get_wtime()) - tmp_time;
//.........这里部分代码省略.........
开发者ID:Belial2010,项目名称:Pedestrian-Detection-Project,代码行数:101,代码来源:TrainingData.cpp


示例19: extract_y

inline int
extract_y( const point_t& pt ) {
    return pt.get_y();
}
开发者ID:venkatarajasekhar,项目名称:tortuga,代码行数:4,代码来源:properties.hpp


示例20: mesh

  // volume evaluation with partial derivatives
  /* virtual */ void operator()(
      /* pointer to first point in rowwise control point grid */
      const_point_iterator points, /* order in u dir */
      std::size_t order_u,         /* order in v dir */
      std::size_t order_v,         /* order in w dir */
      std::size_t order_w,         /* u-parameter for point to evaluate */
      value_type u,                /* v-parameter for point to evaluate */
      value_type v,                /* w-parameter for point to evaluate */
      value_type w,                /* resulting point at [u,v,w] */
      point_t& point, /* first partial derivative in u at [u,v,w] */
      point_t& du,    /* first partial derivative in v at [u,v,w] */
      point_t& dv,    /* first partial derivative in w at [u,v,w] */
      point_t& dw) const {
    pointmesh3d<point_t> mesh(points,
                              points + order_u * order_v * order_w,
                              order_u,
                              order_v,
                              order_w);

    // transform control points to homogenous space
    std::for_each(
        mesh.begin(), mesh.end(), std::mem_fn(&point_t::project_to_homogenous));

    // first decasteljau in u direction until only u-linear volume is left for u
    for (std::size_t jv = 0; jv != order_v; ++jv) {
      for (std::size_t jw = 0; jw != order_w; ++jw) {
        for (std::size_t i = 0; i != order_u - 2; ++i) {
          for (std::size_t j = 0; j != order_u - 1 - i; ++j) {
            mesh(j, jv, jw) =
                (value_type(1) - u) * mesh(j, jv, jw) + u * mesh(j + 1, jv, jw);
          }
        }
      }
    }

    // secondly decasteljau in v direction until only uv-linear volume is left
    for (std::size_t ju = 0; ju != 2; ++ju) {
      for (std::size_t jw = 0; jw != order_w; ++jw) {
        for (std::size_t i = 0; i != order_v - 2; ++i) {
          for (std::size_t j = 0; j != order_v - 1 - i; ++j) {
            mesh(ju, j, jw) =
                (value_type(1) - v) * mesh(ju, j, jw) + v * mesh(ju, j + 1, jw);
          }
        }
      }
    }

    // thirdly decasteljau until only trilinear volume is left
    for (std::size_t ju = 0; ju != 2; ++ju) {
      for (std::size_t jv = 0; jv != 2; ++jv) {
        for (std::size_t i = 0; i != order_w - 2; ++i) {
          for (std::size_t j = 0; j != order_w - 1 - i; ++j) {
            mesh(ju, jv, j) =
                (value_type(1) - w) * mesh(ju, jv, j) + w * mesh(ju, jv, j + 1);
          }
        }
      }
    }

    // evaluate for u leaving a linear patch dependending on v,w
    point_t vw00 = (value_type(1) - u) * mesh(0, 0, 0) + u * mesh(1, 0, 0);
    point_t vw10 = (value_type(1) - u) * mesh(0, 1, 0) + u * mesh(1, 1, 0);
    point_t vw01 = (value_type(1) - u) * mesh(0, 0, 1) + u * mesh(1, 0, 1);
    point_t vw11 = (value_type(1) - u) * mesh(0, 1, 1) + u * mesh(1, 1, 1);

    // evaluate for v leaving a linear patch dependending on u,w
    point_t uw00 = (value_type(1) - v) * mesh(0, 0, 0) + v * mesh(0, 1, 0);
    point_t uw10 = (value_type(1) - v) * mesh(1, 0, 0) + v * mesh(1, 1, 0);
    point_t uw01 = (value_type(1) - v) * mesh(0, 0, 1) + v * mesh(0, 1, 1);
    point_t uw11 = (value_type(1) - v) * mesh(1, 0, 1) + v * mesh(1, 1, 1);

    // evaluating v,w plane for v resulting in last linear interpolation in w ->
    // to compute first partial derivative in w
    point_t w0 = (value_type(1) - v) * vw00 + v * vw10;
    point_t w1 = (value_type(1) - v) * vw01 + v * vw11;

    // evaluating v,w plane for w resulting in last linear interpolation in v ->
    // to compute first partial derivative in v
    point_t v0 = (value_type(1) - w) * vw00 + w * vw01;
    point_t v1 = (value_type(1) - w) * vw10 + w * vw11;

    // evaluating v,w plane for w resulting in last linear interpolation in v ->
    // to compute first partial derivative in v
    point_t u0 = (value_type(1) - w) * uw00 + w * uw01;
    point_t u1 = (value_type(1) - w) * uw10 + w * uw11;

    // last interpolation and back projection to euclidian space
    point = (value_type(1) - w) * w0 + w * w1;
    point.project_to_euclidian();

    // M.S. Floater '91 :
    //
    //             w[0]{n-1}(t) * w[1]{n-1}(t)
    // P'(t) = n * --------------------------- * P[1]{n-1}(t) - P[0]{n-1}(t)
    //                     w[0]{n})^2
    //
    // 1. recalculate overwritten helping point P[0, n-1]
    // 2. project P[0, n-1] and P[1, n-1] into plane w=1
    // 3. use formula above to find out the correct length of P'(t)
//.........这里部分代码省略.........
开发者ID:4og,项目名称:guacamole,代码行数:101,代码来源:decasteljau.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ point_type类代码示例发布时间:2022-05-31
下一篇:
C++ point_symbolizer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap