• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Pixel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Pixel

void PropPC::update() {
    Prop::update();

    if (age % (60 / 10) == 0) {
        if (crashed) {
            for (int x = 0; x < 320 / 16 + 1; x++) {
                for (int y = 0; y < 200 / 16 + 1; y++) {
                    Pixel p = Pixel(Util::random() * 0xFF, Util::random() * 0xFF, Util::random() * 0xFF, 0xFF);
                    for (int px = 0; px < 16; px++) {
                        for (int py = 0; py < 16; py++) {
                            setPixel(x * 16 + px, y * 16 + py, p);
                        }
                    }
                }
            }
        } else {
            if (age % (60/4) == 0) {
                caret = !caret;
                GLubyte carCol = caret ? 0xFF : 0x0;
                renderString("_", (text.size() + 1) * 8, lineHeight * 8, Pixel(carCol, carCol, carCol, 0xFF));
            }
        }
        redraw();
    }
}
开发者ID:Curly-,项目名称:OGL-2,代码行数:25,代码来源:Prop_PC.cpp


示例2: main

void main(int argc,String *argv) {
  
  ArgParser a=ArgParser(argc,argv);
  int as=a.intafter("-as","angles examined",16);
  bool showpp=a.argexists("-spp","show winning projection profile");
  bool showpps=a.argexists("-spps","show all projection profiles");
  String bname=a.getarg("binary image");
  a.done();

  Map2d<bool> binimg=*Map2d<bool>::readfile(bname)->threshold(0.5);

  ProjectionProfiler pp=ProjectionProfiler(as,binimg);
  pp.showpps=showpps;
  pp.showpp=showpp;
  float ang=pp.getlineangle();
    
  Pixel cen=Pixel(binimg.width/2,binimg.height/2);
  Pixel diff=Pixel(V2d::angle(ang)*binimg.width);
  binimg.line(cen-diff,cen+diff,true);
  #ifdef USINGJFONT
    jfont.writeString(Sformat("entropy=%.5f",lowestent),&binimg,0,10,8.0,true);
  #endif
  binimg.writefile("result.bmp");

}
开发者ID:10crimes,项目名称:code,代码行数:25,代码来源:pp002.c


示例3: line

  static List<Pixel> line(Pixel a,Pixel b) {
//printf("a\n");
    List<Pixel> ls;
    if (a==b) {
      ls.add(a);
//printf("b\n");
      return ls;
    }
    Pixel diff=b-a;
    if (abs(diff.x)>abs(diff.y)) {
      int diffm=abs(diff.x);
      for (int i=0;i<=diffm;i++) {
//        printf("%i/%i\n",i,diffm);
//        Pixel p=a+diff*((float)i/(float)diffm);
        Pixel p=Pixel(a.x+mysgn(diff.x)*i,a.y+diff.y*((float)i/(float)diffm));
        ls.add(p);
      }
    } else {
      int diffm=abs(diff.y);
      for (int i=0;i<=diffm;i++) {
//        printf(" %i/%i\n",i,diffm);
//        Pixel p=a+diff*((float)i/(float)diffm);
        Pixel p=Pixel(a.x+diff.x*((float)i/(float)diffm),a.y+mysgn(diff.y)*i);
        ls.add(p);
      }
    }
//printf("c\n");
    return ls;
  }
开发者ID:10crimes,项目名称:code,代码行数:29,代码来源:maths.c


示例4: Sphere

void World::build()
{
        //a sample scene with 5 spheres
        Sphere *sph1 = new Sphere();
        sph1->set_color(Pixel(123, 255, 45));
        sph1->set_center(Point3d(-400, 200, -300));
        sph1->set_radius(250);
        add_object(sph1);


        Sphere *sph2 = new Sphere();
        sph2->set_color(Pixel(255, 123, 45));
        sph2->set_center(Point3d(400, -200,-100));
        sph2->set_radius(200);
        add_object(sph2);

        Sphere *sph3 = new Sphere();
        sph3->set_color(Pixel(45, 123, 255));
        sph3->set_center(Point3d(400, 200,-100));
        sph3->set_radius(150);
        add_object(sph3);

        Sphere *sph4 = new Sphere();
        sph4->set_color(Pixel(123, 123, 45));
        sph4->set_center(Point3d(-600, -200,-100));
        sph4->set_radius(150);
        add_object(sph4);

        Sphere *sph5 = new Sphere();
        sph5->set_color(Pixel(235, 34, 45));
        sph5->set_center(Point3d(0, 0,-100));
        sph5->set_radius(50);
        add_object(sph5);
}
开发者ID:tigerzhua,项目名称:Ray_trace_cpp,代码行数:34,代码来源:world.cpp


示例5: HydraxLOG

	Image::Pixel Image::getPixelLI(const float &x, const float &y) const
	{
#if HYDRAX_IMAGE_CHECK_PIXELS == 1
		if (x < 0 || x > mSize.Width ||
			y < 0 || y > mSize.Height)
		{
			HydraxLOG("Error in Image::getPixel, x = " + Ogre::StringConverter::toString(x)
				                             + " y = " + Ogre::StringConverter::toString(y));

			return Pixel(0);
		}
#endif

		float v[4];

		for(int k = 0; k < 4; k++)
		{
			if (mChannels >= k)
			{
			    v[k] = getValueLI(x, y, k);
			}
			else
			{
				v[k] = 0;
			}
		}

		return Pixel(v[0], v[1], v[2], v[3]);
	}
开发者ID:Aperion,项目名称:rigsofrods-next-stable,代码行数:29,代码来源:Image.cpp


示例6: main

	void main(){

		//すべての画素を書き換える
		*background = Pixel(255);
	
		
		//ImageClass#setPosのテスト
		if(frame == 100){
			img->setPos(0,100);
		}
	
		//biImageClass#Sizeのテスト
		if(frame == 200){
			load->Height(-load->Height());
		}
		if(frame == 250){
			load->Width(-load->Width());
		}
		//biImageClass#Rotateのテスト
		if(frame >= 300){
			angle += 10;
			*load = base.Rotate(angle);
		}
		//biImageClass#Clearのテスト
		if(frame == 500){
			load->Clear(Pixel(255,0,0));
		}
	
		//biImageClass#Pasteのテスト
		background->Paste(0,0,*load);
	
		frame++;

		img->Paste(0,0,*background);
	}
开发者ID:leftfelt,项目名称:LeftFelt,代码行数:35,代码来源:main.cpp


示例7: getPixel

 Pixel getPixel( Im::Position, BrightnessType br ) const {
     unsigned char part = br & 0xFF;
     return inv(
         ( br < 0x100 ) ? Pixel( part, 0, 0 ) :
         ( br < 0x200 ) ? Pixel( 0xFF, part, 0 ) :
                          Pixel( 0xFF, 0xFF, part ) );
 }
开发者ID:matoho,项目名称:rapidSTORM,代码行数:7,代码来源:hot.cpp


示例8: extract_cc_

int extract_cc_(Pixel p, std::vector<Pixel> &cc, ImageGray<BYTE> &img)
{
    std::stack<Pixel> s;
    BYTE *pColor;
    if (img.pixelInside(p.x, p.y))
        pColor = &img.pixel(p.x, p.y);
    else
        return 0;
    while (*pColor == 0 || !s.empty())
    {
        if (*pColor == 0) {
            cc.push_back(p);
            *pColor = 255;
            s.push(Pixel(p.x+1, p.y));
            s.push(Pixel(p.x-1, p.y));
            s.push(Pixel(p.x, p.y+1));
            s.push(Pixel(p.x, p.y-1));
        }
        p = s.top();
        s.pop();
        if (img.pixelInside(p.x, p.y))
            pColor = &img.pixel(p.x, p.y);
        else
            *pColor = 255;
    }
    return cc.size();
}
开发者ID:flm8620,项目名称:Calib3DTools,代码行数:27,代码来源:abberation.cpp


示例9: calculate_pixel_location

void RayTracer::trace_rays(){
	int i,j;
	SbVec3f pix_pos, d_vec;
	double a,b,c;
	float color_scale;
	SbVec3f color;
    std::vector<Pixel> image_row;
	std::cout << "Tracing rays"<<std::endl;
    color[0] = 0.0;
    color[1] = 0.0;
    color[2] = 0.0;

	for (i=0; i < y_resolution; i++){
        image_row.clear();
	    for (j=0; j < x_resolution; j++) {
            pix_pos = calculate_pixel_location(i,j);
            d_vec  = pix_pos - camera->position;
            d_vec.normalize();
            bool should_color = shade(&(camera->position), &d_vec, &color, 1);
            if(should_color)
            {
                image_row.push_back(Pixel(min(color[0]), min(color[1]), min(color[2])));
            }
            else
                image_row.push_back(Pixel(0,0,0));

        }
        image.push_back(image_row);
	}
	open_file();
	write_to_file(image);
	close_file();
	std::cout<<"Done Tracing"<<std::endl;
	return;
}
开发者ID:tarunrs,项目名称:homework-fall-2011,代码行数:35,代码来源:raytracer.C


示例10: VideoCapture

void Calibration::init(){
	if(device){
		cam = VideoCapture(idCam);
		for(int i = 0 ; i < 30 ; i++){
			cam >> inputImage;
		}
	}

	rotation = 0;
	for(int i = 0 ; i < 3 ; i++){
		staticVisionColorHelper[i] = 0;
		staticVisionColorHelper[i+3] = 255;
		staticVisionColor.min = Pixel(0, 0, 0);
		staticVisionColor.max = Pixel(0, 0, 0);
	}

	// Se o estágio de calibragem é uma cor
	if(calibrationStage >= 0 && calibrationStage <= 7){
		calibrationVisionColor();
	}else{
		if(calibrationStage == ROTATION){
			calibrationRotation();
		}else
		if(calibrationStage == CUT){
			calibrationCut();
		}
	}
}
开发者ID:manoelstilpen,项目名称:VSS-Vision,代码行数:28,代码来源:Calibration.cpp


示例11: return

Uint8 WgSDLSurface::Alpha( WgCoord coord ) const
{
	// All pixels are transparent if we don't have any surface...

	if( !m_pSurface )
		return 0;

	// Opacity tests below done in order to match SDL blitting rules (hopefully).

	// First, if surface has SDL_SRCALPHA + alpha channel we ignore everything
	// else.

	if( m_pSurface->flags & SDL_SRCALPHA && m_pSurface->format->Amask )
		return ((Pixel(coord) & m_pSurface->format->Amask) >> m_pSurface->format->Ashift) << m_pSurface->format->Aloss;

	// Secondly, check for colorkey, return transparent if match.

	if( m_pSurface->flags & SDL_SRCCOLORKEY )
	{
		if( Pixel( coord ) == 0 )
			return 0;
	}

	// Third, if surface has SDL_SRCALPHA we return the surace alpha value.

	if( m_pSurface->flags & SDL_SRCALPHA )
		return 0;//m_pSurface->format->alpha;

	// Fourth, all tests passed, pixel is opaque.

	return 255;
}
开发者ID:tempbottle,项目名称:WonderGUI,代码行数:32,代码来源:wg_sdlsurface.cpp


示例12: printf

Vnd *summarise(List<Pixel> *ps) {
printf("X\n");
  Vnd *nv=new Vnd(nummeasures);
printf("Y0\n");
  float f=measureedgeanglecancelling(ps);
printf("Y1\n");
  nv->setaxis(1,f);
printf("Y2\n");
  nv->setaxis(2,sqrt(measureglvariance(ps)));
printf("Y3\n");
  nv->setaxis(3,measurehiststability(ps));
printf("Y4\n");
  nv->setaxis(4,measureedgecount(ps));
//  nv->setaxis(5,measureoldedgeanglecancelling(ps));
printf("Z\n");
  if (show)
    for (int i=1;i<=nummeasures;i++)
      if (ps->len>1)
        for (int j=1;j<=ps->len;j++)
          measmaps.num(i)->setpos(ps->num(j),nv->getaxis(i));
      else {
        for (int x=0;x<windres;x++)
        for (int y=0;y<windres;y++)
          measmaps.num(i)->setpos(ps->num(1)-Pixel(windres/2,windres/2)+Pixel(x,y),nv->getaxis(i));
      }
printf("Z1\n");
  return nv;
}
开发者ID:10crimes,项目名称:code,代码行数:28,代码来源:other.c


示例13: main

void main(int argc,String *argv) {
  
  ArgParser a=ArgParser(argc,argv);
  int as=a.intafter("-as","angles examined",16);
  String bname=a.getarg("binary image");
  a.done();

  Map2d<bool> binimg=*Map2d<bool>::readfile(bname)->threshold(0.5);

  List<float> angs;
  for (float a=0;a<=pi;a+=pi/(float)as)
    angs.add(a);
  List<Map1d<int> > pps=getprojprofiles(binimg,angs);
  float lowestent=0.0;
  int lowestind=-1;
  for (int i=1;i<=pps.len;i++) {
//    Map2d<bool> d=pps.p2num(i)->draw();
    float ent=pps.p2num(i)->entropy();
    if (ent<lowestent) {
      lowestent=ent;
      lowestind=i;
    }
//    jfont.writeString(Sformat("%.5f",ent),&d,0,12,10.0,true);
//    d.writefile(getnextfilename("pp","bmp"));
//    d.freedom();
  }
  float ang=lowestind*pi/(float)as;
  Pixel cen=Pixel(binimg.width/2,binimg.height/2);
  Pixel diff=Pixel(V2d::angle(ang)*binimg.width);
  binimg.line(cen-diff,cen+diff,true);
  jfont.writeString(Sformat("entropy=%.5f",lowestent),&binimg,0,10,8.0,true);
  binimg.writefile("result.bmp");
  printf("Lowest was %i with %.5f\n",lowestind,lowestent);

}
开发者ID:10crimes,项目名称:code,代码行数:35,代码来源:pp001.c


示例14: GetPixel

void Image::Shift(double sx, double sy)
{
  for(int y = 0; y < height; y++) {
    int y_ = (0 < sy) ? height - 1 - y : y;

    for(int x = 0; x < width; x++) {
      int x_ = (0 < sx) ? width - 1 - x : x;

      if(sx == floor(sx) && sy == floor(sy))
        GetPixel(x_, y_) = (ValidCoord(x_ - (int) sx, y_ - (int) sy)) 
          ? GetPixel(x_ - (int) sx, y_ - (int) sy) : Pixel(0, 0, 0);

      else {
        if(sampling_method == IMAGE_SAMPLING_HAT) {
          if(ValidCoord(x_ - (int) sx, y_ - (int) sy)) {
            float h_r, h_g, h_b, h_all, h_tmp;
            h_r = h_g = h_b = h_all = 0.0f;
            for(int c = -1; c < 2; c++) {
              for(int r = -1; r < 2; r++) {
                if(ValidCoord(x_ - (int) sx + r, y_ - (int) sy + c)) {
                  h_tmp = hat(-((int) sx) + r + (float) sx)
                    * hat(-((int) sy) + c + (float) sy);
                  h_all += h_tmp;
                  h_r += (float) GetPixel(x_ - (int) sx + r, y_ - (int) sy + c).r * h_tmp;
                  h_g += (float) GetPixel(x_ - (int) sx + r, y_ - (int) sy + c).g * h_tmp;
                  h_b += (float) GetPixel(x_ - (int) sx + r, y_ - (int) sy + c).b * h_tmp;
                }
              }
            }
            GetPixel(x_, y_).SetClamp(h_r / h_all, h_g / h_all, h_b / h_all);
          }
          else GetPixel(x_, y_) = Pixel(0, 0, 0);
        }
        else if (sampling_method == IMAGE_SAMPLING_MITCHELL) {
          if (ValidCoord(x_ - (int) sx, y_ - (int) sy)) {
            float h_r, h_g, h_b, h_all, h_tmp;
            h_r = h_g = h_b = h_all = 0.0f;
            for(int c = -4; c < 5; c++) {
              for(int r = -4; r < 5; r++) {
                if(ValidCoord(x_ - (int) sx + r, y_ - (int) sy + c)) {
                  h_tmp = mitchell(-((int) sx) + r + (float) sx)
                    * mitchell(-((int) sy) + c + (float) sy);
                  h_all += h_tmp;
                  h_r += (float) GetPixel(x_ - (int) sx + r, y_ - (int) sy + c).r * h_tmp;
                  h_g += (float) GetPixel(x_ - (int) sx + r, y_ - (int) sy + c).g * h_tmp;
                  h_b += (float) GetPixel(x_ - (int) sx + r, y_ - (int) sy + c).b * h_tmp;
                }
              }
            }
            GetPixel(x_, y_).SetClamp(h_r / h_all, h_g / h_all, h_b / h_all);
          }
          else GetPixel(x_, y_) = Pixel(0, 0, 0);
        }
      }
    }
  }
}
开发者ID:aqchin,项目名称:imagesignal,代码行数:57,代码来源:image.cpp


示例15: arrow

 virtual void arrow(Pixel a,Pixel b,myRGB c) {
   this->line(a,b,c);
   V2d diff=V2d(b-a);
   V2d perp=V2d(diff.y,-diff.x);
   V2d l=V2d(a)+0.9*diff+perp*0.1*diff.mag();
   V2d r=V2d(a)+0.9*diff-perp*0.1*diff.mag();
   this->line(b,Pixel(l),c);
   this->line(b,Pixel(r),c);
 }
开发者ID:10crimes,项目名称:code,代码行数:9,代码来源:writeable.c


示例16: opencircle

void opencircle(int x,int y,float r,CT c) {
  Pixel last=Pixel(x,y+r);
  int steps=4+r/2;
  for (int i=1;i<=steps;i++) {
    float a=2.0*pi*(float)i/(float)steps;
    Pixel next=Pixel(x+r*sin(a),y+r*cos(a));
    line(last,next,c);
    last=next;
  }
}
开发者ID:10crimes,项目名称:code,代码行数:10,代码来源:writeable.c


示例17: Pixel

void IPLCanny::trace( int x, int y, double lowThreshold, IPLOrientedImage* dI, IPLImagePlane* image )
{
    int width = dI->width();
    int height = dI->height();
    Queue queue;
    queue.push_back( Pixel( x,y ) );
    while( ! queue.empty() )
    {
        Pixel c = queue.front(); queue.pop_front();
        if( c.x<width && c.x >=0 && c.y<height && c.y>=0 )
        {
            if( dI->magnitude(c.x,c.y)>lowThreshold && (! image->p(c.x,c.y)) )
            {
                image->p(c.x,c.y) = 255;
                queue.push_back( Pixel( c.x+1, c.y ) );
                queue.push_back( Pixel( c.x, c.y+1 ) );
                queue.push_back( Pixel( c.x-1, c.y ) );
                queue.push_back( Pixel( c.x, c.y-1 ) );
                queue.push_back( Pixel( c.x+1, c.y+1 ) );
                queue.push_back( Pixel( c.x-1, c.y+1 ) );
                queue.push_back( Pixel( c.x-1, c.y-1 ) );
                queue.push_back( Pixel( c.x+1, c.y-1 ) );
            }
        }
    }
}
开发者ID:rodoviario,项目名称:ImagePlay,代码行数:26,代码来源:IPLCanny.cpp


示例18: Pixel

void Object::Circle(u32 X, u32 Y, u32 r, u32 Color){
	u32 rr = r*r;
	for(u32 y=0;y<r;y++){
		u32 width=sqrt(rr-y*y);
		for(u32 x=0;x<width;x++){
			Pixel(X+x, Y+y, Color);
			Pixel(X+x, Y-y, Color);
			Pixel(X-x, Y+y, Color);
			Pixel(X-x, Y-y, Color);
		}
	}
}
开发者ID:wargio,项目名称:NoRSX,代码行数:12,代码来源:Objects.cpp


示例19: Brighten

void R2Image::
Brighten(double factor)
{
  // Brighten the image by multiplying each pixel component by the factor.
  // This is implemented for you as an example of how to access and set pixels
  for (int i = 0; i < width; i++) {
    for (int j = 0;  j < height; j++) {
      Pixel(i,j) *= factor;
      Pixel(i,j).Clamp();
    }
  }
}
开发者ID:mileswu,项目名称:cos426,代码行数:12,代码来源:R2Image.cpp


示例20: RadarColor

namespace Colors {
    const Pixel RadarColor(10, 25, 10, 0);
    const Pixel RadarEnd(132, 132, 132, 0);
    const Pixel RadarBorder(132, 132, 132, 0);
    const Pixel RadarWall(90, 90, 90, 0);
    const Pixel SafeColor(24, 82, 24, 0);
    const Pixel EnemyColor[2] = { Pixel(82, 82, 214, 0), Pixel(165,165,255,0) };
    const Pixel EnemyBallColor(255, 57, 74, 0);
    const Pixel EnergyColor[2] = { Pixel(181, 181, 255, 0), Pixel(99, 99, 206, 0) };
    const Pixel XRadarOn(41, 107, 41, 0);
    const Pixel XRadarOff(24, 82, 24, 0);
}
开发者ID:aurickq,项目名称:monkeybot,代码行数:12,代码来源:Colors.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PlaceWindow函数代码示例发布时间:2022-05-30
下一篇:
C++ Pipe_Unfreeze函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap