本文整理汇总了C++中ImageBase::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageBase::Width方法的具体用法?C++ ImageBase::Width怎么用?C++ ImageBase::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageBase
的用法示例。
在下文中一共展示了ImageBase::Width方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: PrepareFor
void Integral::PrepareFor(ImageBase& Source)
{
ImageProgram::PrepareFor(Source);
// Also build float program as we will need it
GetProgram(Float).Build();
SSize VerticalImgSize = {GetNbGroupsW(Source) - 1, Source.Height()};
SSize HorizontalImgSize = {Source.Width(), GetNbGroupsH(Source) - 1};
if (VerticalImgSize.Width == 0)
VerticalImgSize.Width = 1;
if (HorizontalImgSize.Height == 0)
HorizontalImgSize.Height = 1;
// Check validity of current temp buffers
if (m_VerticalJunctions != nullptr &&
uint(VerticalImgSize.Width) <= m_VerticalJunctions->Width() &&
uint(VerticalImgSize.Height) <= m_VerticalJunctions->Height() &&
uint(HorizontalImgSize.Width) <= m_HorizontalJunctions->Width() &&
uint(HorizontalImgSize.Height) <= m_HorizontalJunctions->Height() &&
Source.IsFloat() == m_VerticalJunctions->IsFloat())
{
// Buffers are good
return;
}
// Create buffers for temporary results
m_VerticalJunctions = std::make_shared<TempImage>(*m_CL, VerticalImgSize, SImage::F32);
m_HorizontalJunctions = std::make_shared<TempImage>(*m_CL, HorizontalImgSize, SImage::F32);
}
示例4: 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");
}
}
示例5: CheckSameSize
void CheckSameSize(const ImageBase& Img1, const ImageBase& Img2)
{
if (Img1.Width() != Img2.Width() || Img1.Height() != Img2.Height())
throw cl::Error(CL_INVALID_IMAGE_SIZE, "Different image sizes used");
}
示例6: PrepareFor
void Blob::PrepareFor(ImageBase& Source)
{
if (m_TempBuffer == nullptr || Source.Width() > m_TempBuffer->Width() || Source.Height() > m_TempBuffer->Height())
m_TempBuffer = std::make_shared<TempImageBuffer>(*m_CL, Source.Size(), SImage::U32);
}