Example #1
0
void box_blur_rgba( const const_image_view_t& src, const image_view_t& dst, float hradius, float vradius, int iters)
{
    if( hradius == 0 && vradius == 0)
    {
		boost::gil::copy_pixels( src, dst);
		return;
    }

	image_t buffer( src.height(), src.width());
	box_blur_rgba_( src, boost::gil::view( buffer), dst, hradius, vradius, iters);
}
Example #2
0
void box_blur_rgba( const const_image_view_t& src, const image_view_t& tmp, const image_view_t& dst, float hradius, float vradius, int iters)
{
	RAMEN_ASSERT( src.width() == tmp.height());
	RAMEN_ASSERT( src.height() == tmp.width());
	
    if( hradius == 0 && vradius == 0)
    {
		boost::gil::copy_pixels( src, dst);
		return;
    }

	box_blur_rgba_( src, tmp, dst, hradius, vradius, iters);	
}
Example #3
0
void smart_blur_rgba( const const_image_view_t& src, const image_view_t& tmp, const image_view_t& dst, 
					  float stddevx, float stddevy, float thereshold)
{
	// create kernel here
	int sizex = (int)( stddevx * 6 + 1) | 1;
	if( sizex == 1) sizex = 3;
	
	int sizey = (int)( stddevy * 6 + 1) | 1;
	if( sizey == 1) sizey = 3;
	
	float *kernel = new float[ std::max( sizex, sizey)];
	
	make_gauss_kernel( kernel, sizex, stddevx);
    tbb::parallel_for( tbb::blocked_range<std::size_t>( 0, src.height()),
					   smart_blur_fn( src, tmp, thereshold, kernel, sizex), tbb::auto_partitioner());

	make_gauss_kernel( kernel, sizey, stddevy);
    tbb::parallel_for( tbb::blocked_range<std::size_t>( 0, tmp.height()),
					   smart_blur_fn( tmp, dst, thereshold, kernel, sizey), tbb::auto_partitioner());

	delete[] kernel;
}
Example #4
0
void invert_alpha( const const_image_view_t& src, const image_view_t& dst)
{
    RAMEN_ASSERT( src.width() == dst.width());
    RAMEN_ASSERT( src.height() == dst.height());
    boost::gil::tbb_transform_pixels( src, dst, detail::invert_alpha_fun());
}
Example #5
0
sampler_t::sampler_t( const const_image_view_t& src ) : src_(src)
{
    src_area_ = Imath::Box2i( Imath::V2i( 0, 0), Imath::V2i( src.width() - 1, src.height() - 1));
}
Example #6
0
void convolve33( const const_image_view_t& src, const image_view_t& dst, const Imath::M33f& k)
{
    RAMEN_ASSERT( src.dimensions() == dst.dimensions() && "convolve33: src and dst views must have the same size");
    tbb::parallel_for( tbb::blocked_range<int>( 0, dst.height()), detail::convolve33_fun( src, dst, k), tbb::auto_partitioner());
}
Example #7
0
void smart_blur_rgba( const const_image_view_t& src, const image_view_t& dst, float stddevx, float stddevy, float thereshold)
{
	image::image_t tmp( src.height(), src.width());
	smart_blur_rgba( src, boost::gil::view( tmp), dst, stddevx, stddevy, thereshold);
}