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


C++ CreateImage函数代码示例

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


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

示例1: memset

//骨架化
void CImageProcess::Thinning(Image &source, Image &dst){
	memset(dst._pData, 0, dst._height * dst._width);
	IplImage *tmp = CreateImage(source);
	IplImage *tmp_d = CreateImage(dst);
	cv::Mat src(tmp, 0);
	cv::Mat	dst_t(tmp_d);
	dst_t = src.clone();
	dst_t /= 255;         // convert to binary image

	cv::Mat prev = cv::Mat::zeros(dst_t.size(), CV_8UC1);
	cv::Mat diff;

	do {
		ThinningIteration(dst_t, 0);
		ThinningIteration(dst_t, 1);
		cv::absdiff(dst_t, prev, diff);
		dst_t.copyTo(prev);
	} 
	while (cv::countNonZero(diff) > 0);

	dst_t *= 255;
	IplImage tmp_(dst_t);
	IplImge2Image(&tmp_, dst);
	ReleaseUserImage(&tmp);
	ReleaseUserImage(&tmp_d);
}
开发者ID:shengdewu,项目名称:repository,代码行数:27,代码来源:ImageProcess.cpp

示例2: InitInterface_RR

void InitInterface_RR(string iniName,ref myCh,ref enemyCh)
{
	refMyCharacter = myCh;
	refEnemyCharacter = enemyCh;
    GameInterface.title = "titleRansack";

    SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName);
    SetVariable();

	ref shipRef = GetShipByType(sti(refMyCharacter.ship.Type));
	CreateImage("myShip","SHIPS",shipRef.name,32,39,160,167);
    CreateImage("myFace","FACE128_"+refMyCharacter.FaceId,"face",164,39,292,167);
    CreateString(TRUE,"MyShipType",XI_ConvertString(shipRef.Name),FONT_NORMAL,COLOR_NORMAL,96,140,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(TRUE,"MyShipName",refMyCharacter.ship.Name,FONT_NORMAL,COLOR_NORMAL,177,198,SCRIPT_ALIGN_CENTER,1.0);

	shipRef = GetShipByType(sti(refEnemyCharacter.ship.Type));
	CreateImage("enemyShip","SHIPS",shipRef.name,480,39,608,167);
    CreateImage("enemyFace","FACE128_"+refEnemyCharacter.FaceId,"face",348,39,476,167);
    CreateString(TRUE,"EnemyShipType",XI_ConvertString(shipRef.Name),FONT_NORMAL,COLOR_NORMAL,544,140,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(TRUE,"EnemyShipName",refEnemyCharacter.ship.Name,FONT_NORMAL,COLOR_NORMAL,463,198,SCRIPT_ALIGN_CENTER,1.0);

	CreateString(TRUE,"String1",XI_ConvertString(str1),FONT_NORMAL,COLOR_NORMAL,320,240,SCRIPT_ALIGN_CENTER,1.0);
	CreateString(TRUE,"String2",XI_ConvertString(str2),FONT_NORMAL,COLOR_NORMAL,320,268,SCRIPT_ALIGN_CENTER,1.0);
	CreateString(TRUE,"String3",XI_ConvertString(str3_1)+" "+nSurrenderedMen+" "+XI_ConvertString(str3_2),FONT_NORMAL,COLOR_NORMAL,320,296,SCRIPT_ALIGN_CENTER,1.0);

	SetEventHandler("InterfaceBreak","ProcessCancelExit",0);
    SetEventHandler("InterfaceCancel","ProcessCancelExit",0);
	SetEventHandler("KillPress","KillProcess",0);
	SetEventHandler("SlavesPress","SlavesProcess",0);
}
开发者ID:ekuznets,项目名称:PKM2,代码行数:30,代码来源:ransack_crew.c

示例3: RegionsToSIFTDescriptors

void RegionsToSIFTDescriptors( PStack regions, PStack descriptors, int pb, int ob, int psize ) {
	
	if ( regions == NULL || descriptors == NULL ) return;
	
	if ( psize % 2 == 0 ) psize++;
	Image patch = CreateImage(psize*sqrt(2),psize*sqrt(2));
	Image rpatch = CreateImage(psize,psize);
	FStack orientations = NewFStack(15);
	
	int k;
	
	for (k=0;k<regions->stacksize;k++) {
		Region region = regions->items[k];
		RegionToPatch(region,region->image,patch,6.0);
		DeterminePatchOrientations(patch,orientations);
		while ( !FStackEmpty(orientations) ) {
			float orientation = PopFStack(orientations);
			RotateImage(patch,rpatch,orientation);
			float * newDescriptor = PCADescriptorFromPatch(rpatch);
			PushPStack(descriptors,NewDescriptor(region,36,3,newDescriptor));
		}
	}
	
	FreeFStack(orientations);
	FreeImage(patch); FreeImage(rpatch);

}
开发者ID:kraftp,项目名称:Leginon-Feature-Detection-Modification,代码行数:27,代码来源:csift.c

示例4: FindMaxMin

/* Find the local maxima and minima of the DOG images in scale space.
   Return the keypoints for these locations, added to existing "keys".
*/
KKeypoint FindMaxMin(Image *dogs, Image *blur, float octSize, KKeypoint keys)
{
   int s, r, c, rows, cols;
   float val, **pix;
   Image map, grad, ori;
   
   rows = dogs[0]->rows;
   cols = dogs[0]->cols;

   /* Create an image map in which locations that have a keypoint are
      marked with value 1.0, to prevent two keypoints being located at
      same position.  This may seem an inefficient data structure, but
      does not add significant overhead.
   */
   map = CreateImage(rows, cols, IMAGE_POOL);
   for (r = 0; r < rows; r++)
     for (c = 0; c < cols; c++)
       map->pixels[r][c] = 0.0;

   /* Search through each scale, leaving 1 scale below and 1 above.
      There are Scales+2 dog images.
   */
   for (s = 1; s < Scales+1; s++) {
      
     /* For each intermediate image, compute gradient and orientation
	images to be used for keypoint description.
     */
     grad = CreateImage(rows, cols, IMAGE_POOL);
     ori = CreateImage(rows, cols, IMAGE_POOL);
     GradOriImages(blur[s], grad, ori);

     pix = dogs[s]->pixels;   /* Pointer to pixels for this scale. */

     /* Only find peaks at least BorderDist samples from image border, as
	peaks centered close to the border will lack stability.
     */
     assert(BorderDist >= 2);
     for (r = BorderDist; r < rows - BorderDist; r++)
       for (c = BorderDist; c < cols - BorderDist; c++) {
	 val = pix[r][c];       /* Pixel value at (r,c) position. */

	 /* DOG magnitude must be above 0.8 * PeakThresh threshold
	    (precise threshold check will be done once peak
	    interpolation is performed).  Then check whether this
	    point is a peak in 3x3 region at each level, and is not
	    on an elongated edge.
	 */
	 if (fabs(val) > 0.8 * PeakThresh  &&
	     LocalMaxMin(val, dogs[s], r, c) &&
	     LocalMaxMin(val, dogs[s-1], r, c) &&
	     LocalMaxMin(val, dogs[s+1], r, c) &&
	     NotOnEdge(dogs[s], r, c))
	   keys = InterpKeyPoint(dogs, s, r, c, grad, ori, map, octSize,
				 keys, 5);
       }
   }
   return keys;
}
开发者ID:BOTSlab,项目名称:bupimo_src,代码行数:61,代码来源:key.c

示例5: CreateImage

Image *WaterGray(Image *img, Image *marker, AdjRel *A)
{
  Image *cost=NULL,*label=NULL, *pred=NULL;
  GQueue *Q=NULL;
  int i,p,q,tmp,n,lambda=1;
  Pixel u,v;

  n     = img->ncols*img->nrows;
  cost  = CreateImage(img->ncols,img->nrows);
  label = CreateImage(img->ncols,img->nrows);
  pred  = CreateImage(img->ncols,img->nrows);
  Q     = CreateGQueue(MaximumValue(marker)+2,n,cost->val);

  // Trivial path initialization

  for (p=0; p < n; p++) {
    cost->val[p]=marker->val[p]+1;
    pred->val[p]=NIL;
    InsertGQueue(&Q,p);
  }

  // Path propagation

  while(!EmptyGQueue(Q)) {
    p=RemoveGQueue(Q);
    if (pred->val[p]==NIL) { // on-the-fly root detection
      cost->val[p] =img->val[p];
      label->val[p]=lambda; lambda++;
    }
    u.x = p%img->ncols;
    u.y = p/img->ncols;
    for (i=1; i < A->n; i++){
      v.x = u.x + A->dx[i];
      v.y = u.y + A->dy[i];
      if (ValidPixel(img,v.x,v.y)){
	q = v.x + img->tbrow[v.y];
	if (cost->val[q] > cost->val[p]){
	  tmp = MAX(cost->val[p],img->val[q]);
	  if (tmp < cost->val[q]){
	    RemoveGQueueElem(Q,q);
	    pred->val[q]  = p;
	    label->val[q] = label->val[p];
	    cost->val[q]  = tmp;
	    InsertGQueue(&Q,q);
	  }
	}
      }
    }
  }
  DestroyGQueue(&Q);
  DestroyImage(&cost);
  DestroyImage(&pred);

  return(label);
}
开发者ID:afalcao,项目名称:ift-demo,代码行数:55,代码来源:watergray.c

示例6: image

void
PNGTests::testWriter() {
  static const int width  = 256;
  static const int height = 256;

  // create an image and fill it with random data
  auto_ptr<Image> image(CreateImage(width, height, PF_R8G8B8A8));
  setRandomBytes((byte*)image->getPixels(), width * height * 4);

  // generate filename
  char* filename = tmpnam(0);
  CPPUNIT_ASSERT_MESSAGE("opening temporary file", filename != 0);

  // save image
  CPPUNIT_ASSERT(SaveImage(filename, FF_PNG, image.get()) == true);

  // load it back
  auto_ptr<Image> img2(OpenImage(filename, PF_R8G8B8A8));
  CPPUNIT_ASSERT_MESSAGE("reloading image file", img2.get() != 0);

  AssertImagesEqual(
    "comparing saved with loaded",
    image.get(),
    img2.get());

  // force pixel format conversion (don't destroy the old image)
  auto_ptr<Image> img3(OpenImage(filename, PF_R8G8B8));
  CPPUNIT_ASSERT(SaveImage(filename, FF_PNG, img3.get()) == true);

  remove(filename);


  //== PALETTIZED SAVING TEST ==
  // disabled until loading palettized PNGs with a correct palette format
  // is implemented.
#if 0
  char* plt_filename = tmpnam(0);
  CPPUNIT_ASSERT_MESSAGE("opening temporary file (palette)", plt_filename != 0);
  auto_ptr<Image> plt(CreateImage(256, 256, PF_I8, 256, PF_R8G8B8));
  setRandomBytes((byte*)plt->getPixels(), 256 * 256);
  setRandomBytes((byte*)plt->getPalette(), 256);

  CPPUNIT_ASSERT(SaveImage(plt_filename, FF_PNG, plt.get()) == true);

  auto_ptr<Image> plt2(OpenImage(plt_filename, FF_PNG));
  CPPUNIT_ASSERT_MESSAGE("reloading palettized image", plt2.get() != 0);
  CPPUNIT_ASSERT(plt2->getPaletteSize() == 256);
  CPPUNIT_ASSERT(plt2->getPaletteFormat() == PF_R8G8B8);
  CPPUNIT_ASSERT(plt2->getFormat() == PF_I8);
  AssertImagesEqual("Comparing palettized image", plt.get(), plt2.get());

  remove(plt_filename);
#endif
}
开发者ID:marcclintdion,项目名称:iOS_WIN3,代码行数:54,代码来源:PNGTests.cpp

示例7: main

int main() {
	Handle splash = 0;
	CreateImage(splash, splash_png, sizeof(splash_png));
	DrawImage(splash, 0, 0);
	UpdateScreen();
	do {
		Wait(WAIT_KEY);
		if(GetKeys() & MAK_FIRE)
			break;
	} while(1);
	DestroyObject(splash);

	Handle backg = 0;
	CreateImage(backg, ttsdemo_png, sizeof(ttsdemo_png));
	DrawImage(backg, 0, 0);
	UpdateScreen();

	int oldKeys = GetKeys();
	while(1) {
		Wait(WAIT_KEY);
		int newKeys = GetKeys();
		int downedKeys = newKeys & (~oldKeys);
		oldKeys = newKeys;

		if(downedKeys)
			StopSpeaking();

		if(downedKeys & MAK_FIRE) {
			StartSpeaking("Du står i korsningen Götgatan Åsögatan riktning Slussen. En meter till "
				"vänster om dig är ett övergångställe, för passage över Götgatan med "
				"tryckknapp för gångtrafikanter. Vid trottoarkanten löper en cykelväg.");
		}
		if(downedKeys & MAK_DOWN) {
			StartSpeaking("Tre meter bakom dig i riktning Skanstull är ett övergångställe för "
				"passage över Åsögatan.");
		}
		if(downedKeys & MAK_UP) {
			StartSpeaking("Trottoaren rakt framfortsätter 50 meter till nästa korsning Folkungagatan. "
				"På andra sidan av övergångstället finns ingångar till tunnelbanestation "
				"medborgarplatsen.");
		}
		/*if(downedKeys & MAK_RIGHT) {
		StartSpeaking("Am I right? Of course I'm right.");
		}
		if(downedKeys & MAK_LEFT) {
		StartSpeaking("No one is left behind.");
		}*/
	}
	return 0;
}
开发者ID:Felard,项目名称:MoSync,代码行数:50,代码来源:ttsdemo.c

示例8: Slider

const Entity EntityBuilder::CreateSlider(const XMFLOAT3& pos, float width, float height, float minv, float maxv, float defval, float size1, bool real, const std::string& text, float fontSize, float size2, std::function<void()> change, const  XMFLOAT4& textColor)
{
	Slider* s = nullptr;
	try { s = new Slider(minv,maxv,width, height,defval, real, std::move(change)); }
	catch (std::exception& e) { e;SAFE_DELETE(s); throw ErrorMsg(1500003, L"Could not create slider"); }

	Entity ent = _entity.Create();
	_transform->CreateTransform(ent);
	Entity rail = CreateImage(XMFLOAT3(size2, height / 2.0f - height / 16.0f, 0.0f), width+ height / 4.0f, height / 8.0f, "Assets/Textures/Light_Bar.png");
	Entity slidebar = CreateImage(XMFLOAT3(size2+width*((defval-minv)/(maxv-minv)), height/2.0f- height/4.0f, 0.0f), height / 2.0f, height / 2.0f, "Assets/Textures/Slide_Bar.png");
	Entity la = CreateLabel(XMFLOAT3(0.0f,0.0f,0.0f), text, fontSize, textColor, size2, height, "");
	Entity vtext = CreateLabel(XMFLOAT3(width + size2 + height / 2.0f, 0.0f, 0.0f), (real) ? to_string((double)defval) : to_string((int)defval), fontSize, textColor, size1, height, "");
	
	_transform->BindChild(ent, slidebar);
	_transform->BindChild(ent, la);
	_transform->BindChild(ent, vtext);
	_transform->BindChild(ent, rail);

	_transform->SetPosition(ent, pos);

	_controller->AddSlider(ent, s);

	auto i = System::GetInput();
	_event->BindEvent(slidebar, EventManager::EventType::Drag,
		[s,this, slidebar,i,size2,vtext]() 
	{
		int x, y;
		i->GetMouseDiff(x, y);
		float currp = s->width*((s->curr - s->minv) / (s->maxv - s->minv));
		currp += x;
		s->curr = (currp / s->width)*(s->maxv - s->minv) + s->minv;
		if (s->curr >= s->maxv)
			s->curr = s->maxv;
		else if (s->curr <= s->minv)
			s->curr = s->minv;
		else
		{
			this->_transform->SetPosition(slidebar, XMFLOAT3(size2 + currp, s->height / 2.0f - s->height / 4.0f, 0.0f));
			
			
		}
		s->change();
		this->_text->ChangeText(vtext, (s->real) ? to_string((double)s->curr) : to_string((int)s->curr));
	});

	return ent;

}
开发者ID:dastyk,项目名称:Radiant,代码行数:48,代码来源:EntityBuilder.cpp

示例9: CreateImage

void CImageProcess::ZoomImage(Image &in, Image &out, const char *cName)
{
	IplImage *image = CreateImage(in);
	IplImage *pDst = CreateImage(out);

	cvResize(image, pDst, CV_INTER_AREA );

	if(cName){
		cvNamedWindow(cName, CV_WINDOW_AUTOSIZE);
		cvShowImage(cName,pDst);
	}


	//cvSaveImage("1.png",pDst);
	IplImge2Image(pDst, out);
}
开发者ID:shengdewu,项目名称:repository,代码行数:16,代码来源:ImageProcess.cpp

示例10: main

int main()
{
	glfwInit();

	window = glfwCreateWindow(IMAGE_WIDTH,IMAGE_HEIGHT,"MTF",NULL,NULL);
	if (!window)
		return 100;

	LoadConstants();
	
	glfwSetCursorPosCallback(window,glfwMouse);
	glfwSetWindowSizeCallback(window,glfwResize);
	glfwSetKeyCallback(window,glfwKeyboard);
	glfwMakeContextCurrent(window);

	glClearColor(1.0,0.0,0.0,1.0);
	glViewport(0,0,IMAGE_WIDTH,IMAGE_HEIGHT);
	CreateImage(IMAGE_WIDTH,IMAGE_HEIGHT);
	CreateMTFImage();
	SetImageData(IMAGE_WIDTH,IMAGE_HEIGHT,image_data);


	while(true)
	{
		glClear(GL_COLOR_BUFFER_BIT);

		DrawImage();

		glfwSwapBuffers(window);
		glfwPollEvents();

		if (glfwWindowShouldClose(window))
			return 0;
	}
}
开发者ID:felknight,项目名称:VisionComputacional,代码行数:35,代码来源:MTF.cpp

示例11: image

//----------------------------------------------------------------------------
void AdaptiveSkeletonClimbing3::Test ()
{
    int N = 6, bound = (1 << N) + 1;
    ImageInt3D image(bound, bound, bound);
    CreateImage(image);

    float* data = new1<float>(image.GetQuantity());
    int i;
    for (i = 0; i < image.GetQuantity(); ++i)
    {
        data[i] = (float)image[i];
    }

    Climb3D asc(N, data);
    float level = 349.5f;
    int depth = -1;

    int numVertices, numTriangles;
    Vector3f* vertices = 0;
    TriangleKey* triangles = 0;
    asc.ExtractContour(level, depth, numVertices, vertices, numTriangles,
        triangles);
    asc.MakeUnique(numVertices, vertices, numTriangles, triangles);
    asc.OrientTriangles(vertices, numTriangles, triangles, false);

    Vector3f* normals = asc.ComputeNormals(numVertices, vertices,
        numTriangles, triangles);

    std::ofstream outFile("vtdata.txt");
    outFile << numVertices << std::endl;
    for (i = 0; i < numVertices; ++i)
    {
        Vector3f& vertex = vertices[i];
        outFile << vertex[0] << " " << vertex[1] << " " << vertex[2]
            << std::endl;
    }
    outFile << std::endl;

    for (i = 0; i < numVertices; ++i)
    {
        Vector3f& normal = normals[i];
        outFile << normal[0] << " " << normal[1] << " " << normal[2]
            << std::endl;
    }
    outFile << std::endl;

    outFile << numTriangles << std::endl;
    for (i = 0; i < numTriangles; ++i)
    {
        TriangleKey& triangle = triangles[i];
        outFile << triangle.V[0] << " " << triangle.V[1] << " "
            << triangle.V[2] << std::endl;
    }

    delete1(normals);
    delete1(triangles);
    delete1(vertices);

    asc.PrintBoxes("boxes.txt");
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:61,代码来源:AdaptiveSkeletonClimbing3.cpp

示例12: CreateImage

CImage::CImage(const CImage &oCopy, int iZoom) {
	// Set the relative parameters
	m_eImageType = oCopy.m_eImageType;
	m_iWidth = oCopy.m_iWidth;
	m_iHeight = oCopy.m_iHeight;
	// Allocate the memory
	IRESULT eResult = CreateImage();
	// If image data has been allocated ok, copy over
	if (eResult == I_OK) {
		memcpy(m_pData, oCopy.m_pData, m_iDataSize * 4);
		if ((m_eImageType == IT_PALETTE) && (oCopy.m_poPalette))
			m_poPalette->Copy(oCopy.m_poPalette);
	}
	// Scale the copied image
	if (eResult == I_OK) {
		int iWidth = m_iWidth, iHeight = m_iHeight;
		while (iZoom) {
			if (iZoom > 0) {
				iZoom--;
				iWidth <<= 1;
				iHeight <<= 1;
			}
			else {
				iZoom++;
				iWidth >>= 1;
				iHeight >>= 1;
			}
		}
		eResult = Scale(iWidth, iHeight);
	}
开发者ID:Floppy,项目名称:Vapour,代码行数:30,代码来源:Image.cpp

示例13: main

int main(int, char* [] )
{
  typedef itk::Image<unsigned char, 2> ImageType;
  ImageType::Pointer image = ImageType::New();
  CreateImage(image.GetPointer());

  const unsigned int numberOfIterations = 1e5;

  // Create a list of the indices in the image
  itk::ImageRegionConstIteratorWithIndex<ImageType> imageIterator(image, image->GetLargestPossibleRegion());
  std::vector<itk::Index<2> > indices;

  while(!imageIterator.IsAtEnd())
  {
    indices.push_back(imageIterator.GetIndex());
    ++imageIterator;
  }

  unsigned int total = 0; // To make sure the loop isn't optimized away
  for(unsigned int i = 0; i < numberOfIterations; ++i)
  {
//    total += Iterator(image.GetPointer()); // 1.4s
    total += GetPixel(image.GetPointer(), indices); // 5.9s
  }

  std::cout << "total " << total << std::endl; // To make sure the loop isn't optimized away

  return 0;
}
开发者ID:daviddoria,项目名称:ITKTimingDemos,代码行数:29,代码来源:GetPixelVsIterator.cpp

示例14: CreateImage

	CImageTilePattern*CDocument::CreateHatchPattern(double dW, double dH, const BYTE& nR1, const BYTE& nG1, const BYTE& nB1, const BYTE& nAlpha1, const BYTE& nR2, const BYTE& nG2, const BYTE& nB2, const BYTE& nAlpha2, const std::wstring& wsHatch)
	{
		// TODO: Надо бы сделать мап, чтобы не создавать одинаковых паттернов

		CImageDict* pImage = CreateImage();
		BYTE* pBuffer = new BYTE[3 * HATCH_TX_SIZE * HATCH_TX_SIZE];
		if (!pBuffer)
			return NULL;

		TColor oColor1(nR1, nG1, nB1);
		TColor oColor2(nR2, nG2, nB2);
		agg::GetHatchPattern<TColor>(wsHatch, (TColor*)pBuffer, oColor1, oColor2);
		pImage->LoadRaw(pBuffer, 3 * HATCH_TX_SIZE * HATCH_TX_SIZE, HATCH_TX_SIZE, HATCH_TX_SIZE);
		delete[] pBuffer;

		if (255 != nAlpha1 || 255 != nAlpha2)
		{
			BYTE* pSMask = new BYTE[HATCH_TX_SIZE * HATCH_TX_SIZE];
			if (pSMask)
			{
				agg::GetHatchPattern<BYTE>(wsHatch, pSMask, nAlpha1, nAlpha2);
				pImage->LoadSMask(pSMask, (unsigned int)HATCH_TX_SIZE * HATCH_TX_SIZE, (unsigned int)HATCH_TX_SIZE, (unsigned int)HATCH_TX_SIZE);
				delete[] pSMask;
			}
		}

		return CreateImageTilePattern(dW, dH, pImage, NULL, imagetilepatterntype_Default);
	}
开发者ID:ONLYOFFICE,项目名称:core,代码行数:28,代码来源:Document.cpp

示例15: DoubleSize

/* Double image size. Use linear interpolation between closest pixels.
   Size is two rows and columns short of double to simplify interpolation.
*/
SiftImage DoubleSize(SiftImage image)
{
   int rows, cols, nrows, ncols, r, c, r2, c2;
   double **im, **newc;
   SiftImage newimage;
   
   rows = image->rows;
   cols = image->cols;
   nrows = 2 * rows - 2;
   ncols = 2 * cols - 2;
   newimage = CreateImage(nrows, ncols, IMAGE_POOL);
   im = image->pixels;
   newc = newimage->pixels;
   
   for (r = 0; r < rows - 1; r++)
      for (c = 0; c < cols - 1; c++) {
         r2 = 2 * r;
         c2 = 2 * c;
         newc[r2][c2] = im[r][c];
         newc[r2+1][c2] = 0.5 * (im[r][c] + im[r+1][c]);
         newc[r2][c2+1] = 0.5 * (im[r][c] + im[r][c+1]);
         newc[r2+1][c2+1] = 0.25 * (im[r][c] + im[r+1][c] + im[r][c+1] +
            im[r+1][c+1]);
      }
   return newimage;
}
开发者ID:oakfr,项目名称:omni3d,代码行数:29,代码来源:sift_util.cpp


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