本文整理汇总了C++中Image::AllocateData方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::AllocateData方法的具体用法?C++ Image::AllocateData怎么用?C++ Image::AllocateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::AllocateData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VNGThreaded
static void VNGThreaded( Image& target, const GenericImage<P>& source, const DebayerInstance& instance )
{
int target_w = source.Width();
int target_h = source.Height();
target.AllocateData( target_w, target_h, 3, ColorSpace::RGB );
target.Status().Initialize( "VNG debayering", target_h-4 );
int numberOfThreads = Thread::NumberOfThreads( target_h-4, 1 );
int rowsPerThread = (target_h - 4)/numberOfThreads;
AbstractImage::ThreadData data( target, target_h-4 );
ReferenceArray<VNGThread<P> > threads;
for ( int i = 0, j = 1; i < numberOfThreads; ++i, ++j )
threads.Add( new VNGThread<P>( data, target, source, instance,
i*rowsPerThread + 2,
(j < numberOfThreads) ? j*rowsPerThread + 2 : target_h-2 ) );
AbstractImage::RunThreads( threads, data );
threads.Destroy();
// copy top and bottom two rows from the adjecent ones
for ( int col = 0; col < target_w; col++ )
for ( int i = 0; i < 3; i++ )
{
target.Pixel( col, 0, i ) = target.Pixel( col, 1, i ) = target.Pixel( col, 2, i );
target.Pixel( col, target_h-1, i ) = target.Pixel( col, target_h-2, i ) = target.Pixel( col, target_h-3, i );
}
target.Status() = data.status;
}
示例2: SuperPixelThreaded
static void SuperPixelThreaded( Image& target, const GenericImage<P>& source, const DebayerInstance& instance )
{
int target_w = source.Width() >> 1;
int target_h = source.Height() >> 1;
target.AllocateData( target_w, target_h, 3, ColorSpace::RGB );
target.Status().Initialize( "SuperPixel debayering", target_h );
int numberOfThreads = Thread::NumberOfThreads( target_h, 1 );
int rowsPerThread = target_h/numberOfThreads;
AbstractImage::ThreadData data( target, target_h );
ReferenceArray<SuperPixelThread<P> > threads;
for ( int i = 0, j = 1; i < numberOfThreads; ++i, ++j )
threads.Add( new SuperPixelThread<P>( data, target, source, instance,
i*rowsPerThread,
(j < numberOfThreads) ? j*rowsPerThread : target_h ) );
AbstractImage::RunThreads( threads, data );
threads.Destroy();
target.Status() = data.status;
}