Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C++

STL like template based coding with the MMX/SSE extension

Rate me:
Please Sign up or sign in to vote.
4.76/5 (17 votes)
17 Nov 20062 min read 113.8K   669   45  
STL like template based coding with the MMX/SSE extension using OpenCV, vigra, and boost.
#ifndef GIL_WRAP_IPLIMAGE_FACTORY_HPP
#define GIL_WRAP_IPLIMAGE_FACTORY_HPP

#include "stllcv/gil_wrap_iplimage.hpp"
//#include "any_image_impl.hpp"
//#include <boost/any.hpp>

namespace stllcv {

using namespace gil;

#if 0
	template<unsigned int Depth>struct type_from_ipl_depth	{ typedef unsigned char channel_type; };
	template<>struct type_from_ipl_depth<IPL_DEPTH_8U>		{ typedef unsigned char channel_type; };
	template<>struct type_from_ipl_depth<IPL_DEPTH_8S>		{ typedef char channel_type;};
#endif



#if 0

typedef cross_vector_image_view_types
	< boost::mpl::vector<bits8,bits8s, bits16,bits16s, bits32s,bits32f, bits64f>,
       boost::mpl::vector<gray_t,bgr_t, bgra_t>,
      kInterleavedAndPlanar, 
      kNonStepOnly,						//kNonStepAndStep,
      false                            // false == mutable; true == read-only
    >::type ipl_image_views_t;
typedef  any_image_view<ipl_image_views_t> any_ipl_image_view_t;

#elif 0

	typedef cross_vector_image_types
	< boost::mpl::vector<bits8,bits8s, bits16,bits16s, bits32s,bits32f, bits64f>,
       boost::mpl::vector<gray_t,bgr_t, bgra_t>,kInterleavedAndPlanar
    >::type any_ipl_image_types;
typedef  any_image<any_ipl_image_types>  any_ipl_image_t;
typedef  any_ipl_image_t::view_t any_ipl_image_view_t;
//typedef  any_image<any_ipl_image_types>::view_t any_ipl_image_view_t;

#elif 0

typedef boost::mpl::vector<bits8> all_ipl_channels_vec_t;
//typedef boost::mpl::vector<bits8,bits8s, bits16,bits16s, bits32s,bits32f, bits64f> all_ipl_channels_vec_t;
typedef cross_vector_image_types<all_ipl_channels_vec_t,  boost::mpl::vector<gray_t,bgr_t>,     kInterleavedAndPlanar>::type any_ipl_image_types;
typedef any_image<any_ipl_image_types > any_ipl_image_t;
typedef any_ipl_image_t::view_t any_ipl_image_view_t;

#elif 0
	typedef boost::mpl::concat_vector <
		boost::mpl::vector<
		gray8_image_t, gray8s_image_t,gray16_image_t,gray16s_image_t,gray32f_image_t,
		bgr8_image_t, bgr8s_image_t,bgr16_image_t,bgr16s_image_t,bgr32f_image_t,
		bgra8_image_t, bgra8s_image_t,bgra16_image_t,bgra16s_image_t,bgra32f_image_t
				>,
		boost::mpl::vector<
		rgb8_planar_image_t, rgb8s_planar_image_t,rgb16_planar_image_t,rgb16s_planar_image_t,rgb32f_planar_image_t,
		rgba8_planar_image_t, rgba8s_planar_image_t,rgba16_planar_image_t,rgba16s_planar_image_t,rgba32f_planar_image_t
		>	
	> any_ipl_image_types;
    //any_image<any_ipl_image_types> any_ipl_image_t;
	typedef any_image<any_ipl_image_types>::view_t any_ipl_image_view_t;

#elif 1

	typedef boost::mpl::concat_vector <
		boost::mpl::vector<
		gray8_view_t, gray8s_view_t,gray16_view_t,gray16s_view_t,gray32f_view_t,
		bgr8_view_t, bgr8s_view_t,bgr16_view_t,bgr16s_view_t,bgr32f_view_t,
		bgra8_view_t, bgra8s_view_t,bgra16_view_t,bgra16s_view_t,bgra32f_view_t
		>,
		boost::mpl::vector<
		rgb8_planar_view_t,rgb8s_planar_view_t,rgb16_planar_view_t,rgb16s_planar_view_t,rgb32f_planar_view_t,
		rgba8_planar_view_t, rgba8s_planar_view_t,rgba16_planar_view_t,rgba16s_planar_view_t,rgba32f_planar_view_t
		>
	> any_ipl_image_view_types;

	typedef any_image_view<any_ipl_image_view_types> any_ipl_image_view_t;
    //any_image<any_ipl_image_types> any_ipl_image_t;
	//typedef any_image<any_ipl_image_types>::view_t any_ipl_image_view_t;

#endif


typedef  any_ipl_image_view_t any_image_view_t;

#if 0
#define IPLIMAGE IplImage
//template<typename IPLIMAGE>//=IplImage
//any_image_view_t	gil_dynamic_view_top_left_origin_from_iplimage(IPLIMAGE *  _pIplImage_ )
 any_image_view_t	gil_dynamic_view_from_iplimage(IPLIMAGE *  _pIplImage_ );
#undef IPLIMAGE
#endif



#if	1

#define IPLIMAGE IplImage
//template<typename IPLIMAGE>//=IplImage
//any_image_view_t	gil_dynamic_view_top_left_origin_from_iplimage(IPLIMAGE *  _pIplImage_ )
inline any_image_view_t	gil_dynamic_view_from_iplimage(IPLIMAGE *  _pIplImage_ )
{
	int w=_pIplImage_->width, h=_pIplImage_->height, ws=_pIplImage_->widthStep;
	char *b=_pIplImage_->imageData;
#if 1
if(_pIplImage_->origin==1 ){

	//flipped_up_down_view(
#if 1
if(_pIplImage_->dataOrder==1)
{
	if(_pIplImage_->nChannels==3 )
	{
		char *g=_pIplImage_->imageData+ws*w*h;
		char *r=_pIplImage_->imageData+ws*w*h*2;
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(char*)r,(char*)g,(char*)b,ws))));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(unsigned short*)r,(unsigned short*)g,(unsigned short*)b,ws))));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(short*)r,(short*)g,(short*)b,ws))));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(int*)r,(int*)g,(int*)b,ws))));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(float*)r,(float*)g,(float*)b,ws))));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(long double*)r,(long double*)g,(long double*)b,ws))));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(flipped_up_down_view(planar_rgb_view(w ,h,(unsigned char*)r,(unsigned char*)g,(unsigned char*)b,ws))));
	}else{
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, gray_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (gray8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));		
	}
}else
#endif
{
	if(_pIplImage_->nChannels==4 ){
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, bgra_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (bgra8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));	
	}else if(_pIplImage_->nChannels==3 ){
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, bgr_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (bgr8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));	
	}else{
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, gray_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep))));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(flipped_up_down_view(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (gray8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep))));			
	}
}





}else
#endif

{




#if 1
if(_pIplImage_->dataOrder==1)
{
	if(_pIplImage_->nChannels==3 )
	{
		char *g=_pIplImage_->imageData+ws*w*h;
		char *r=_pIplImage_->imageData+ws*w*h*2;
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(planar_rgb_view(w ,h,(char*)r,(char*)g,(char*)b,ws)));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(planar_rgb_view(w ,h,(unsigned short*)r,(unsigned short*)g,(unsigned short*)b,ws)));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(planar_rgb_view(w ,h,(short*)r,(short*)g,(short*)b,ws)));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(planar_rgb_view(w ,h,(int*)r,(int*)g,(int*)b,ws)));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(planar_rgb_view(w ,h,(float*)r,(float*)g,(float*)b,ws)));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(planar_rgb_view(w ,h,(long double*)r,(long double*)g,(long double*)b,ws)));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(planar_rgb_view(w ,h,(unsigned char*)r,(unsigned char*)g,(unsigned char*)b,ws)));
	}else{
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, gray_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (gray8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));		
	}
}else
#endif
{
	if(_pIplImage_->nChannels==4 ){
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgra32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, bgra_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (bgra8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));	
	}else if(_pIplImage_->nChannels==3 ){
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(bgr32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, bgr_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (bgr8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));	
	}else{
		if(		_pIplImage_->depth==IPL_DEPTH_8S )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray8s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16U) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_16S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray16s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32S) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32s_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else if(_pIplImage_->depth== IPL_DEPTH_32F) 
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(gray32f_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		//else if(_pIplImage_->depth== IPL_DEPTH_64F) 
		//	return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height,(pixel<long double, gray_t> *)(_pIplImage_->imageData), _pIplImage_->widthStep)));
		else//if(_pIplImage_->depth==IPL_DEPTH_8U  )
			return(any_image_view_t(interleaved_view(_pIplImage_->width ,_pIplImage_->height, (gray8_pixel_t *)(_pIplImage_->imageData), _pIplImage_->widthStep)));			
	}
}
}
}
#undef IPLIMAGE


#endif














#if 0
template<typename IPLIMAGE>//=IplImage
any_image_view_t gil_dynamic_view_from_iplimage(IPLIMAGE *  _pIplImage_ ){
			if(_pIplImage_->origin==1 ){return(flipped_up_down_view(gil_dynamic_view_top_left_origin_from_iplimage(_pIplImage_ )));
			}else{return(gil_dynamic_view_top_left_origin_from_iplimage(_pIplImage_ ));}
}
#endif

#if 1
template <typename IPLIMAGE = IplImage>
class gil_dynamic_wrap_iplimage : public  any_ipl_image_view_t 
{
public:
	any_ipl_image_view_t *any_image_view_ptr;
	IPLIMAGE *pIplImage;
	gil_dynamic_wrap_iplimage(IPLIMAGE *  _pIplImage_ )
		:any_ipl_image_view_t( gil_dynamic_view_from_iplimage(pIplImage=cvCloneImage(_pIplImage_))) //,pIplImage(_pIplImage_)
	{any_image_view_ptr = ( any_ipl_image_view_t *)this; }
	gil_dynamic_wrap_iplimage(char *  filename )
		:any_ipl_image_view_t( gil_dynamic_view_from_iplimage(pIplImage=cvLoadImage( filename)))
	{any_image_view_ptr = ( any_ipl_image_view_t *)this; }
	gil_dynamic_wrap_iplimage(int width,int height, int nchannels=1 ,int depth=IPL_DEPTH_8U )
		:any_ipl_image_view_t( gil_dynamic_view_from_iplimage(pIplImage=cvCreateImage( cvSize(width, height),depth,nchannels)))
	{any_image_view_ptr = ( any_ipl_image_view_t *)this; }

	~gil_dynamic_wrap_iplimage()
	{
		cvReleaseImage( &pIplImage );
	}
};
#endif


}//namespace stllcv

#endif /* GIL_WRAP_IPLIMAGE_FACTORY_HPP */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Japan Japan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions