//
// GetStaticImage
//
// Return a copy of the current image in the video renderer
//
HRESULT CVideoText::GetStaticImage(long *pBufferSize,long *pDIBImage)
{
    NOTE("Entering GetStaticImage");

    IMediaSample *pMediaSample;
    pMediaSample = m_pRenderer->GetCurrentSample();
    RECT SourceRect;

    // Is there an image available

    if (pMediaSample == NULL)
        return E_UNEXPECTED;

    // Find a scaled source rectangle for the current bitmap

    m_pRenderer->m_DrawImage.GetSourceRect(&SourceRect);
    SourceRect = m_pRenderer->m_DrawImage.ScaleSourceRect(&SourceRect);
    VIDEOINFOHEADER *pVideoInfo = (VIDEOINFOHEADER *) m_pRenderer->m_mtIn.Format();

    // Call the base class helper method to do the work

    HRESULT hr = CopyImage(pMediaSample,        // Buffer containing image
                           pVideoInfo,          // Type representing bitmap
                           pBufferSize,         // Size of buffer for DIB
                           (BYTE*) pDIBImage,   // Data buffer for output
                           &SourceRect);        // Current source position

    pMediaSample->Release();
    return hr;

} // GetStaticImage
Esempio n. 2
0
void khm_statusbar_set_part(int id, HICON icon, wchar_t * text) {
    int idx;

    if (!khm_hwnd_statusbar)
        return;

    idx = sb_find_index(id);
    if(idx < 0)
        return;

    if (khm_statusbar_parts[idx].hIcon != NULL) {
        DestroyIcon(khm_statusbar_parts[idx].hIcon);
        khm_statusbar_parts[idx].hIcon = NULL;
    }

    if (icon) {
        khm_statusbar_parts[idx].hIcon = CopyImage(icon, IMAGE_ICON,
                                                   GetSystemMetrics(SM_CXSMICON),
                                                   GetSystemMetrics(SM_CYSMICON),
                                                   LR_COPYFROMRESOURCE);
    }

    SendMessage(khm_hwnd_statusbar,
                SB_SETICON,
                idx,
                (LPARAM) (khm_statusbar_parts[idx].hIcon ? khm_statusbar_parts[idx].hIcon:icon));

    SendMessage(khm_hwnd_statusbar,
                SB_SETTEXT,
                idx,
                (LPARAM) text);
}
Esempio n. 3
0
void InitMain()
{
  bInitMain=TRUE;

  //Get 16x16 icon
  hMainSmallIcon=(HICON)CopyImage((HANDLE)hMainIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE);

  //Register unique message
  if (!nMinimizeToTrayMessage)
    nMinimizeToTrayMessage=RegisterWindowMessageA("MinimizeToTray");

  //Popup menu
  if (!hMenuList)
  {
    if (hMenuList=CreatePopupMenu())
    {
      AppendMenuWide(hMenuList, MF_STRING, IDC_ITEM_RESTORE, GetLangStringW(wLangModule, STRID_MENU_RESTORE));
      AppendMenuWide(hMenuList, MF_SEPARATOR, (UINT)-1, NULL);
      AppendMenuWide(hMenuList, MF_STRING, IDC_ITEM_EXIT, GetLangStringW(wLangModule, STRID_MENU_EXIT));
    }
  }

  //SubClass
  NewMainProcData=NULL;
  SendMessage(hMainWnd, AKD_SETMAINPROC, (WPARAM)NewEditParentProc, (LPARAM)&NewMainProcData);

  if (nMDI == WMD_MDI)
  {
    NewFrameProcData=NULL;
    SendMessage(hMainWnd, AKD_SETFRAMEPROC, (WPARAM)NewEditParentProc, (LPARAM)&NewFrameProcData);
  }
}
Esempio n. 4
0
HBITMAP BM_Copy(HBITMAP hbm)
{
    HBITMAP ret;
    
    ret = CopyImage(hbm, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
    return ret;
}
bool CopyImageToClipboard(HBITMAP hbmp, bool appendOnly)
{
    if (!appendOnly) {
        if (!OpenClipboard(NULL))
            return false;
        EmptyClipboard();
    }

    bool ok = false;
    if (hbmp) {
        BITMAP bmpInfo;
        GetObject(hbmp, sizeof(BITMAP), &bmpInfo);
        if (bmpInfo.bmBits != NULL) {
            // GDI+ produced HBITMAPs are DIBs instead of DDBs which
            // aren't correctly handled by the clipboard, so create a
            // clipboard-safe clone
            ScopedGdiObj<HBITMAP> ddbBmp((HBITMAP)CopyImage(hbmp,
                IMAGE_BITMAP, bmpInfo.bmWidth, bmpInfo.bmHeight, 0));
            ok = SetClipboardData(CF_BITMAP, ddbBmp) != NULL;
        }
        else
            ok = SetClipboardData(CF_BITMAP, hbmp) != NULL;
    }

    if (!appendOnly)
        CloseClipboard();

    return ok;
}
Esempio n. 6
0
HBITMAP UIIMEdit::_LoadAnImage(IN CString filePath)
{
	HANDLE hFile = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); //从指定的路径szImagePath中读取文件句柄
	DWORD dwFileSize = GetFileSize(hFile, NULL); //获得图片文件的大小,用来分配全局内存
	HGLOBAL hImageMemory = GlobalAlloc(GMEM_MOVEABLE, dwFileSize); //给图片分配全局内存
	void *pImageMemory = GlobalLock(hImageMemory); //锁定内存
	DWORD dwReadedSize; //保存实际读取的文件大小
	ReadFile(hFile, pImageMemory, dwFileSize, &dwReadedSize, NULL); //读取图片到全局内存当中
	GlobalUnlock(hImageMemory); //解锁内存
	CloseHandle(hFile); //关闭文件句柄

	HRESULT hr = NULL;
	IStream *pIStream = NULL;//创建一个IStream接口指针,用来保存图片流
	IPicture *pIPicture = NULL;//创建一个IPicture接口指针,表示图片对象

	hr = CreateStreamOnHGlobal(hImageMemory, false, &pIStream); //用全局内存初使化IStream接口指针
	ASSERT(SUCCEEDED(hr));

	hr = OleLoadPicture(pIStream, 0, false, IID_IPicture, (LPVOID*)&(pIPicture));//用OleLoadPicture获得IPicture接口指针
	ASSERT(SUCCEEDED(hr));

	HBITMAP hB = NULL;
	pIPicture->get_Handle((unsigned int*)&hB);
	// Copy the image. Necessary, because upon p's release,
	// the handle is destroyed.
	HBITMAP hBB = (HBITMAP)CopyImage(hB, IMAGE_BITMAP, 0, 0,
		LR_COPYRETURNORG);

	GlobalFree(hImageMemory); //释放全局内存
	pIStream->Release(); //释放pIStream
	pIPicture->Release(); //释放pIPictur
	return hBB;
}
Esempio n. 7
0
STDMETHODIMP LangBarButton::GetIcon(HICON *phIcon) {
	// https://msdn.microsoft.com/zh-tw/library/windows/desktop/ms628718%28v=vs.85%29.aspx
	// The caller will delete the icon when it's no longer needed.
	// However, we might still need it. So let's return a copy here.
	*phIcon = (HICON)CopyImage(icon_, IMAGE_ICON, 0, 0, 0);
	return S_OK;
}
Esempio n. 8
0
/**
 * Load a GIF image.
 * This will replace the currently-loaded image.
 * Animated GIFs are not yet supported -- only the first frame of an
 * animated GIF will be loaded.
 * @param pGifStream The GIF data buffer (may not be NULL).
 * @param pStreamLen The length of the buffer.
 * @return @c true if the load succeeded, @c false otherwise (current
 *         image will still be cleared).
 */
bool GifDecoder::Decode(const unsigned char *pGifStream, int pStreamLen)
{
	// Delete current image.
	Clean();

	bool retv = false;
	HGLOBAL buf = GlobalAlloc(GPTR, pStreamLen);
	memcpy((void*)buf, pGifStream, pStreamLen);

	IStream *stream = NULL;
	IPicture *pic = NULL;

	// We currently don't support animated GIFs, so set big delay for
	// the first frame.
	mDelay[0] = 3600000;

	// Use OleLoadPicture() to convert the GIF stream to an HBITMAP.
	if (SUCCEEDED(CreateStreamOnHGlobal(buf, false, &stream))) {
		if (SUCCEEDED(OleLoadPicture(stream, 0, false, IID_IPicture, (void**)&pic))) {
			HBITMAP hb = NULL;
			pic->get_Handle((OLE_HANDLE*)&hb);
			mBitmap[0] = (HBITMAP)CopyImage(hb, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
			retv = true;
		}
	}

	if (pic != NULL) pic->Release();
	if (stream != NULL) stream->Release();
	GlobalFree(buf);

	return retv;
}
Esempio n. 9
0
HBITMAP Timeout::LoadImageBitmap(HGLOBAL hgbl, DWORD size)
{
    HBITMAP hbmp = NULL;
    CoInitialize(NULL);
    IStream* stream;
    HRESULT hr = CreateStreamOnHGlobal(hgbl, FALSE, &stream);
    if(SUCCEEDED(hr) && stream) {
        ULARGE_INTEGER ul;
        ul.LowPart = size;
        ul.HighPart = 0;
        stream->SetSize(ul);
        IPicture* picture;
        // Load picture from stream
        hr = OleLoadPicture(stream, 0, 0, IID_IPicture, (void**)&picture);
        if(SUCCEEDED(hr) && picture) {
            // Copy picture to a bitmap resource
            HBITMAP hsrc;
            picture->get_Handle((OLE_HANDLE *)&hsrc);
            hbmp = (HBITMAP)CopyImage(hsrc, IMAGE_BITMAP, 0, 0, 0);
            picture->Release();
        }
        stream->Release();
    }
    CoUninitialize();
    return hbmp;
}
Esempio n. 10
0
/*
Calls TWAIN to actually get the image
*/
BOOL CTwain::GetImage(TW_IMAGEINFO& info)
{
HANDLE hBitmap;
	CallTwainProc(&m_AppId,&m_Source,DG_IMAGE,DAT_IMAGENATIVEXFER,MSG_GET,&hBitmap);
	switch(m_returnCode)
	{
	case TWRC_XFERDONE:
		TRACE("********** GetImage --> TWRC_XFERDONE ************\n");
			CopyImage(hBitmap,info);
			break;
	case TWRC_CANCEL:
		TRACE("GetImage --> TWRC_CANCEL.\n");
			break;
	case TWRC_FAILURE:
		TRACE("********** GetImage --> TWRC_FAILURE ************\n");
			CancelTransfer();
			return FALSE;
	default:
		TRACE("GetImage --> default.\n");
		break;
	}
	GlobalFree(hBitmap);

	TRACE("********** GetImage --> done ************\n");
	return EndTransfer();
}
Esempio n. 11
0
void ImageModel::ResetToPrevious()
{
    DeleteObject(hBms[currInd]);
    hBms[currInd] =
        (HBITMAP) CopyImage(hBms[(currInd + HISTORYSIZE - 1) % HISTORYSIZE], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
    SelectObject(hDrawingDC, hBms[currInd]);
    NotifyImageChanged();
}
Esempio n. 12
0
// Function LoadAnImage: accepts a file name and returns a HBITMAP.
// On error, it returns 0.
HBITMAP LoadAnImage(const char* FileName)
{
	// Use IPicture stuff to use JPG / GIF files
	IPicture* p;
	IStream* s;
	HGLOBAL hG;
	void* pp;
	FILE* fp;

	// Read file into memory
	fp = fopen(FileName, "rb");
	if (!fp)
	{
		return NULL;
	}

	fseek(fp,0,SEEK_END);
	int fs = ftell(fp);
	fseek(fp,0,SEEK_SET);
	hG = GlobalAlloc(GPTR,fs);
	if(!hG)
	{
		fclose(fp);
		return NULL;
	}
	pp = (void*)hG;
	fread(pp,1,fs,fp);
	fclose(fp);

	// Create an IStream so IPicture can
	CreateStreamOnHGlobal(hG, false, &s);
	if(!s)
	{
		GlobalFree(hG);
		return NULL;
	}

	OleLoadPicture(s,0,false,IID_IPicture,(void**)&p);

	if(!p)
	{
		s->Release();
		GlobalFree(hG);
		return NULL;
	}
	s->Release();
	GlobalFree(hG);

	HBITMAP hB = 0;
	p->get_Handle((unsigned int*)&hB);

	// Copy the image. Necessary, because upon p's release,
	// the handle is destroyed.
	HBITMAP hBB = (HBITMAP)CopyImage(hB, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);

	p->Release();
	return hBB;
}
Esempio n. 13
0
void FImage::CopyTo(FImage& DestImage, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace) const
{
    DestImage.SizeX = SizeX;
    DestImage.SizeY = SizeY;
    DestImage.NumSlices = NumSlices;
    DestImage.Format = DestFormat;
    DestImage.GammaSpace = DestGammaSpace;
    InitImageStorage(DestImage);
    CopyImage(*this, DestImage);
}
Esempio n. 14
0
bool DynamicAtlasRGBAImage::AddImageRect(const Size2U& size,int pitch,const MemoryData& imageData, PixelType pixelType,
								  Rect2U& outRect, bool isFlipY/*=false*/,GraphicsPixelConvertMode mode/*=PixelConvertMode::Normal*/)
{
	RETURN_FALSE_IF(size>mMaxImageSize);
	outRect=mPack.Insert(size,SkylineBinPack::LevelChoiceHeuristic::LevelBottomLeft);
	if (outRect!=Rect2U::Zero)
	{
		outRect.Size-=1;	//should -1 to remove edge
		CopyImage(outRect,imageData,pixelType,pitch,isFlipY,mode);
		return true;
	}

	RETURN_FALSE_IF(mImageSize>=mMaxImageSize);	//is full


	//try to expand
	//1.new a bigger image
	Size2U newImageSize=mImageSize;
	do 
	{
		newImageSize.Width=Math::Min((uint)Math::NextPOT(newImageSize.Width),mMaxImageSize.Width);
		newImageSize.Height=Math::Min((uint)Math::NextPOT(newImageSize.Height),mMaxImageSize.Width);
		mPack.GrowSize(mImageSize);	//not re layout the original rects,maybe do it in the future
		outRect=mPack.Insert(size,SkylineBinPack::LevelChoiceHeuristic::LevelBottomLeft);
		if (outRect!=Rect2U::Zero)
		{
			MemoryData newImageData=MemoryData::Alloc(mImageSize.Area()*BytesPerComponent());
			//2.copy image data to new image

			ImageFactory::CopyImage(newImageData,mPixelType,newImageSize,Rect2U(Point2F::Zero,mImageSize),mImageData, mPixelType,0,false,GraphicsPixelConvertMode::Normal);
			mImageSize=newImageSize;
			mImageData=newImageData;

			//draw new image
			outRect.Size-=1;//should -1 to remove edge
			CopyImage(outRect,imageData,pixelType,pitch,isFlipY,mode);
			return true;
		}

	} while (newImageSize<mMaxImageSize);

	return false;
}
Esempio n. 15
0
void FImage::CopyTo(FImage& DestImage, ERawImageFormat::Type DestFormat, bool DestSRGB) const
{
	DestImage.SizeX = SizeX;
	DestImage.SizeY = SizeY;
	DestImage.NumSlices = NumSlices;
	DestImage.Format = DestFormat;
	DestImage.bSRGB = DestSRGB;
	InitImageStorage(DestImage);
	CopyImage(*this, DestImage);
}
Esempio n. 16
0
void
resetToU1()
{
    DeleteObject(hBms[currInd]);
    hBms[currInd] =
        CopyImage(hBms[(currInd + HISTORYSIZE - 1) % HISTORYSIZE], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
    SelectObject(hDrawingDC, hBms[currInd]);
    imgXRes = GetDIBWidth(hBms[currInd]);
    imgYRes = GetDIBHeight(hBms[currInd]);
}
Esempio n. 17
0
/* Find keypoints within one octave of scale space starting with the
   given image.  The octSize parameter gives the size of each pixel
   relative to the input image.  Returns new list of keypoints after
   adding to the existing list "keys".
*/
KKeypoint OctaveKeypoints(Image image, Image *pnextImage, float octSize,
			 KKeypoint keys)
{
    int i;
    float sigmaRatio, prevSigma, increase;
    Image blur[Scales+3], dogs[Scales+2];
 
    /* Ratio of each scale to the previous one.  The parameter Scales
       determines how many scales we divide the octave into, so
          sigmaRatio ** Scales = 2.0.  
    */
    sigmaRatio = pow(2.0, 1.0 / (float) Scales);

    /* Build array "blur", holding Scales+3 blurred versions of the image. */
    blur[0] = image;          /* First level is input to this routine. */
    prevSigma = InitSigma;    /* Input image has InitSigma smoothing. */

    /* Form each level by adding incremental blur from previous level.
       Increase in blur is from prevSigma to prevSigma * sigmaRatio, so
       increase**2 + prevSigma**2 = (prevSigma * sigmaRatio)**2
    */
    for (i = 1; i < Scales + 3; i++) {
      blur[i] = CopyImage(blur[i-1], IMAGE_POOL);
      increase = prevSigma * sqrt(sigmaRatio * sigmaRatio - 1.0);
      GaussianBlur(blur[i], increase);
      prevSigma *= sigmaRatio;
    }

    /* Compute an array, dogs, of difference-of-Gaussian images by
       subtracting each image from its next blurred version.
    */
    for (i = 0; i < Scales + 2; i++) {
      dogs[i] = CopyImage(blur[i], IMAGE_POOL);
      SubtractImage(dogs[i], blur[i+1]);
    }

    /* Image blur[Scales] has twice the blur of starting image for
       this octave, so it is returned to downsample for next octave.
    */
    *pnextImage = blur[Scales];

    return FindMaxMin(dogs, blur, octSize, keys);
}
void onRenderAllFormat(HWND hWnd, WPARAM wParam, HBITMAP currentBitmap)
{
	HBITMAP temp;
	temp = (HBITMAP) CopyImage(currentBitmap, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
	OpenClipboard(hWnd);
	EmptyClipboard();
	onRenderFormat(hWnd, CF_BITMAP, temp);
	CloseClipboard();
	DeleteObject(temp);
}
Esempio n. 19
0
void ImageModel::CopyPrevious()
{
    DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
    hBms[(currInd + 1) % HISTORYSIZE] = (HBITMAP) CopyImage(hBms[currInd], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
    currInd = (currInd + 1) % HISTORYSIZE;
    if (undoSteps < HISTORYSIZE - 1)
        undoSteps++;
    redoSteps = 0;
    SelectObject(hDrawingDC, hBms[currInd]);
    imageSaved = FALSE;
}
Esempio n. 20
0
ImageClass::ImageClass(const ImageClass& anImageClassObject)
{
	//copy the image object from anImageClassObject into myImage
	myImage = CopyImage(anImageClassObject.myImage);

	//set the name of myImage
	name = anImageClassObject.name + "-Copy";

	//print out constructor identification
	cout << "Constructor: Copy - " << name << std::endl;
}
Esempio n. 21
0
void ImageModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY)
{
    int oldWidth = GetWidth();
    int oldHeight = GetHeight();
    Insert((HBITMAP) CopyImage(hBms[currInd], IMAGE_BITMAP,
           GetWidth() * nStretchPercentX / 100,
           GetHeight() * nStretchPercentY / 100, 0));
    if (GetWidth() != oldWidth || GetHeight() != oldHeight)
        NotifyDimensionsChanged();
    NotifyImageChanged();
}
void onRenderFormat(HWND hWnd, WPARAM wParam, HBITMAP currentBitmap)
{
	if (wParam == CF_BITMAP)
	{
		HBITMAP newBitmap;
		newBitmap = (HBITMAP) CopyImage(currentBitmap, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
		SetClipboardData(CF_BITMAP, newBitmap);
		//DeleteObject(newBitmap);
		
	}
}
Esempio n. 23
0
HICON GetDefaultIcon(bool copy)
{
	HICON resIco = Skin_GetIcon("SmileyAdd_ButtonSmiley");
	if (resIco == NULL) 
		resIco = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_SMILINGICON), IMAGE_ICON, 0, 0, copy ? 0 : LR_SHARED);
	else if (copy) {
		resIco = (HICON)CopyImage(resIco, IMAGE_ICON, 0, 0, 0);
		Skin_ReleaseIcon("SmileyAdd_ButtonSmiley");
	}

	return resIco;
}
Esempio n. 24
0
void CImageProcess::CutImage(IplImage *source, vector<CvRect> rect, vector<IplImage*> *dst)
{
	vector<CvRect>::iterator it = rect.begin();
	for(; it != rect.end(); it++){
		CvSize size;
		size.height = it->height;
		size.width = it->width;
		IplImage *image = cvCreateImage(size,source->depth, source->nChannels);
		memset(image->imageData, 0, image->imageSize);
		CopyImage(source,image, *it);
		dst->push_back(image);
	}
}
Esempio n. 25
0
CImage *Convert2CImage(Image *img)
{
  CImage *imgc;
  int i;

  imgc = (CImage *) calloc(1,sizeof(CImage));
  if (imgc == NULL){
    Error(MSG1,"CopyCImage");
  }
  for (i=0; i<3; i++)
    imgc->C[i] = CopyImage(img);
  return imgc;
}
Esempio n. 26
0
void
newReversible()
{
    DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
    hBms[(currInd + 1) % HISTORYSIZE] = CopyImage(hBms[currInd], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
    currInd = (currInd + 1) % HISTORYSIZE;
    if (undoSteps < HISTORYSIZE - 1)
        undoSteps++;
    redoSteps = 0;
    SelectObject(hDrawingDC, hBms[currInd]);
    imgXRes = GetDIBWidth(hBms[currInd]);
    imgYRes = GetDIBHeight(hBms[currInd]);
    imageSaved = FALSE;
}
Esempio n. 27
0
BOOL WINAPI ChangeBackground(HBITMAP& hNewBGBitmap, DWORD& dwOverlayBGColor)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	srand(time(NULL)+GetTickCount());
	dwOverlayBGColor=COLORKEY;
	objSettings.dbBgImage.Destroy();
	objSettings.szBitmapSize=GetBitmapSize(hNewBGBitmap);
	objSettings.dbBgImage.Create(objSettings.szBitmapSize.cx, objSettings.szBitmapSize.cy);
	CDC dcScreen,dcReal;
	dcScreen.CreateDC("DISPLAY", NULL, NULL, NULL);
	dcReal.CreateCompatibleDC(&dcScreen);
	HBITMAP hbmpTmp=(HBITMAP)CopyImage(hNewBGBitmap,IMAGE_BITMAP, objSettings.szBitmapSize.cx, objSettings.szBitmapSize.cy, 0);
	objSettings.dbBgImage.SetBitmap(&dcReal,hbmpTmp);
	DWORD dwErr=GetLastError();
	ClearBitmap(hbmpTmp);
	InitImage();
	return TRUE;
};
Esempio n. 28
0
/*
Calls TWAIN to actually get the image
*/
BOOL CTwain::GetImage(TW_IMAGEINFO& info)
{
HANDLE hBitmap;
	CallTwainProc(&m_AppId,&m_Source,DG_IMAGE,DAT_IMAGENATIVEXFER,MSG_GET,&hBitmap);
	switch(m_returnCode)
	{
	case TWRC_XFERDONE:
			CopyImage(hBitmap,info);
			break;
	case TWRC_CANCEL:
			break;
	case TWRC_FAILURE:
			CancelTransfer();
			return FALSE;

	}
	GlobalFree(hBitmap);
	return EndTransfer();
}
Esempio n. 29
0
KKeypoint GetKeypoints(Image image)
{
    int minsize;
    float curSigma, sigma, octSize = 1.0;
    KKeypoint keys = NULL;   /* List of keypoints found so far. */
    Image nextImage;

    PeakThresh = PeakThreshInit / Scales;

    /* If DoubleImSize flag is set, then double the image size prior to
       finding keypoints.  The size of pixels for first octave relative
       to input image, octSize, are divided by 2.
    */
    if (DoubleImSize) {
      image = DoubleSize(image);
      octSize *= 0.5;
    } else
      image = CopyImage(image, IMAGE_POOL);
   
    /* Apply initial smoothing to input image to raise its smoothing
       to InitSigma.  We assume image from camera has smoothing of
       sigma = 0.5, which becomes sigma = 1.0 if image has been doubled.
    */
    curSigma = (DoubleImSize ? 1.0 : 0.5);
    if (InitSigma > curSigma) {
      sigma = sqrt(InitSigma * InitSigma - curSigma * curSigma);
      GaussianBlur(image, sigma);
    }

    /* Examine one octave of scale space at a time.  Keep reducing
       image by factors of 2 until one dimension is smaller than
       minimum size at which a feature could be detected.
    */
    minsize = 2 * BorderDist + 2;
    while (image->rows > minsize &&  image->cols > minsize) {
	keys = OctaveKeypoints(image, & nextImage, octSize, keys);
	image = HalfImageSize(nextImage);
	octSize *= 2.0;
    }
    /* Release all memory used to process this image. */
    FreeStoragePool(IMAGE_POOL);
    return keys;
}
Esempio n. 30
0
Global void
MoveImage(XImage      *image,
	  XImage      *new_image,
	  unsigned int width,
	  unsigned int height,
	  ColormapPtr  cmap,
	  Direction    dir)
{
	int x, y;
     
	if (cmap == NULL || (image->depth == 1 && new_image->depth == 1)) {
		CopyImage(image, new_image, width, height);
		return;
	}
     
	for (x=0; x < width; x++)
		for (y=0; y < height; y++)
			XPutPixel(new_image, x, y,
				  MapColorCell(XGetPixel(image, x, y), cmap, dir));
}