cv::Mat preProcess(const cv::Mat& image)
{
        cv::Mat pp_image = segmentByColor(image);
        removeNoise(&pp_image);

        cv::GaussianBlur(pp_image, pp_image, cv::Size(9, 9), 2);

        return pp_image;
}
Пример #2
0
 bool isPalindrome(string s) {
     s = removeNoise(s);
     for(int i=0; i<s.size()/2; i++){
         if (s[i]!= s[s.size()-i-1]){
             return false;
         }
     }
     return true;
 }
void kpoAnalyzerThread::operator ()()
{
    std::cout << "cloud has " << scene_cloud_->size() << " points" << std::endl;

    Cloud cleanCloud;
    removeNoise(scene_cloud_, cleanCloud);
    pcl::copyPointCloud(cleanCloud, *scene_cloud_);


    std::cout << "filtered cloud has " << scene_cloud_->size() << " points" << std::endl;
/*
    if (scene_cloud_->size() < 25) {
        std::cout << "cloud too small" << std::endl;
        return;
    }
/*
    if (scene_cloud_->size() > 40000) {
        std::cout << "cloud too large" << std::endl;
        return;
    }
*/
    NormalCloud::Ptr scene_normals_(new NormalCloud());
    estimateNormals(scene_cloud_, scene_normals_);

    Cloud::Ptr scene_keypoints_(new Cloud());
    downSample(scene_cloud_, scene_keypoints_);

    DescriptorCloud::Ptr scene_descriptors_(new DescriptorCloud());
    computeShotDescriptors(scene_cloud_, scene_keypoints_, scene_normals_, scene_descriptors_);

    RFCloud::Ptr scene_refs_(new RFCloud());
    estimateReferenceFrames(scene_cloud_, scene_normals_, scene_keypoints_, scene_refs_);

    kpoCloudDescription od;
    od.cloud = *scene_cloud_;
    od.keypoints = *scene_keypoints_;
    od.normals = *scene_normals_;
    od.descriptors = *scene_descriptors_;
    od.reference_frames = *scene_refs_;

    od.filename = filename;
    od.object_id = object_id;

    callback_(od);
}
Пример #4
0
std::string letterRecognition(cv::Mat image){
	std::string letters[27] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "*" };
	cv::Mat imgDivide = image.clone();
	imgDivide = removeNoise(image);
	imgDivide = resizeImage(imgDivide);
	int letterInt = compareHistograms(imgDivide);
	//make sure its an M or an N
	if (letterInt == 13 && image.cols >= 55){
		return "M";
	}
	else if (letterInt == 12 && image.cols < 55){
		return "N";
	}
	if (letterInt == 1337)
	{
		return "Error";
	}
	return letters[letterInt];
}