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


C++ image类代码示例

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


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

示例1: bitmap_rendering_attributes

/**
 * \brief Constructor.
 * \param img The image for the sprite.
 */
bear::visual::sprite::sprite( const image& img )
  : bitmap_rendering_attributes(img.size()), m_image(img),
    m_clip_rectangle(0, 0, img.width(), img.height()),
    m_opaque_rectangle( 0, 0, 0, 0 )
{

} // sprite::sprite()
开发者ID:LibreGames,项目名称:bear,代码行数:11,代码来源:sprite.cpp

示例2: image_insert_tile_row

static void image_insert_tile_row(image& target, int32_t x, int32_t y, uint32_t width, uint32_t height,
                                  const image& other, uint32_t offx, uint32_t offy)
{
	if (offx + width <= other.width)
	{
		target.insert_sub(x, y, other, offx, offy, width, height);
		return;
	}
	
	if (offx != 0)
	{
		target.insert_sub(x, y, other, offx, offy, other.width-offx, height);
		x += other.width-offx;
		width -= other.width-offx;
	}
	uint32_t xx = 0;
	if (width >= other.width)
	{
		for (xx = 0; xx < width-other.width; xx += other.width)
		{
			target.insert_sub(x+xx, y, other, 0, offy, other.width, height);
		}
	}
	if (xx < width)
	{
		target.insert_sub(x+xx, y, other, 0, offy, width-xx, height);
	}
}
开发者ID:Alcaro,项目名称:Arlib,代码行数:28,代码来源:image.cpp

示例3: on_draw

            virtual BOOL on_draw(HELEMENT he, UINT draw_type, HDC hdc, const
                RECT &rc)
            {
                if ((DRAW_EVENTS)draw_type != where)
                    return FALSE;
                // do default draw
                int w = rc.right - rc.left;
                int h = rc.bottom - rc.top;
                if (!surface)
                {
                    surface = image::create(w, h);
                    redraw = true;
                }
                else if (w != surface->width() || h != surface->height())
                {
                    delete surface;
                    surface = image::create(w, h);
                    redraw = true;
                }
                else if (redraw)
                    surface->clear();

                if (redraw)
                {
                    graphics gx(surface);
                    draw(he, gx, w, h);
                    redraw = false;
                }
                surface->blit(hdc, rc.left, rc.top);

                return default_draw ? TRUE : FALSE;
            }
开发者ID:JourneyRoad,项目名称:VC_sln,代码行数:32,代码来源:htmlayout_canvas.hpp

示例4: apply

  // merge float channels
  bool mergeOCPToImage::apply(const matrix<float>& c1,
                              const matrix<float>& c2,
                              const matrix<float>& c3,
                              image& img) const {

    point p;              // coordinates
    float r,g,b;          // unnormed RGB channels
    float RG, BY, WB;     // opponent colour channels

    if ((c1.size() != c2.size()) || (c1.size() != c3.size())) {
      setStatusString("sizes of channels do not match");
      return false;
    }

    img.resize(c1.size(),rgbPixel(),false,false);

    for (p.y=0;p.y<img.rows();p.y++) {
      for (p.x=0;p.x<img.columns();p.x++) {

	RG = c1.at(p);
	BY = c2.at(p);
	WB = c3.at(p);

        b = BY*0.666666666667f;
        //
	r = WB + RG - b;
	g = WB - RG - b;
	b = WB + BY*1.3333333333333f;

	// truncate r,g and b if the value is not in intervall [0..1]
	// can happen due to rounding errors in split operation
	if (r<0.0f) {
          r=0.0f;
        } else if (r>1.0f) {
          r=1.0f;
        }

	if (g<0.0f) {
          g=0.0f;
        } else if (g>1.0f) {
          g=1.0f;
        }

	if (b<0.0f) {
          b=0.0f;
        } else if (b>1.0f) {
          b=1.0f;
        }

	img.at(p).set(static_cast<ubyte>(255.0f*r),
                      static_cast<ubyte>(255.0f*g),
                      static_cast<ubyte>(255.0f*b),
                      0);
      }
    }

    return true;
  };
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:59,代码来源:ltiMergeOCPToImage.cpp

示例5: max

/*!
 */
image  max(const image& lhs,const image& rhs)
{
  CvSize lhs_sz = lhs.dim();
  CvSize rhs_sz = rhs.dim();
  if((lhs_sz.height != rhs_sz.height) || (lhs_sz.width != rhs_sz.width)) throw exception();
  image res = lhs;
  cvMax(lhs,rhs,res);
  return res;
}
开发者ID:Aura-zx,项目名称:sharat-cbcl,代码行数:11,代码来源:image.cpp

示例6: cnt

size_t cnt(const image& img) {
    size_t sum = 0;
    img.reset();
    while (img.move_next()) {
        if (img.element())
            sum++;
    }
    return sum;
}
开发者ID:adamm24680,项目名称:sus_clustering,代码行数:9,代码来源:distance_functions.cpp

示例7: display_diff

image<vec4f> display_diff(const image<vec4f>& diff) {
    auto display = image{diff.size(), zero4f};
    for (auto j = 0; j < diff.size().y; j++) {
        for (auto i = 0; i < diff.size().x; i++) {
            auto diff_value = max(diff[{i, j}]);
            display[{i, j}] = {diff_value, diff_value, diff_value, 1};
        }
    }
    return display;
}
开发者ID:xelatihy,项目名称:yocto-gl,代码行数:10,代码来源:yimdiff.cpp

示例8: exception

/*!
 */
image operator /(const image& lhs,const image& rhs)
{
  CvSize lhs_sz = lhs.dim();
  CvSize rhs_sz = rhs.dim(); 
  if((lhs_sz.width != rhs_sz.width) || (lhs_sz.height !=rhs_sz.height))
    throw exception();
  image result = lhs;
  cvDiv(lhs,rhs,result);
  return result;
}
开发者ID:Aura-zx,项目名称:sharat-cbcl,代码行数:12,代码来源:image.cpp

示例9: device_

	image_view::image_view(const image &image, const vk::Format format, vk::ImageAspectFlags aspectFlags)
		: device_(image.parent_device())
	{
		handle_ = device_.create_image_view(
			vk::ImageViewCreateInfo()
				.viewType(vk::ImageViewType::e2D)
				.format(format)
				.subresourceRange(vk::ImageSubresourceRange(aspectFlags, 0, 1, 0, 1))
				.image(image.handle()));
	}
开发者ID:PixelSpew,项目名称:nIceVulkan,代码行数:10,代码来源:image_view.cpp

示例10: imshow_impl

void imshow_impl(
	const image<T1, D1>& im1, const char* title1,
	const image<T2, D2>& im2, const char* title2,
	const image<T3, D3>& im3, const char* title3,
	const image<T4, D4>& im4, const char* title4,
	const image<T5, D5>& im5, const char* title5)
{
	IplImage* ipl1;
	IplImage* ipl2;
	IplImage* ipl3;
	IplImage* ipl4;
	IplImage* ipl5;

	ipl1 = im1.ipl();
	cvNamedWindow(title1, 1);
	cvShowImage(title1, ipl1);

	if(title2) {
		ipl2 = im2.ipl();
		cvNamedWindow(title2, 2);
		cvShowImage(title2, ipl2);
	}

	if(title3) {
		ipl3 = im3.ipl();
		cvNamedWindow(title3, 3);
		cvShowImage(title3, ipl3);
	}

	if(title4) {
		ipl4 = im4.ipl();
		cvNamedWindow(title4, 4);
		cvShowImage(title4, ipl4);
	}

	if(title5) {
		ipl5 = im5.ipl();
		cvNamedWindow(title5, 5);
		cvShowImage(title5, ipl5);
	}

	cvWaitKey(0); // very important, contains event processing loop inside

	cvDestroyWindow(title1);
	if(title2) cvDestroyWindow(title2);
	if(title3) cvDestroyWindow(title3);
	if(title4) cvDestroyWindow(title4);
	if(title5) cvDestroyWindow(title5);

	cvReleaseImage(&ipl1);
	if(title2) cvReleaseImage(&ipl2);
	if(title3) cvReleaseImage(&ipl3);
	if(title4) cvReleaseImage(&ipl4);
	if(title5) cvReleaseImage(&ipl5);
}
开发者ID:cpplibivl,项目名称:ivl,代码行数:55,代码来源:image_functions_impl_cv.hpp

示例11: median_blur

typename image<T, D>::create_new median_blur(const image<T, D>& a, int neighbourhood)
{
	IplImage* src = a.ipl();
	IplImage* dst = cvCreateImage(cvGetSize(src),
		image_details::ipl_depth<T>(), int(a.channels()));
	cvSmooth(src, dst, CV_MEDIAN, neighbourhood);
	typename image<T, D>::create_new r(dst);
	cvReleaseImage(&src);
	cvReleaseImage(&dst);
	return r;
}
开发者ID:cpplibivl,项目名称:ivl,代码行数:11,代码来源:image_functions_impl_cv.hpp

示例12: compute_diff_image

image<vec4f> compute_diff_image(const image<vec4f>& a, const image<vec4f>& b) {
    auto diff = image{a.size(), zero4f};
    for (auto j = 0; j < a.size().y; j++) {
        for (auto i = 0; i < a.size().x; i++) {
            diff[{i, j}] = {abs(a[{i, j}].x - b[{i, j}].x),
                abs(a[{i, j}].y - b[{i, j}].y), abs(a[{i, j}].z - b[{i, j}].z),
                abs(a[{i, j}].w - b[{i, j}].w)};
        }
    }
    return diff;
}
开发者ID:xelatihy,项目名称:yocto-gl,代码行数:11,代码来源:yimdiff.cpp

示例13: find_in_image

void find_in_image() {
	Setting conf("application.cfg");
	string base = conf.getString("application.res_dir");
	Mat haystack = read(base + "/car_features/01.jpg");
	Mat needle = toGrayscale(cv::imread(base + "/car_features/01.jpg"));
	Mat needle64x128;
	cv::resize(needle, needle64x128, Size(64, 128));

	vector<float> hog = computeHog(needle64x128);

	cout << hog.size() << endl;
}
开发者ID:lolski,项目名称:exercise-hog-opencv-cpp,代码行数:12,代码来源:main.cpp

示例14: laplace

typename image<T, D>::create_new laplace(const image<T, D>& a,
	int aperture_size)
{
	IplImage* src = a.ipl();
	IplImage* dst = cvCreateImage(cvGetSize(src),
		image_details::ipl_depth<T>(), int(a.channels()));
	cvLaplace(src, dst, aperture_size);
	typename image<T, D>::create_new r(dst);
	cvReleaseImage(&src);
	cvReleaseImage(&dst);
	return r;
}
开发者ID:cpplibivl,项目名称:ivl,代码行数:12,代码来源:image_functions_impl_cv.hpp

示例15: blur_no_scale

typename image<T, D>::create_new blur_no_scale(const image<T, D>& a, int neighbourhood_rows,
	int neighbourhood_cols)
{
	IplImage* src = a.ipl();
	IplImage* dst = cvCreateImage(cvGetSize(src),
		image_details::ipl_depth<T>(), int(a.channels()));
	cvSmooth(src, dst, CV_BLUR_NO_SCALE, neighbourhood_cols, neighbourhood_rows);
	typename image<T, D>::create_new r(dst);
	cvReleaseImage(&src);
	cvReleaseImage(&dst);
	return r;
}
开发者ID:cpplibivl,项目名称:ivl,代码行数:12,代码来源:image_functions_impl_cv.hpp


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