Esempio n. 1
0
/*object *my_alg_level3(unsigned char *image, int width, int height, int *n_object)*/
object *my_alg_level3(unsigned char *image,  unsigned char *mask, int width, int height, int *n_object)
{
/*********************************MYCODE*********************************/


	unsigned int width_sub = 0, height_sub = 0;
	create_sub_images(image, width, height, &width_sub, &height_sub);

	/*export_ppm_subimages(3, width, height, width_sub, height_sub);*/

	calculate_histogram(3, width, height, width_sub, height_sub);

	calculate_threshold(width, height, width_sub, height_sub);

	calculate_threshold_with_interpolation(0, width, height, width_sub, height_sub);

	final_stage(width, height, width_sub, height_sub);

	/*free_mem_subimages(width, height, width_sub, height_sub);*/
	/*********************************MYCODE*********************************/
/*
transform_1D_to_2D_RGB(image, width, height);
allocate_mem_data_CIELAB(width, height);
convert_RGB_to_CIELAB(width, height);
unsigned int max_grad = 0;
first_derivative_CIELAB(0, width, height, &max_grad);
calculate_histogram_of_gradient(width, height, max_grad);
histogram_analysis(width, height, max_grad);

return NULL;
*/
return NULL;/*baseline(image, mask, width, height, n_object);*/
}
Esempio n. 2
0
object *my_alg_level1(unsigned char *image, unsigned char *mask, int width, int height, int *n_object)
{

	/*********************************MYCODE*********************************/


	unsigned int width_sub = 0, height_sub = 0;
	create_sub_images(image, width, height, &width_sub, &height_sub);
/*
	export_ppm_subimages(3, width, height, width_sub, height_sub);
*/
	calculate_histogram(3, width, height, width_sub, height_sub);

	calculate_threshold(width, height, width_sub, height_sub);

	calculate_threshold_with_interpolation(0, width, height, width_sub, height_sub);

	final_stage(width, height, width_sub, height_sub);

	/*free_mem_subimages(width, height, width_sub, height_sub);*/
	/*********************************MYCODE*********************************/


	return NULL/*baseline(image, mask, width, height, n_object)*/;
}
Esempio n. 3
0
/*object *my_alg_level2(unsigned char *image, int width, int height, int *n_object)*/
object *my_alg_level2(unsigned char *image,  unsigned char *mask, int width, int height, int *n_object) 
{
/*********************************MYCODE*********************************/


	unsigned int width_sub = 0, height_sub = 0;
	create_sub_images(image, width, height, &width_sub, &height_sub);

	/*export_ppm_subimages(3, width, height, width_sub, height_sub);*/


	calculate_histogram(3, width, height, width_sub, height_sub);

	calculate_threshold(width, height, width_sub, height_sub);

	calculate_threshold_with_interpolation(0, width, height, width_sub, height_sub);

	final_stage(width, height, width_sub, height_sub);

	/*free_mem_subimages(width, height, width_sub, height_sub);*/
	/*********************************MYCODE*********************************/
/*
transform_1D_to_2D(image, width, height);

export_ppm_from_2D(3, width, height);

convert_to_greyscale(width, height);
noise_reduction(width, height);
export_ppm_from_2D(4, width, height);

Sobel_operator(3, width,height);
non_maximum_suppression(width, height);
int high = 0, low = 0;
calculate_thresholds(width, height, &high, &low);
printf("l:%d h:%d\n", low, high);

hysteresis_thresholding(width, height, high, low);
export_ppm_from_2D(4, width, height);

return NULL;
*/

return NULL;/*baseline(image, mask, width, height, n_object);*/
}
Esempio n. 4
0
Stage* Translate::makeReader(Options readerOptions)
{

    if (isDebug())
    {
        readerOptions.add<bool>("debug", true);
        boost::uint32_t verbosity(getVerboseLevel());
        if (!verbosity)
            verbosity = 1;
        
        readerOptions.add<boost::uint32_t>("verbose", verbosity);
        readerOptions.add<std::string>("log", "STDERR");
    }


    Stage* reader_stage = AppSupport::makeReader(readerOptions);
    
    Stage* final_stage(0);
    if (!m_bounds.empty() || !m_wkt.empty() || !m_output_srs.empty())
    {
        Stage* next_stage = reader_stage;
        
        Stage* crop_stage(0);
        Stage* reprojection_stage(0);

        if (!m_output_srs.empty())
        {
            readerOptions.add<std::string >("out_srs", m_output_srs.getWKT());

            boost::char_separator<char> sep(SEPARATORS);
            std::vector<double> offsets;
            tokenizer off_tokens(m_offsets, sep);
            for (tokenizer::iterator t = off_tokens.begin(); t != off_tokens.end(); ++t) {
                offsets.push_back(boost::lexical_cast<double>(*t));
            }

            std::vector<double> scales;
            tokenizer scale_tokens(m_scales, sep);
            for (tokenizer::iterator t = scale_tokens.begin(); t != scale_tokens.end(); ++t) {
                scales.push_back(boost::lexical_cast<double>(*t));
            }
            
            if (scales.size())
            {
                if (scales.size() <= 1)
                {
                    readerOptions.add<double >("scale_x", scales[0]);
                    
                }
                else if (scales.size() <= 2)
                {
                    readerOptions.add<double >("scale_x", scales[0]);
                    readerOptions.add<double >("scale_y", scales[1]);
                }
                else if (scales.size() <= 3)
                {
                    readerOptions.add<double >("scale_x", scales[0]);
                    readerOptions.add<double >("scale_y", scales[1]);
                    readerOptions.add<double >("scale_z", scales[2]);
                }
            }

            if (offsets.size())
            {
                if (offsets.size() <= 1)
                {
                    readerOptions.add<double >("offset_x", offsets[0]);
                    
                }
                else if (offsets.size() <= 2)
                {
                    readerOptions.add<double >("offset_x", offsets[0]);
                    readerOptions.add<double >("offset_y", offsets[1]);
                }
                else if (offsets.size() <= 3)
                {
                    readerOptions.add<double >("offset_x", offsets[0]);
                    readerOptions.add<double >("offset_y", offsets[1]);
                    readerOptions.add<double >("offset_z", offsets[2]);
                }
            }
            reprojection_stage = new pdal::filters::InPlaceReprojection(*next_stage, readerOptions);
            next_stage = reprojection_stage;
        }
        
        if (!m_bounds.empty() && m_wkt.empty())
        {
            readerOptions.add<pdal::Bounds<double> >("bounds", m_bounds);
            crop_stage = new pdal::filters::Crop(*next_stage, readerOptions);
            next_stage = crop_stage;
        } 
        else if (m_bounds.empty() && !m_wkt.empty())
        {
            std::istream* wkt_stream;
            try
            {
                wkt_stream = FileUtils::openFile(m_wkt);
                std::stringstream buffer;
                buffer << wkt_stream->rdbuf();

                m_wkt = buffer.str();
                FileUtils::closeFile(wkt_stream);
                
            } catch (pdal::pdal_error const&)
            {
                // If we couldn't open the file given in m_wkt because it 
                // was likely actually wkt, leave it alone
            }
            readerOptions.add<std::string >("polygon", m_wkt);
            crop_stage = new pdal::filters::Crop(*next_stage, readerOptions);
            next_stage = crop_stage;
        }
        
        final_stage = next_stage;
    }

    if (final_stage == 0) 
        final_stage = reader_stage;
    
    return final_stage;    

}