本文整理汇总了C++中ImageBase::NbChannels方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageBase::NbChannels方法的具体用法?C++ ImageBase::NbChannels怎么用?C++ ImageBase::NbChannels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageBase
的用法示例。
在下文中一共展示了ImageBase::NbChannels方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SameType
bool SameType(const ImageBase& Img1, const ImageBase& Img2)
{
return (Img1.IsFloat() == Img2.IsFloat() &&
Img1.IsUnsigned() == Img2.IsUnsigned() &&
Img1.Depth() == Img2.Depth() &&
Img1.NbChannels() == Img2.NbChannels());
}
示例2: IsImageFlush
bool VectorProgram::IsImageFlush(const ImageBase& Source)
{
if (Source.Width() * Source.NbChannels() * Source.DepthBytes() != Source.Step())
return false; // Image has padding
if ((Source.Width() * Source.NbChannels()) % GetVectorWidth(Source.DataType()) != 0)
return false; // width is not a multiple of VectorWidth
return true;
}
示例3: Error
static std::string SelectName(const char * Name, const ImageBase& Img)
{
if (Img.NbChannels() != 1)
throw cl::Error(CL_IMAGE_FORMAT_NOT_SUPPORTED, "Filters on images with >1 channels not yet supported");
return std::string(Name) + "_1C";
}
示例4: PrepareFor
void ImageProximityFFT::PrepareFor(ImageBase& Source, Image& Template)
{
SSize size;
size.Width = Source.Width();
size.Height = Source.Height();
if (m_image_sqsums == nullptr || m_image_sqsums->Width() < size.Width || m_image_sqsums->Height() < size.Height)
m_image_sqsums = std::make_shared<TempImage>(*m_CL, size, SImage::F32, Source.NbChannels());
// Size of the FFT input and output
size.Width = Source.Width() + Template.Width() / 2;
size.Height = Source.Height() + Template.Height() / 2;
// Search for a size supported by clFFT
while (!m_fft.IsSupportedLength(size.Width))
size.Width++;
while (!m_fft.IsSupportedLength(size.Height))
size.Height++;
if (m_bigger_source == nullptr || m_bigger_source->Width() != size.Width || m_bigger_source->Height() != size.Height)
m_bigger_source = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 1);
if (m_bigger_template == nullptr || m_bigger_template->Width() < size.Width || m_bigger_template->Height() < size.Height)
m_bigger_template = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 1);
// Size of the spectral images
size.Width = size.Width / 2 + 1;
if (m_templ_spect == nullptr || m_templ_spect->Width() < size.Width || m_templ_spect->Height() < size.Height)
m_templ_spect = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 2);
if (m_source_spect == nullptr || m_source_spect->Width() != size.Width || m_source_spect->Height() != size.Height)
m_source_spect = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 2);
if (m_result_spect == nullptr || m_result_spect->Width() < size.Width || m_result_spect->Height() < size.Height)
m_result_spect = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 2);
m_integral.PrepareFor(Source);
m_statistics.PrepareFor(Template);
m_transform.PrepareFor(Source);
m_fft.PrepareFor(*m_bigger_source, *m_source_spect);
SelectProgram(Source).Build();
SelectProgram(*m_source_spect).Build();
}
示例5: GetRange
cl::NDRange VectorProgram::GetRange(EProgramVersions Version, const ImageBase& Img1)
{
switch (Version)
{
case Fast:
// The fast version uses a 1D range
return cl::NDRange(Img1.Width() * Img1.Height() * Img1.NbChannels() / GetVectorWidth(Img1.DataType()), 1, 1);
case Standard:
case Unaligned:
// The other versions use a 2D range
return Img1.VectorRange(GetVectorWidth(Img1.DataType()));
case NbVersions:
default:
throw cl::Error(CL_INVALID_PROGRAM, "Invalid program version in VectorProgram");
}
}
示例6: Check1Channel
void Check1Channel(const ImageBase& Img)
{
if (Img.NbChannels() > 1)
throw cl::Error(CL_INVALID_VALUE, "only 1 channel images are allowed");
}
示例7: CheckSameNbChannels
void CheckSameNbChannels(const ImageBase& Img1, const ImageBase& Img2)
{
if (Img1.NbChannels() != Img2.NbChannels())
throw cl::Error(CL_INVALID_VALUE, "Different number of channels used");
}
示例8: IsImageAligned
bool VectorProgram::IsImageAligned(const ImageBase& Source)
{
uint BytesPerWorker = Source.DepthBytes() * Source.NbChannels() * GetVectorWidth(Source.DataType());
return (Source.Step() % BytesPerWorker == 0);
}