2010-06-03 7 views
0

내 프로젝트에서 intptr로 비트 맵을 변환하는 방법 EmguCV lib를 사용하고 싶지만 EmguCV의 기능이 Bitmap 객체를 처리 할 수 ​​없기 때문에 Bitmap을 다른 유형으로 변환해야하지만 Intptr은 선택 사항이지만 정말 코딩하는 방법을 모르는, 동료 코드는 다음과 같은 내 프로젝트에서 추상적이다 :C에서 #

Bitmap bmp = new Bitmap(e.width, e.height, 
    System.Drawing.Imaging.PixelFormat.Format24bppRgb); 
System.Drawing.Imaging.BitmapData data = 
    bmp.LockBits(new Rectangle(0, 0, e.width, e.height), 
     System.Drawing.Imaging.ImageLockMode.ReadWrite, 
     System.Drawing.Imaging.PixelFormat.Format24bppRgb); 
int dataLength = e.width * e.height * 3; 
Win32.memcpy(data.Scan0, (IntPtr)e.data, (uint)dataLength); 
convertBitmapToIntptr(bmp); 

어떻게 수있는이 기능 convertBitmapToIntptr(bmp)에서 I 코드? 나는이 일을하고 한

당신이 수업 시간에이 포장 할

+0

당신이 무엇을 요구하고 있는지 확실히 모르십니까? –

+0

GetHbitmap()을 찾으십니까? http://msdn.microsoft.com/en-us/library/1dz311e4.aspx –

답변

0

는 .... "FastBitmap"라고 불렀다하면, 생성자를 잠 그려면 PTR을 얻고, 함께 작동하는 방법을 추가 할 수 있습니다 PTR

1

이 오래된 질문 할 수 있지만 EmguCV를 사용하는 경우를 IntPtr 변환 비트 맵은 다음 예와 같이 (버전 2.4.2 기준)을 수행 할 수 있습니다 :

Bitmap bitmap = new Bitmap("pathToBitmapFile"); 

Image<Bgr,byte> image = new Image<Bgr,byte>(bitmap); 

IntPtr = image.Ptr; 

참조 EmguCV Documentation