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


C++ point_t::x方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: QuasiEqual

bool operator ==(const point_t& a, const point_t& b)
{
	return QuasiEqual(a.x(), b.x(), margin) && QuasiEqual(a.y(), b.y(), margin) && QuasiEqual(a.z(), b.z(), margin);
}
开发者ID:,项目名称:,代码行数:4,代码来源:

示例6: addNegativeSamples

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

示例7: addHardNegativeSamples

void TrainingData::addHardNegativeSamples(const std::vector<std::string> &filenamesHardNegatives,
                                          const point_t &modelWindowSize, const point_t &dataOffset)
{
    int feature_extraction_time = 0, image_loading_time = 0, tmp_time;

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


    printf("\nCollecting %zi hard negative samples\n", filenamesHardNegatives.size());
    doppia::progress_display_with_eta progress_indicator(filenamesHardNegatives.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 < filenamesHardNegatives.size(); filenameIndex +=1)
    {
        tmp_time = (int)round(omp_get_wtime());
        gil::rgb8_image_t image;
        gil::rgb8c_view_t image_view = doppia::open_image(filenamesHardNegatives[filenameIndex].c_str(), image);

        const boost::filesystem::path file_path = filenamesHardNegatives[filenameIndex];
#if BOOST_VERSION <= 104400
        const std::string filename = file_path.filename();
#else
        const std::string filename = file_path.filename().string();
#endif
        _integralChannelsComputer->set_image(image_view, 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;

        get_integral_channels(_integralChannelsComputer->get_integral_channels(),
                              modelWindowSize, dataOffset, doppia::IntegralChannelsForPedestrians::get_shrinking_factor(),
                              sampleIntegralChannels);

        metaDatum.filename = filenamesHardNegatives[filenameIndex];
        metaDatum.imageClass = _backgroundClassLabel;
        metaDatum.x = dataOffset.x();
        metaDatum.y = dataOffset.y();

        setDatum(initialNumberOfTrainingSamples + filenameIndex, metaDatum, sampleIntegralChannels);

        ++progress_indicator;
    } // end of "for each filename"
    printf("Time elapsed while loading images for hard negatives extraction: %02d:%02d:%02d\n",
           image_loading_time/3600, (image_loading_time%3600)/60, image_loading_time%60);
    printf("Time elapsed while extracting features from hard negatives: %02d:%02d:%02d\n",
           feature_extraction_time/3600, (feature_extraction_time%3600)/60, feature_extraction_time%60);

    return;
}
开发者ID:Belial2010,项目名称:Pedestrian-Detection-Project,代码行数:61,代码来源:TrainingData.cpp

示例8: addNegativeSamples

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

示例9:

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


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