<commit_before>/******************************************************************************
 * BRICS_3D - 3D Perception and Modeling Library
 * Copyright (c) 2011, GPS GmbH
 *
 * Author: <NAME>
 *
 *
 * This software is published under a dual-license: GNU Lesser General Public
 * License LGPL 2.1 and Modified BSD license. The dual-license implies that
 * users of this code may choose which terms they prefer.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License LGPL and the BSD license for
 * more details.
 *
 ******************************************************************************/
#include "util/PCLTypecaster.h"
#include "core/ColorSpaceConvertor.h"

#include <pcl/segmentation/extract_clusters.h>
#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>

#include "RGBColorBasedEuclideanClustering.h"

namespace BRICS_3D {

RGBColorBasedEuclideanClustering::RGBColorBasedEuclideanClustering() {
	// TODO Auto-generated constructor stub

}

RGBColorBasedEuclideanClustering::~RGBColorBasedEuclideanClustering() {
	// TODO Auto-generated destructor stub
}


int RGBColorBasedEuclideanClustering::getMaxClusterSize() const
    {
        return maxClusterSize;
    }

    int RGBColorBasedEuclideanClustering::getMinClusterSize() const
    {
        return minClusterSize;
    }

    double RGBColorBasedEuclideanClustering::getToleranceEuclideanDistance() const
    {
        return toleranceEuclideanDistance;
    }

    double RGBColorBasedEuclideanClustering::getToleranceRgbSpace() const
    {
        return toleranceRGBSpace;
    }

    void RGBColorBasedEuclideanClustering::setMaxClusterSize(int maxClusterSize)
    {
        this->maxClusterSize = maxClusterSize;
    }

    void RGBColorBasedEuclideanClustering::setMinClusterSize(int minClusterSize)
    {
        this->minClusterSize = minClusterSize;
    }

    void RGBColorBasedEuclideanClustering::setToleranceEuclideanDistance(double toleranceEuclideanDistance)
    {
        this->toleranceEuclideanDistance = toleranceEuclideanDistance;
    }

    void RGBColorBasedEuclideanClustering::setToleranceRgbSpace(double toleranceRgbSpace)
    {
        toleranceRGBSpace = toleranceRgbSpace;
    }

    int RGBColorBasedEuclideanClustering::segment()
    {
        assert (this->inputPointCloud!=NULL || this->inputPointCloudColored!=NULL);
        if(!isColoredInput){
            return 0;
        }else{
            extractClusters(this->inputPointCloudColored);

            return 1;
        }
    }

    void RGBColorBasedEuclideanClustering::extractClusters(BRICS_3D::ColoredPointCloud3D *inCloud)
    {
        BRICS_3D::PCLTypecaster pclTypecaster;
        pcl::PointCloud<pcl::PointXYZ>::Ptr inputXYZ(new pcl::PointCloud<pcl::PointXYZ>());
        pcl::PointCloud<pcl::PointXYZRGB>::Ptr inputXYZRGB(new pcl::PointCloud<pcl::PointXYZRGB>());

        pclTypecaster.convertToPCLDataType(inputXYZ, inCloud);
        pclTypecaster.convertToPCLDataType(inputXYZRGB, inCloud);
<commit_msg>minor edit<commit_after>/******************************************************************************
 * BRICS_3D - 3D Perception and Modeling Library
 * Copyright (c) 2011, GPS GmbH
 *
 * Author: <NAME>
 *
 *
 * This software is published under a dual-license: GNU Lesser General Public
 * License LGPL 2.1 and Modified BSD license. The dual-license implies that
 * users of this code may choose which terms they prefer.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License LGPL and the BSD license for
 * more details.
 *
 ******************************************************************************/
#include "util/PCLTypecaster.h"
#include "core/ColorSpaceConvertor.h"

#include <pcl/segmentation/extract_clusters.h>
#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>

#include "RGBColorBasedEuclideanClustering.h"

namespace BRICS_3D {

RGBColorBasedEuclideanClustering::RGBColorBasedEuclideanClustering() {
	// TODO Auto-generated constructor stub

}

RGBColorBasedEuclideanClustering::~RGBColorBasedEuclideanClustering() {
	// TODO Auto-generated destructor stub
}


int RGBColorBasedEuclideanClustering::getMaxClusterSize() const
    {
        return maxClusterSize;
    }

    int RGBColorBasedEuclideanClustering::getMinClusterSize() const
    {
        return minClusterSize;
    }

    double RGBColorBasedEuclideanClustering::getToleranceEuclideanDistance() const
    {
        return toleranceEuclideanDistance;
    }

    double RGBColorBasedEuclideanClustering::getToleranceRgbSpace() const
    {
        return toleranceRGBSpace;
    }

    void RGBColorBasedEuclideanClustering::setMaxClusterSize(int maxClusterSize)
    {
        this->maxClusterSize = maxClusterSize;
    }

    void RGBColorBasedEuclideanClustering::setMinClusterSize(int minClusterSize)
    {
        this->minClusterSize = minClusterSize;
    }

    void RGBColorBasedEuclideanClustering::setToleranceEuclideanDistance(double toleranceEuclideanDistance)
    {
        this->toleranceEuclideanDistance = toleranceEuclideanDistance;
    }

    void RGBColorBasedEuclideanClustering::setToleranceRgbSpace(double toleranceRgbSpace)
    {
        toleranceRGBSpace = toleranceRgbSpace;
    }

    int RGBColorBasedEuclideanClustering::segment()
    {
        assert (this->inputPointCloud!=NULL || this->inputPointCloudColored!=NULL);
        if(!isColoredInput){
            return 0;
        }else{
            extractClusters(this->inputPointCloudColored);

            return 1;
        }
    }

    void RGBColorBasedEuclideanClustering::extractClusters(BRICS_3D::ColoredPointCloud3D *inCloud)
    {
    	this->extractedClusters.clear();
        BRICS_3D::PCLTypecaster pclTypecaster;
        pcl::PointCloud<pcl::PointXYZ>::Ptr inputXYZ(new pcl::PointCloud<pcl::PointXYZ>());
        pcl::PointCloud<pcl::PointXYZRGB>::Ptr inputXYZRGB(new pcl::PointCloud<pcl::PointXYZRGB>());

        pclTypecaster.convertToPCLDataType(inputXYZ, inCloud);
        pclTypecaster.convertToPCLDataType(inputXYZRGB, inCloud);

{'fraction_non_alphanumeric': 0.1287633163501621, 'fraction_numerical': 0.004631773969430292, 'mean_word_length': 4.362582781456954, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5935474', 'n_tokens_mistral': 2049, 'n_tokens_neox': 1815, 'n_words': 372}