当前位置: 首页>>代码示例>>C++>>正文


C++ image_type类代码示例

本文整理汇总了C++中image_type的典型用法代码示例。如果您正苦于以下问题:C++ image_type类的具体用法?C++ image_type怎么用?C++ image_type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了image_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add_image

stereoview::image_id_type stereoview::add_image(const image_type& img, const option<float>& focal_length)
{
    if (!stored_image_db.empty() && (img.width() != width() || img.height() != height()))
        throw localized_invalid_argument(HERE(nfmt<4>("image size is %1 x %2 while expected size is %3 x %4") (img.width()) (img.height()) (width()) (height())));
    const unsigned int id = fresh_int();
    add_stored_image(id, img, focal_length);
    return id;
}
开发者ID:alvisespano,项目名称:stereorecon,代码行数:8,代码来源:stereoview.cpp

示例2: img_result

IonDetector::result_type IonDetector::blob_detector( const image_type& img ) {
	Kernel logs[3];
	float sigmas[3];

	logs[0] = Kernel::LoG( 4, 0.6 );
	sigmas[0] = 0.85;

	logs[1] = Kernel::LoG( 6, 1.0 );
	sigmas[1] = 1.0;

	logs[2] = Kernel::LoG( 20, 5.0 );
	sigmas[2] = 2.;

	image_type img_result( img.extents );
	result_type results;

	const size_t hsize = 2000;
	std::vector< size_t > histogram( hsize, 0 );

	size_t g = 2;
	logs[g].apply_kernel( img, img_result );
	save_file( "log.fits", img_result );

	float img_max = *std::max_element( img_result.ptr(), 
		img_result.ptr() + img.num_elements() );
	for( 	float* iter = img_result.ptr(); 
			iter != img_result.ptr() + img.num_elements(); 
			++iter ) {

		int p = (size_t)( ( *iter + img_max ) / 2 / img_max * hsize ); 
		if( p >= (int)hsize ) 	p = hsize-1;
		if( p < 0 )				p = 0;
		histogram[ p ] ++;
	}

	size_t nelems = 0, counter = hsize-1;
	while( nelems < (size_t)blob_threshold )
		nelems += histogram[ counter-- ];

	float thresh = (float)counter / hsize * img_max - img_max / 2.;
	for( image_type::index i = 12; i < img.extents.first-12; ++i ) 
	for( image_type::index j = 12; j < img.extents.second-12; ++j ) {
		if( img_result( i, j ) > thresh &&
			img_result( i, j ) > img_result( i+1, j ) &&
			img_result( i, j ) > img_result( i-1, j ) &&
			img_result( i, j ) > img_result( i, j+1 ) &&
			img_result( i, j ) > img_result( i, j-1 ) &&
			img_result( i, j ) > img_result( i+1, j+1 ) &&
			img_result( i, j ) > img_result( i+1, j-1 ) &&
			img_result( i, j ) > img_result( i-1, j+1 ) &&
			img_result( i, j ) > img_result( i-1, j-1 ) ) {

			results.push_back( IonData( i, j, sigmas[g] ) );
		}
	}

	return results;
}
开发者ID:TomaszSakrejda,项目名称:musiqcWashington,代码行数:58,代码来源:ion_detector.cpp

示例3: compare

 unsigned compare(image_type const & actual, boost::filesystem::path const& reference) const
 {
     std::ifstream stream(reference.string().c_str(), std::ios_base::in | std::ios_base::binary);
     if (!stream)
     {
         throw std::runtime_error("Could not open: " + reference.string());
     }
     std::string expected(std::istreambuf_iterator<char>(stream.rdbuf()), std::istreambuf_iterator<char>());
     return std::max(actual.size(), expected.size()) - std::min(actual.size(), expected.size());
 }
开发者ID:mapycz,项目名称:mapnik,代码行数:10,代码来源:renderer.hpp

示例4: fft_round_up

void fft_round_up(image_type& I,pos_type& from,pos_type& to)
{
    image_type newI(fft_round_up_geometry(I.geometry()));
    for(int dim = 0;dim < image_type::dimension;++dim)
    {
        from[dim] = (newI.geometry()[dim]-I.geometry()[dim]) >> 1;
        to[dim] = from[dim] + I.geometry()[dim];
    }
    image::draw(I,newI,from);
    I.swap(newI);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: Image2DIB

void Image2DIB(const image_type &image, BYTE *dib)
{
	using namespace rss;
	const int all_header_size = 14 + 40 +1024;
	size_t dib_size = all_header_size 
		+ ( image.width() + ( (image.width()%4)?(4-image.width()%4):0) )* image.height();	
	
	std::ostrstream output(reinterpret_cast<char *>(dib), dib_size);
	BMPImageIO<image_type> image_io;
	if(!image_io.write(output, image))
		throw rss::Exception("library can not write this dib");
}
开发者ID:ch3n2k,项目名称:rss,代码行数:12,代码来源:im_interface.cpp

示例6: hough

IonDetector::result_type IonDetector::hough_transform( image_type& edges ) {
	const unsigned short num_radii = 4;

	std::vector< unsigned short > hough( 
		edges.num_elements()*num_radii, 0 );

	for( size_t r = 2; r < 6; ++r ) 
	for( image_type::index i = r+1; i<edges.extents.first-r-1; ++i ) 
	for( image_type::index j = r+1; j<edges.extents.second-r-1; ++j ) {
		if( edges( i, j ) ) {
			for( float theta = 0.; theta < 6.3; theta += 1. / r ) {
				size_t x = (size_t)( i + (float)r*cos( theta ) + 0.5f);
				size_t y = (size_t)( j + (float)r*sin( theta ) + 0.5f);
				hough[ (r-2)*edges.num_elements() +
					y*edges.extents.first + x ]++;
			}
		}
	}
		
	result_type results;
	for( size_t r = 5; r >= 2; --r )
	for( image_type::index i = 8; i < edges.extents.first-8; ++i ) 
	for( image_type::index j = 8; j < edges.extents.second-8; ++j ) {
		size_t index = (r-2)*edges.num_elements() + 
			j*edges.extents.first + i;
		const unsigned short value = hough[index];
		if( value > (size_t)(hough_threshold * r) ) {
			size_t h = 0;
			for( ;  h < results.size(); ++h ) {
				size_t xsq = (i - results[h].x)*(i - results[h].x);
				size_t ysq = (j - results[h].y)*(j - results[h].y);
				if( xsq + ysq < 36 ) break;
			}
			
			if( h != results.size() ) continue;
			if( hough[index + edges.extents.first] > value ) continue;
			if( hough[index - edges.extents.first] > value ) continue;
			if( hough[index - 1] > value ) continue;
			if( hough[index + 1] > value ) continue;

			results.push_back( IonData( i, j, r ) );
			std::cout<< "Circle " << i << " " << j << " " << r << std::endl;
			std::cout<< value << std::endl;
		}
	}
	
	return results;
}
开发者ID:TomaszSakrejda,项目名称:musiqcWashington,代码行数:48,代码来源:ion_detector.cpp

示例7: convert

    void convert(mapnik::grid::data_type const & grid, image_type & image) const
    {
        for (std::size_t y = 0; y < grid.height(); ++y)
        {
            mapnik::grid::value_type const * grid_row = grid.get_row(y);
            image_type::pixel_type * image_row = image.get_row(y);
            for (std::size_t x = 0; x < grid.width(); ++x)
            {
                mapnik::grid::value_type val = grid_row[x];

                if (val == mapnik::grid::base_mask)
                {
                    image_row[x] = 0;
                    continue;
                }
                if (val < 0)
                {
                    throw std::runtime_error("grid renderer: feature id is negative.");
                }

                val *= 100;

                if (val > 0x00ffffff)
                {
                    throw std::runtime_error("grid renderer: feature id is too high.");
                }

                image_row[x] = val | 0xff000000;
            }
        }
    }
开发者ID:mapycz,项目名称:mapnik,代码行数:31,代码来源:renderer.hpp

示例8: RSS_MultiSensor_PCA_Fusion

void RSS_MultiSensor_PCA_Fusion(const image_type &image1, const image_type &image2, image_type &result)
{
	using namespace rss;
	rss::ImageVector<image_type> input_vector;
	input_vector.push_back(image1);
	if(image1.size() != image2.size()) {
		BilinearInterpolation<image_type> interpolate(image1.size());
		image_type temp;
		interpolate(image2, temp);
		input_vector.push_back(temp);
	} else { 
		input_vector.push_back(image2);
	}

	PCAFusion<image_type> fusion(image1.width(), image1.height());
	fusion(input_vector, result);		
}
开发者ID:ch3n2k,项目名称:rss,代码行数:17,代码来源:im_interface.cpp

示例9: RSS_MultiSensor_Wavelet_Fusion

void RSS_MultiSensor_Wavelet_Fusion(const image_type &image1, const image_type &image2, image_type &result)
{
	using namespace rss;
	rss::ImageVector<image_type> input_vector;
	input_vector.push_back(image1);
	if(image1.size() != image2.size()) {
		BilinearInterpolation<image_type> interpolate(image1.size());
		image_type result;
		interpolate(image2, result);
		input_vector.push_back(result);
	} else { 
		input_vector.push_back(image2);
	}

	WaveletFusion<image_type> fusion(image1.size(), FilterSet::Haar());
	fusion(input_vector, result);		

}
开发者ID:ch3n2k,项目名称:rss,代码行数:18,代码来源:im_interface.cpp

示例10: RSS_MultiSensor_Contour_Register

void RSS_MultiSensor_Contour_Register(const image_type &VLImage, const image_type &IRImage, float para[6], image_type &result)
{
	using namespace rss;
	ContourRegister contour_register(HomoModel::Similarity, 3.1, 0.0, 0.0, 0.0, 30, 0.18, 0.8, 0.5);
	HomoModel model; 
	contour_register(VLImage, IRImage,model);
	HomoTrans<image_type> homo_trans(model, VLImage.size());
	homo_trans.inverse(IRImage, result);
}
开发者ID:ch3n2k,项目名称:rss,代码行数:9,代码来源:im_interface.cpp

示例11: fft_shift_x

void fft_shift_x(image_type& I)
{
    int half_w = I.width() >> 1;
    int half_w_1 = half_w-1;
    int w_1 = I.width()-1;
    int quater_w = half_w >> 1;
    typename image_type::iterator iter1 = I.begin();
    typename image_type::iterator end = I.end();
    for(;iter1 != end;iter1 += I.width())
    {
        typename image_type::iterator iter2 = iter1+half_w;
        for(int x = 0,rx = half_w_1;x < quater_w;++x,--rx)
        {
            std::swap(iter1[x],iter1[rx]);
            std::swap(iter2[x],iter2[rx]);
        }
    }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例12: fft_shift_z

void fft_shift_z(image_type& I)
{
    int wh = I.plane_size();
    int half_size = I.size() >> 1;
    int half_size_1 = half_size-wh;
    int quater_size = half_size >> 1;
    typename image_type::iterator iter1 = I.begin();
    typename image_type::iterator iter2 = iter1+half_size;
    typename image_type::iterator end = iter1+wh;
    for(;iter1 != end;++iter1,++iter2)
    {
        for(int z = 0,rz = half_size_1;z < quater_size;z+=wh,rz-=wh)
        {
            std::swap(iter1[z],iter1[rz]);
            std::swap(iter2[z],iter2[rz]);
        }
    }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例13: compare

 unsigned compare(image_type const & actual, boost::filesystem::path const& reference) const
 {
     std::ifstream stream(reference.string().c_str(),std::ios_base::in|std::ios_base::binary);
     if (!stream.is_open())
     {
         throw std::runtime_error("could not open: '" + reference.string() + "'");
     }
     std::string expected(std::istreambuf_iterator<char>(stream.rdbuf()),(std::istreambuf_iterator<char>()));
     stream.close();
     return std::fabs(actual.size() - expected.size());
 }
开发者ID:gischen,项目名称:mapnik,代码行数:11,代码来源:renderer.hpp

示例14: decode_image_impl

void decode_image_impl(image_type& image) {
  if (image.m_format == Format::RAW_ARRAY) {
    return;
  }

  char* buf = NULL;
  size_t length = 0;

  if (image.m_format == Format::JPG) {
    decode_jpeg((const char*)image.get_image_data(), image.m_image_data_size,
                &buf, length);
  } else if (image.m_format == Format::PNG) {
    decode_png((const char*)image.get_image_data(), image.m_image_data_size,
                &buf, length);
  } else {
    log_and_throw(std::string("Cannot decode image. Unknown format."));
  };
  image.m_image_data.reset(buf);
  image.m_image_data_size = length;
  image.m_format = Format::RAW_ARRAY;
}
开发者ID:Hannah1999,项目名称:Dato-Core,代码行数:21,代码来源:image_util_impl.hpp

示例15: save_file

void save_file( const std::string& filename, const image_type& img ) {
	fitsfile* f;
	int status = 0;

    std::string fname = "!" + filename;
	fits_create_file( &f, fname.c_str(), &status );
	
	long dims[2];
	dims[0] = img.extents.first;	dims[1] = img.extents.second;

	typedef CFitsIOTypeMap<	image_type::element > map;
	fits_create_img( f, map::image_type, 2, dims, &status );
	fits_write_img( f, map::type, 1, img.num_elements(), 
		(void*)img.ptr(), &status );
        
    fits_close_file( f, &status );

	if( status ) {
		fits_report_error( stderr, status );
	}
}
开发者ID:TomaszSakrejda,项目名称:musiqcWashington,代码行数:21,代码来源:ion_detector.cpp


注:本文中的image_type类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。