 |
|
 |
HI everybody, i'm a student of master thesis. I would like to know How to save captured inage as bmp format in hard disk. and how to retrive it? I had downloaded the source file. But i can't use the VMPCaptureIMage function. Explain it, please.
|
|
|
|
 |
|
 |
useful directshow code for usb camera
|
|
|
|
 |
|
 |
Hi all,
I have this problem:
After some window or another capture cover and then take out,
the capture will not review, have someone can solve this problem??
thanks a lot
|
|
|
|
 |
|
 |
Hi
I used the VMR_Capture and the SaveBMP method to save the picture to a bmp file. I use a Logitech QuickCam Image with WinXP SP3 The problem is that the image is vertically mirrored.
Is there a simple solution for this ?
thanks for your work !
regards
Cassie
|
|
|
|
 |
|
 |
I have a runtime error.
Where can i find the stack allocation in the compiler settings?
Your example works fine, but when i build it my w32 app crash on line
hr = m_pGB->Render(m_pCamOutPin);
Ussing: win xp prof, VS Studio 2008 W32, MS SDK, DirectX Nov 2008 SDK.
It also works on my Vista computer also VS2008, It is the project.
thanks for help ..regards Henk
|
|
|
|
 |
|
 |
Flickerless or flicker-free can be set by Camera property dialog. But I don't know implement it by code. Please help me.
|
|
|
|
 |
|
 |
It works beautifully !
I`am going to use it for preview to test
capture->Compress->grab_compressed graph
|->VMR_preview
Also i`ll enable events interface
modified on Monday, January 5, 2009 6:17 AM
|
|
|
|
 |
|
 |
it is a new way to Simultaneous Previewing and Video Capture, But in SDK, it says "Excessive use of this function will degrade video playback performance". it is true, while the programe runs, it occupy too much CPU resource.
Is there another better ways?
|
|
|
|
 |
|
 |
yes - write your own DShow sample grabber filter to grab the frames passing through.
class CMySampleGrabber : public CTransInPlaceFilter, public IMySampleGrabber
{
..........
}
for performance you should avoid sample grabbing and process all in dshow filters and write your custom filters if not available.
even faster it would be if you make use of WDM kernel streaming to process everything in kernel mode drivers without swithcing to user mode.
|
|
|
|
 |
|
 |
Hi
I used the VMR_Capture and the SaveBMP method to save the picture to a bmp file. I use a Logitech Quickcam Pro 9000 with WinXP SP2. The problem is that the image is horizontally mirrored.
Is there a simple solution for this ?
thanks for your work !
regards
Erich
|
|
|
|
 |
|
 |
Here is solution:
DWORD CVMR_Capture::GrabFrame()
{
long lOut = -1;
bool bDirection = true; // If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner.
if(m_pWC )
{
BYTE* lpCurrImage = NULL;
// Read the current video frame into a byte buffer. The information
// will be returned in a packed Windows DIB and will be allocated
// by the VMR.
if(m_pWC->GetCurrentImage(&lpCurrImage) == S_OK)
{
LPBITMAPINFOHEADER pdib = (LPBITMAPINFOHEADER) lpCurrImage;
if(m_pFrame==NULL || (pdib->biHeight * pdib->biWidth * 3) !=m_nFramelen )
{
if(m_pFrame!=NULL)
delete []m_pFrame;
m_nFramelen = pdib->biHeight * pdib->biWidth * 3;
m_pFrame = new BYTE [pdib->biHeight * pdib->biWidth * 3] ;
}
//pdib->biPlanes = 0;
if(pdib->biBitCount ==32)
{
DWORD dwSize=0, dwWritten=0;
BYTE *pTemp32;
pTemp32 = lpCurrImage + sizeof(BITMAPINFOHEADER);
if ( 0 > pdib->biHeight ) //If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.
{
bDirection = false;
}
//change from 32 to 24 bit /pixel
this->Convert24Image(pTemp32, m_pFrame, pdib->biSizeImage, bDirection);
}
CoTaskMemFree(lpCurrImage); //free the image
}
else
{
return lOut;
}
}
else
{
return lOut;
}
return lOut=m_nFramelen;
}
bool CVMR_Capture::Convert24Image(BYTE *p32Img, BYTE *p24Img, DWORD dwSize32, bool bDirection)
{
if(p32Img != NULL && p24Img != NULL && dwSize32>0)
{
DWORD dwSize24;
dwSize24 = (dwSize32 * 3)/4;
BYTE *pTemp, *ptr;
pTemp = p32Img;
if ( true == bDirection )
{
ptr = p24Img + dwSize24 - 1;
}
else
{
ptr = p24Img;
}
int ival=0;
for (DWORD index = 0; index < dwSize32/4 ; index++)
{
unsigned char r = *(pTemp++);
unsigned char g = *(pTemp++);
unsigned char b = *(pTemp++);
(pTemp++);//skip alpha
if ( true == bDirection )
{
*(ptr--) = b;
*(ptr--) = g;
*(ptr--) = r;
}
else
{
*(ptr++) = r;
*(ptr++) = g;
*(ptr++) = b;
}
}
RGBTRIPLE tmp;
RGBTRIPLE* Ptr = (RGBTRIPLE*)p24Img;
for (int i = 0; i < m_nHeight; i++)
{
for (int j = 0; j < m_nWidth/2; j++)
{
tmp = *(Ptr + j);
*(Ptr + j) = *(Ptr + m_nWidth - j);
*(Ptr + m_nWidth - j) = tmp;
}
Ptr += m_nWidth;
}
}
else
{
return false;
}
return true;
}
It was tested carefully.
|
|
|
|
 |
|
 |
This new version of GrabFrame() indeed fixes the horizontal mirroring but appears to also corrupt the p24Img pointer resulting in bmp memory leaking.
The fix appears to be to change the following line in Convert24Image()...
for (int j = 0; j < m_nWidth/2; j++)
to...
for (int j = 1; j < m_nWidth/2; j++)
Kon.A
Kon Akselrud <kon@headlightsplus.com.au>
|
|
|
|
 |
|
 |
Thank you for your article, as it helped me understand how to enumarate video capture devices and how to actually build a capturing filter graph and run it.
Now I would like to send the caoptured video data, instead of grabbing images and displaying them.
I need to know if there is a sort of RTP fDirect Show that would packetize the coded video in RTP frames and sendthem to an RTP client. And visversa..ie have an RTP DirectShow filter that receives data from remote RTP source then passes the innir data to the decoder and the rest of the filters chain.
Thank you in advance.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
 |
|
 |
there is one for free written by morgan multimedia, but i`m writing my own (it doesn`t suit my neeeds).
|
|
|
|
 |
|
 |
how can get these files
#include
#include
#include
i need these files for video capturing
i have install windows sdk which contain directshow
but vmr9.h is not there
how can i find thess files
|
|
|
|
 |
|
 |
hi.. I am currently using the VS6.0 C++ and Microsoft DirectX 9.0 SDK (December 2004) with the extras folder pasted into it. I tried to compile it but the follwing errors appear:
c:\program files\microsoft directx 9.0 sdk (december 2004)\include\strmif.h(1024) : error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
c:\program files\microsoft directx 9.0 sdk (december 2004)\include\strmif.h(1024) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Anyone could help pls?
|
|
|
|
 |
|
 |
I have VS2008 : it has DirectShow SDK by default (Directshow is no more within DirectX ) And the program compiles and links well.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
 |
|
 |
Hello KrsSagar,
Good Day...
with regards to your program how to control the color adjustment like sharpness, blur, contrast and brightness of the captured image of the other stream?
thanks,
reno
|
|
|
|
 |
|
 |
VMR_Capture.obj : error LNK2019: unresolved external symbol IID_IVMRWindowlessControl referenced in function "protected: long __cdecl
VMR_Capture.obj : error LNK2019: unresolved external symbol IID_IVMRFilterConfig referenced in function "protected: long __cdecl
VMR_Capture.obj : error LNK2019: unresolved external symbol CLSID_VideoMixingRenderer referenced in function "protected: long __cdecl
VMR_Capture.obj : error LNK2019: unresolved external symbol IID_ICreateDevEnum referenced in function "protected: bool __cdecl
what con i do ? ^^ thx
|
|
|
|
 |
|
 |
Hello,
First of all, this is a nice peace of work, with an extended implementation of most video capture tasks using VMR. I'm quite new with DirectShow so my question might have a very simple answer: I just want to preview a video from a capture device and grab and save some frames. Unfortunately, I wasn't able to do that with ImageCapture() function because the raw images that I get are not "readable". Does you or anyone had the same problem? Is that any problem with the bitmap structure? Where can I find a nice documentation or guideline to write images in bitmap format?
Thank you in advance.
Zeca
|
|
|
|
 |
|
 |
//Declaration
BITMAPFILEHEADER hdr;
DWORD dwSize, dwWritten;
LPBITMAPINFOHEADER pdib = (LPBITMAPINFOHEADER) lpCurrImage;
// Initialize the bitmap header
dwSize = DibSize(pdib);
hdr.bfType = 'MB';
hdr.bfSize = dwSize + sizeof(BITMAPFILEHEADER);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + pdib->biSize +
DibPaletteSize(pdib);
Also Define These In Header File
#define DibSize(lpbi) ((lpbi)->biSize + (lpbi)->biSizeImage + (int)(lpbi)->biClrUsed * sizeof(RGBQUAD))
#define DibPaletteSize(lpbi) (DibNumColors(lpbi) * sizeof(RGBQUAD))
-- modified at 8:58 Wednesday 31st October, 2007
Prabhu Somasundaram
India
http://prabhu-s.blogspot.com
-- modified at 9:24 Wednesday 31st October, 2007
|
|
|
|
 |
|
 |
Hi, first, congratulations for this article, i have successfully implemented amost all the code (removing MFC), but there is a problem... when i call ImageCapture(), it always return a 225kb empty (filled with 0x00) raw file... can you help me?
|
|
|
|
 |
|
 |
im compiled ur project..but somhow i get this error message..
"fatal error C1083: Cannot open include file: 'dshow.h': No such file or directory"
and then the error points to #include
can u please help me with this..what shud i do..i'm green with C++ enviroment
|
|
|
|
 |
|
 |
just the "m_pWC->GetCurrentImage(&lpCurrImage)" in CVMR_Capture::GrabFrame() will spend more than 100ms/f.
|
|
|
|
 |
|
 |
Here's what I like to do: read in 2 video files and save them to an avi output file. The output file should have the picture in picture effect. The sample that microsoft delivered (its called PiP) shows how to display two video streams. But instead of displaying them, I want to save the picture in picture video to a file. Can someone help? Thanks
-- modified at 15:36 Tuesday 6th March, 2007
|
|
|
|
 |