查看: 1238|回复: 3
|
小弟有C++ in MFC的问题,关于image processing
[复制链接]
|
|
小弟有C++ in MFC的问题,关于image processing
我的programming可以拍影像,然后储存进memory buffer1 with image format from webcam.
how i write programming code that can save image to file?就是写c++里的microsoft foundation class(MFC)篇码关于可以储存进我的文件夹!
以下是我的programming code
long lHeadSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
//First image
m_cVideo2.SetCameraPropertyLong(PROPERTY_LED, LED_OFF); //set camera LED off
::Sleep(50); //wait for 200 ms(time interval)
char* pBuffer1_hd;
char* pBuffer1;
long lSize;
m_cVideo2.PictureToMemory(0, 24, NULL, &lSize, NULL );// get buffer size
pBuffer1_hd = (char*) malloc(lSize); // allocate buffer
if(pBuffer1_hd)
{
m_cVideo2.PictureToMemory(0, 24, (long)pBuffer1_hd, &lSize, NULL ); //take image
long W, H, B, F;
m_cVideo2.GetVideoFormat(&W, &H, &B, &F);//
pBuffer1 = pBuffer1_hd + lHeadSize; // allocate buffer
}
|
|
|
|
|
|
|
|
|
|
发表于 13-1-2007 12:07 PM
|
显示全部楼层
回复 #1 gab102001 的帖子
你是用DIB 对吗?
你可以用CFile 去Write
CString MediaFile("OutputFile.dat");
// Open the output file
CFile OutMediaFile;
OutMediaFile.Open(MediaFile, CFile::modeCreate | CFile::modeWrite);
OutMediaFile.Write(pBuff);
pBuff 是你的memory buffer |
|
|
|
|
|
|
|
发表于 13-1-2007 12:11 PM
|
显示全部楼层
sorry 你需要pass size 进Write()
OutMediaFile.Write(pBuff,size); |
|
|
|
|
|
|
|

楼主 |
发表于 14-1-2007 08:04 PM
|
显示全部楼层
回复 #2 tanhy 的帖子
我不明白你为甚么用media file!不过谢谢你。。。我的朋友已经教我了,不过我 direct save to c drive。。。。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|