本文整理汇总了C++中ImageType::height方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageType::height方法的具体用法?C++ ImageType::height怎么用?C++ ImageType::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageType
的用法示例。
在下文中一共展示了ImageType::height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: img
std::unique_ptr<Image<OpenCVColorType>> OpenCVImageDenoiser::denoise(const ImageType& image) const
{
cv::Mat img(image.height(), image.width(), CV_8UC3);
for (int i = 0; i < img.rows; ++i)
for (int j = 0; j < img.cols; ++j)
img.at<cv::Vec3b>(i, j) = image[{i, j}];
// cv::cvtColor(img, img, CV_BGR2GRAY);
cv::Mat res(img.rows, img.cols, CV_8UC3);
cv::fastNlMeansDenoisingColored(img, res);
return std::make_unique<OpenCVImage>(res);
}
示例2: Load
void Texture::Load(const std::string& filename, bool mipmap/* = false*/)
{
if (m_opengl_id)
Clear();
#if GG_USE_DEVIL_IMAGE_LOAD_LIBRARY
InitDevIL();
ILuint id, error;
ilGenImages(1, &id);
CheckILErrors("ilGenImages(1, &id)");
ilBindImage(id);
CheckILErrors("ilBindImage(id)");
ilLoadImage(const_cast<char*>(filename.c_str()));
if ((error = ilGetError()) != IL_NO_ERROR) {
std::string call = "ilLoadImage(\"" + filename + "\")";
if (VERBOSE_DEVIL_ERROR_REPORTING) {
std::cerr << "IL call \"" << call << "\" failed with IL error \"" << iluErrorString(error)
<< "\" (code " << error << ")\n";
}
CheckILErrors(call);
throw BadFile("Could not load temporary DevIL image from file \"" + filename + "\"");
}
m_filename = filename;
m_default_width = X(ilGetInteger(IL_IMAGE_WIDTH));
CheckILErrors("ilGetInteger(IL_IMAGE_WIDTH)");
m_default_height = Y(ilGetInteger(IL_IMAGE_HEIGHT));
CheckILErrors("ilGetInteger(IL_IMAGE_HEIGHT)");
m_bytes_pp = ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
CheckILErrors("ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL)");
m_format = ilGetInteger(IL_IMAGE_FORMAT);
CheckILErrors("ilGetInteger(IL_IMAGE_FORMAT)");
if (m_format == IL_COLOR_INDEX) {
m_format = IL_RGBA;
m_type = IL_UNSIGNED_BYTE;
m_bytes_pp = 4;
ilConvertImage(m_format, m_type);
CheckILErrors("ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE)");
} else {
m_type = ilGetInteger(IL_IMAGE_TYPE);
CheckILErrors("ilGetInteger(IL_IMAGE_TYPE)");
}
ILubyte* image_data = ilGetData();
CheckILErrors("ilGetData()");
Init(m_default_width, m_default_height, image_data, m_format, m_type, m_bytes_pp, mipmap);
ilDeleteImages(1, &id);
CheckILErrors("ilDeleteImages(1, &id)");
#else
namespace gil = boost::gil;
namespace fs = boost::filesystem;
BOOST_STATIC_ASSERT((sizeof(gil::gray8_pixel_t) == 1));
BOOST_STATIC_ASSERT((sizeof(gil::gray_alpha8_pixel_t) == 2));
BOOST_STATIC_ASSERT((sizeof(gil::rgb8_pixel_t) == 3));
BOOST_STATIC_ASSERT((sizeof(gil::rgba8_pixel_t) == 4));
typedef boost::mpl::vector4<
gil::gray8_image_t,
gil::gray_alpha8_image_t,
gil::rgb8_image_t,
gil::rgba8_image_t
> ImageTypes;
typedef gil::any_image<ImageTypes> ImageType;
fs::path path(filename);
if (!fs::exists(path))
throw BadFile("Texture file \"" + filename + "\" does not exist");
if (!fs::is_regular_file(path))
throw BadFile("Texture \"file\" \"" + filename + "\" is not a file");
std::string extension = boost::algorithm::to_lower_copy(path.extension().string());
ImageType image;
try {
// First attempt -- try just to read the file in one of the default
// formats above.
#if GG_HAVE_LIBJPEG
if (extension == ".jpg" || extension == ".jpe" || extension == ".jpeg")
gil::jpeg_read_image(filename, image);
else
#endif
#if GG_HAVE_LIBPNG
if (extension == ".png")
gil::png_read_image(filename, image);
else
#endif
#if GG_HAVE_LIBTIFF
if (extension == ".tif" || extension == ".tiff")
gil::tiff_read_image(filename, image);
else
#endif
throw BadFile("Texture file \"" + filename + "\" does not have a supported file extension");
} catch (const std::ios_base::failure &) {
//.........这里部分代码省略.........