示例#1
0
    void MergeGroup::addImage(view_type const& image)
    {
        if (image.width() != width_ || image.height() != height_)
        {
            throw std::invalid_argument("Dimensions of image passed in differ to others in the sequence.");
        }

        if (pyramids_.size() == groupSize_)
        {
            throw std::invalid_argument("Group already contains enough images to fuse. Cannot add another.");
        }

        // TODO: do quality mask here, then create pyramid from Pending image

        // which image in the group is this
        size_t imageNum = pyramids_.size();

        // create subviews from arena for a single pyramid
        std::vector< view_type > subviews;
        for (auto& fuseView : fuseViews_)
        {
            subviews.push_back(fuseView[imageNum]);
        }

        // transfer input image into first level of pyramid
        std::copy(image.begin(), image.end(), subviews.front().begin());

        std::cout << "========================\n"
                     "Creating Pyramid.\n"
                     "========================"
                  << std::endl;
        ImagePyramid pyramid(context_, std::move(subviews),
                [=](Pending2DImage const& im)
                {
                    return createPyramidLevel(im, program_);
                });

        pyramids_.push_back(std::move(pyramid));
    }
示例#2
0
int main()
{
	typedef float channel_type;

	typedef mizuiro::image::format<
		mizuiro::image::dimension<
			3
		>,
		mizuiro::image::interleaved<
			mizuiro::color::homogenous<
				channel_type,
				mizuiro::color::layout::rgba
			>
		>
	> format;

	typedef mizuiro::image::store<
		format,
		mizuiro::access::raw
	> store;

	store img(
		store::dim_type(
			100,
			100,
			100	
		)
	);

	typedef store::view_type view_type;

	typedef view_type::bound_type bound_type;

	// TODO: create an algorithm for this!
	{
		view_type const view(
			img.view()
		);

		typedef view_type::dim_type dim_type;

		typedef dim_type::size_type size_type;

		dim_type const dim(
			img.view().dim()
		);

		for(size_type x = 0; x < dim[0]; ++x)
			for(size_type y = 0; y < dim[1]; ++y)
				for(size_type z = 0; z < dim[2]; ++z)
					view[
						dim_type(
							x,
							y,
							z
						)
					]
					= mizuiro::color::object<
						format::color_format
					>(
						(mizuiro::color::init::red = static_cast<channel_type>(x))
						(mizuiro::color::init::green = static_cast<channel_type>(y))
						(mizuiro::color::init::blue = static_cast<channel_type>(z))
						(mizuiro::color::init::alpha = static_cast<channel_type>(255))
					);
	}

	std::cout << '\n';

	view_type const sub_view(
		mizuiro::image::sub_view(
			img.view(),
			bound_type(
				bound_type::dim_type(
					1,
					1,
					1
				),
				bound_type::dim_type(
					3,
					4,
					3	
				)
			)
		)
	);

	std::cout
		<< "sub image (with pitch "
		<< sub_view.pitch()
		<< ")\n";


	view_type const sub_sub_view(
		mizuiro::image::sub_view(
			sub_view,
			bound_type(
				bound_type::dim_type(
					1,	
					1,
					1
				),
				bound_type::dim_type(
					2,
					3,
					2
				)
			)
		)
	);

	std::cout
		<< "sub sub image (with pitch "
		<< sub_sub_view.pitch()
		<< ")\n";

	mizuiro::image::algorithm::print(
		std::cout,
		sub_sub_view
	);

	std::cout << '\n';

	{
		typedef std::reverse_iterator<
			view_type::iterator
		> reverse_iterator;

		for(
			reverse_iterator it(
				sub_sub_view.end()
			);
			it != reverse_iterator(sub_sub_view.begin());
			++it
		)
			std::cout << *it << ' ';
	}

	std::cout << '\n';
}
示例#3
0
//
// This function inserts "Clones" into the
// the view. 
//
// We need to pass the first argument
// as a non-const reference to be able to store
// 'T*' instead of 'const T*' objects. Alternatively,
// we might change the declaration of the 'view_type'
// to 
//     typedef boost::ptr_vector<const photon,boost::view_clone_manager> 
//               view_type;     ^^^^^^
//
void insert( vector_type& from, view_type& to )
{
        to.insert( to.end(), 
                   from.begin(),
                   from.end() );
}