|
hi ,
Really u have done a good job.
It helped me a lot.
But one thing which i want to know is how to identify whether device is connected to the host or not?
What i analyzed is even without any device connected to the host the EnumDevice function is displaying the PnP driver name of the device which i used before to display the image.
The webcam what i used is Creative Cam.
After connected to the host it gving two name to one device.
Any suggestion to avoid this extra name.
|
|
|
|
|
I have solved this problem by specifying
hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
&pEm, CDEF_DEVMON_PNP_DEVICE);
the device catogory as Pnp hardware devices as shown above.
This method get failing when there is no device connected to the host
Thanks
|
|
|
|
|
hi all,
I have tried writing the captured image in to a *.bmb file and tried to view the file using Image Preview , which is giving a error "Drawing Failed".
I found that the Bmb file header is missing in the captured image and tried writing the file header at first and then the catured image as shown in the code below.But still it is gving the same problem
Here is the code which i am using
HANDLE hFile = CreateFile(szFile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
File_header->bfType = 77;
File_header->bfType = File_header->bfType << 8 | 66;
File_header->bfSize = 230400;
File_header->bfReserved1 = 0;
File_header-> bfReserved2 = 0;
File_header->bfOffBits = 14 + 40 + 64;
WriteFile(hFile, File_header , 14, &dwWritten, 0);
WriteFile(hFile, (LPCVOID)m_pFrame , m_nFramelen, &dwWritten, 0);
// Close the file
CloseHandle(hFile);
Please help me
Thanks in advance
|
|
|
|
|
Hi,
First of all, I am using BCB environment and it is quite easy to
incorporate this source into BCB. I don't know MFC, but stdafx.h is
unnecessery. Probably only with MFC this header is useful. It is
very difficult to get .lib in omf format exporting
IID_IVMRFilterConfig and IID_IVMRWindowlessControl symbols. In this
case I suggest adding following definitions:
const IID IID_IVMRFilterConfig = {0x9e5530c5,0x7034,0x48b4,{0xbb,0x46,0x0b,0x8a,0x6e,0xfc,0x8e,0x36}};
const IID IID_IVMRWindowlessControl = {0x0eb1088c,0x4dcd,0x46f0,{0x87,0x8f,0x39,0xda,0xe8,0x6a,0x51,0xb7}};
The bug I found is: ImageCapture(LPCTSTR szFile) class method doesn't
fulfill it's task because of GrabFrame() method. The reason is bitmap
header created improperly. After conversion form 32 to 24 bits, fields
LPBITMAPINFOHEADER structure are not updated. Additionally color map
is not set. The way i corrected is the following (piece of GrabFrame
method):
if (pdib->biBitCount == 32)
{
BYTE *pTemp32;
pTemp32=lpCurrImage + sizeof(BITMAPINFOHEADER);
//change from 32 to 24 bit /pixel
this->Convert24Image(pTemp32, m_pFrame, pdib->biSizeImage);
added: pdib->biBitCount = 24;
added: pdib->biSizeImage = m_nFramelen;
}
added: binfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFO));
added: binfo->bmiHeader = *pdib;
setting color map:
for(i = 0; i < 256; i++)
{
binfo->bmiColors[i].rgbBlue =
binfo->bmiColors[i].rgbGreen =
binfo->bmiColors[i].rgbRed = (BYTE)i;
binfo->bmiColors[i].rgbReserved = 0;
}
where binfo is public class member: BITMAPINFO *binfo;
Now in ImageCapture would be good idea to write to file this binfo
before bitmap data.
Of course better is to build additional calss method that returns
bitmap header insted of using public member binfo.
This way GrabFrame method works fine and having it's header it is very
easy to draw the frame on HDC surface. So one have full access to
aquired data. For example: spawning thread with
while (is_playing)
{
capture->GrabFrame();
if (capture1->GetFrame(&frame) != 0)
EnumDisplayMonitors(dc, &clipRect, paintEnum, 0);
}
where paintEnum function draws obtained image frame (with header) on
dc surface.
Of course it is necessery to change invocation of
hr = InitVideoWindow(dc, hWnd,iWidth, iHeight);
into
hr = InitializeWindowlessVMR(hWnd);
This way it is possible to grab frame, process it and draw.
regards
Michal Pawluk
|
|
|
|
|
Hello
If You have a simple demo in Builder6 with capture frames from webcam (USB) please send to me.
I was tried with DX capture and i was so many problems with include files. May somebody has a demo with DX Capture class?
Please help
I'm a student and I will do students work.
marsianinek@wp.pl
www.marsi.spec.pl
|
|
|
|
|
I was proving the demo with my camera web genius and the picture that it is shown of the right side it leaves distorted with regard to the image that is shown of the left side... I have attempted several formats and they don't work me.. somebody can please help me.. it is urgent
George
|
|
|
|
|
Modify width and height based on your camera web geniue.
For example:
#define CAM_WIDTH 352 // 320
#define CAM_HEIGHT 288 // 240
45241242sfcvsdvf
|
|
|
|
|
can I change the framerate?
how to change framerate , thanks
|
|
|
|
|
Hi,
really nice sample
how could i convert the capture image into a grayscale image?
bye
|
|
|
|
|
Hi,
imagine one point of aquired image. It is a tripplet of values for R, G and B component. You can do the conversion in three ways: each color component must be equal to each other, so just set G = B = R, or R = B = G, or R = G = B. Repeat it for each point in the image. Depending on the case (1, 2 or 3) You will get image of quite different scale in gray.
Regards
Michal Pawluk
|
|
|
|
|
Would only likely cause problems with error conditions.
VMR_Capture.cpp:174 or so contains:
while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK, index <= deviceId)
expect that should really be
while( (hr = pEm->Next(1, &pM, &cFetched)) && hr==S_OK && index <= deviceId)
But project generally seems to run - I actually got it to work with BCB6 using the vc project conversion utility, after I managed to locate the necessary directx libs (clootie provided), and appropriate SDKs. I did have to modify include and library paths appropriately after project conversion.
|
|
|
|
|
That should have been:
while( (hr = pEm->Next(1, &pM, &cFetched))==S_OK && index <= deviceId)
|
|
|
|
|
It appears that this example uses the MFC base classes from the SAMPLES directory of the platform sdk. Open the project in the directory where the base classes folder appears and convert and compile all of the projects at once to get the libraries to compile. The base classes will be usable after compiling them. However, I don't recommend using these sample base classes. Just write your app in ordinary windows c++ and create your own little classes if you must. It's actually much easier not to use these classes because all of the GUIDS and directshow functions allready work and exist through directshow. Read the direct show tutorials in either the sdk or the MSDN library under directshow.
|
|
|
|
|
I got the VMR_Capture demo project compiled and got it started, but when I clicked on "Initialize" button, the application crashed inside the CVMR_Capture::Init() function.
The line that is crashing is
hr = m_pGB->Render(m_pCamOutPin);
And both m_pGB and m_pCamOutPin seems to be pointing to a valid memory location. When the Render() function is called, it causes "unhandled exception at 0x001b6710" error, and the call stack of when this error occurs is following.
001b6710
pvmjpg21.dll
ntdll.dll
Can you help?
|
|
|
|
|
Try increasing the reserve stack allocation in your compiler settings. I had to jack mine all the way up to 20 megabytes in mine because of the way I was doing things. Good luck.
|
|
|
|
|
I have the same 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
|
|
|
|
|
i want to ask you how to access buffer and process the RGB colour from live image. thq.
aden
|
|
|
|
|
i want to ask you how to access buffer and process the RGB colour from live image. thq.
yahikjsaklfjsdakldxznvc,xznvklsdjfksdcklsdjfklsdjfklsdjfkljsdlkfjsdlk
|
|
|
|
|
Hi,
see "Problem in displaying the caputured image which is written in to a bmp file" thread on first page.
regards
Michal Pawluk
|
|
|
|
|
To krssagar or code gurus,
I’m thinking of using this Demo project as a Prototype Video conferencing model between two systems. If I chose to keep both screens viewing the recipient side, but the right screen to take a still image. I have an understanding on what needs to be carried eg. TCP/IP connection, UDP from both sides, rendering and having an encoder etc
Can some one plzz suggest how I can start this with using this demo project here??
Many thanks
hbjs
makaveli
|
|
|
|
|
I want to make a video file by capturing a period of frames and so do I. We know the GetCurrentImage method retrieves a copy of the current image being displayed by the VMR. But I take the captured data into a video file, and I get a reversed video finally . How could I make a normal video by captured data? Should I take some image processing or just changing another method or....any thing else?
pls give me suggestions, thank you so much.
|
|
|
|
|
When I try to compile the demo project in vc++ 2005, it gives the error below. Can anyone help me with this?
1>------ Build started: Project: DXCapture, Configuration: Release Win32 ------
1>Compiling...
1>StdAfx.cpp
1>C:\Program Files\Microsoft Platform SDK\Include\mfc\afx.inl(252) : warning C4244: 'return' : conversion from 'const time_t' to 'LONG_PTR', possible loss of data
1>C:\Program Files\Microsoft Platform SDK\Include\mfc\afx.inl(254) : warning C4244: 'return' : conversion from 'const time_t' to 'LONG_PTR', possible loss of data
1>C:\Program Files\Microsoft Platform SDK\Include\mfc\afx.inl(258) : warning C4244: 'return' : conversion from 'const time_t' to 'LONG_PTR', possible loss of data
1>C:\Program Files\Microsoft Platform SDK\Include\mfc\afx.inl(262) : warning C4244: 'return' : conversion from 'const time_t' to 'LONG_PTR', possible loss of data
1>C:\Program Files\Microsoft Platform SDK\Include\mfc\afxwin1.inl(1034) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Platform SDK\Include\mfc\afxwin1.inl(1036) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Build log was saved at "file://c:\Temp\webcam\DXCapture_demo\Release\BuildLog.htm"
1>DXCapture - 2 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
|
|
Does anyone do this in the Borland c++ builder???I have some problem using the VMR_Capture class. Can be somebody so kind and send me a simple code,which demostrate this problem???Thank you.
|
|
|
|
|
Hello
I join to You wit your problem because a have it too.
I'm programming in BCB5/6 and I cant run this class. I have so many problems with include files.
Please help
marsianinek@wp.pl
www.marsi.spec.pl
|
|
|
|
|
Hello,
just get rid of #include "stdafx.h". It is only for MFC. Make use of following declarations:
const IID IID_IVMRFilterConfig = {0x9e5530c5,0x7034,0x48b4,{0xbb,0x46,0x0b,0x8a,0x6e,0xfc,0x8e,0x36}};
const IID IID_IVMRWindowlessControl = {0x0eb1088c,0x4dcd,0x46f0,{0x87,0x8f,0x39,0xda,0xe8,0x6a,0x51,0xb7}};
It is very difficult to find .lib exporting this symbols.
Probably You will have to use strmiids.lib and strmbase.lib for additional symbols. But remember to use coff2omf utility to convert this libs to omf format.
regards
Michal Pawluk
|
|
|
|
|