Help me with displaying capture image
-
Hi best programmers, Please help me with my problem. I want to display captured streaming avi-data from webcam, but the main problem is to show the video on my dialogbox. Actually it's very easy to get avi from webcam and I think it worked well so far, but to show in my dialogbox there is a problem. The code I tried is as follows: void CCamSampDlg::OnStart() //when I click on Start-button, { //the webcam will be activated (I see green CRect rect; //LED turns on) and it should start showing GetClientRect(&rect); //the videopicture on the dialogbox // Here I try to display the imagestream WebCam.Create(0,rect,&m_Disp,TRUE); //I think in this line something WebCam.ConnectWithDriver(-1); //wrong. WebCam.SetPreviewRate(15); WebCam.StartPreview(TRUE); } void CCamSampDlg::OnCancel() { WebCam.Disconnect(); OnOK(); CDialog::OnCancel(); } I've read the MSDN how to do that, but I guess I use the Creat-method wrong. Please can somebody help me, you'll maken me so happy, really if I was a gay I would give a very big wet french kiss. Thank you dear friends!!!! If my application works, I forget all my problems.
-
Hi best programmers, Please help me with my problem. I want to display captured streaming avi-data from webcam, but the main problem is to show the video on my dialogbox. Actually it's very easy to get avi from webcam and I think it worked well so far, but to show in my dialogbox there is a problem. The code I tried is as follows: void CCamSampDlg::OnStart() //when I click on Start-button, { //the webcam will be activated (I see green CRect rect; //LED turns on) and it should start showing GetClientRect(&rect); //the videopicture on the dialogbox // Here I try to display the imagestream WebCam.Create(0,rect,&m_Disp,TRUE); //I think in this line something WebCam.ConnectWithDriver(-1); //wrong. WebCam.SetPreviewRate(15); WebCam.StartPreview(TRUE); } void CCamSampDlg::OnCancel() { WebCam.Disconnect(); OnOK(); CDialog::OnCancel(); } I've read the MSDN how to do that, but I guess I use the Creat-method wrong. Please can somebody help me, you'll maken me so happy, really if I was a gay I would give a very big wet french kiss. Thank you dear friends!!!! If my application works, I forget all my problems.
Ok, that's nice but we cannot help you if don't explain us what is this
WebCam
member ! SimCom wrote: really if I was a gay I would give a very big wet french kiss Errr, no a 'thank you' is enough for me ;P -
Ok, that's nice but we cannot help you if don't explain us what is this
WebCam
member ! SimCom wrote: really if I was a gay I would give a very big wet french kiss Errr, no a 'thank you' is enough for me ;PWebcam is the variable of the type CAvicap class, like this: CAvicap Webcam; and the method Create is as follow: BOOL CAviCap::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, BOOL fAutoSize) { ASSERT(!GetSafeHwnd()); if(GetSafeHwnd()) { iLastError=CAP_CREATE_DUP; return FALSE; //already connected, can't connect twice! } _autosize = fAutoSize; HWND hWnd=capCreateCaptureWindow("AviCap_Basic", dwStyle, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, pParentWnd->GetSafeHwnd(), AVICAP_WINDOW_ID); if(!hWnd) { TRACE("CAviCap Window creation failed\n"); iLastError=CAP_WINCREATION_FAILED; return FALSE; } //subclass standard window SubclassWindow(hWnd); ::SetClassLong(hWnd, GCL_STYLE, ::GetClassLong(hWnd,GCL_STYLE)|CS_DBLCLKS); #ifdef ON_CONNECT_CHECK_DRIVERLIST _getDrvList(); #endif return TRUE; } If my application works, I forget all my problems.
-
Webcam is the variable of the type CAvicap class, like this: CAvicap Webcam; and the method Create is as follow: BOOL CAviCap::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, BOOL fAutoSize) { ASSERT(!GetSafeHwnd()); if(GetSafeHwnd()) { iLastError=CAP_CREATE_DUP; return FALSE; //already connected, can't connect twice! } _autosize = fAutoSize; HWND hWnd=capCreateCaptureWindow("AviCap_Basic", dwStyle, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, pParentWnd->GetSafeHwnd(), AVICAP_WINDOW_ID); if(!hWnd) { TRACE("CAviCap Window creation failed\n"); iLastError=CAP_WINCREATION_FAILED; return FALSE; } //subclass standard window SubclassWindow(hWnd); ::SetClassLong(hWnd, GCL_STYLE, ::GetClassLong(hWnd,GCL_STYLE)|CS_DBLCLKS); #ifdef ON_CONNECT_CHECK_DRIVERLIST _getDrvList(); #endif return TRUE; } If my application works, I forget all my problems.
From where is this control coming from ?? And what is the error ? Is it a compile error (if yes, give the complete error message) or a runtime error (if yes, give as much information as possible). You don't give us enough information to help you. BTW, use the tags under the emoticons to format your code, it will be much more readable.
-
From where is this control coming from ?? And what is the error ? Is it a compile error (if yes, give the complete error message) or a runtime error (if yes, give as much information as possible). You don't give us enough information to help you. BTW, use the tags under the emoticons to format your code, it will be much more readable.
Dear Cedric, First, I'm sorry I'm not so clear to you, but I will try to understand you what my situation is. :doh: I want to make a simple dialogbox application just simply to show the video-image of the webcam, using CAvicap class wich encapsulates the win32API fucntions of VFW.dll or .cpp (you can see an article of that class, I'm sorry for the missing link) So I included the CAvicap class in my DialogBox project. To use the webcam, I have to do the following steps: 1) Call the Creat method of CAvicap 2) Callthe Connect method of CAvicap 3) Set preview rate (also a function of CAvicap) 4) Start preview (also a function of CAvicap) And when to close it, I need to call the Disconnect method. The part of showing the life video on my DialogBox is as follow:
void CCamSampDlg::OnStart() //when I click on Start-button, { //the webcam will be activated (I see green CRect rect; //LED turns on) and it should start showing GetClientRect(&rect); //the videopicture on the dialogbox // Here I try to display the imagestream WebCam.Create(WS_CHILD|WS_VISIBLE,rect,&m_Disp,TRUE); //I think in this line something WebCam.ConnectWithDriver(-1); //is wrong. //-1 means any driver that's available WebCam.SetPreviewRate(100); //the rate is in mSec to refresh a new image WebCam.StartPreview(TRUE); } void CCamSampDlg::OnCancel() { WebCam.Disconnect(); OnOK(); CDialog::OnCancel(); }
Here is the Create method declaration:BOOL CAviCap::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, BOOL fAutoSize) { ASSERT(!GetSafeHwnd()); if(GetSafeHwnd()) { iLastError=CAP_CREATE_DUP; return FALSE; //already connected, can't connect twice! } _autosize = fAutoSize; HWND hWnd=capCreateCaptureWindow("AviCap_Basic", dwStyle, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, pParentWnd->GetSafeHwnd(), AVICAP_WINDOW_ID); if(!hWnd) { TRACE("CAviCap Window creation failed\n"); iLastError=CAP_WINCREATION_FAILED; return FALSE; } //subclass standard window SubclassWindow(hWnd); ::SetClassLong(hWnd, GCL_STYLE, ::GetClassLong(hWnd,GCL_STYLE)|CS_DBLCLKS); #ifdef ON_CONNECT_CHECK_DRIVERLIST _getDrvList(); #endif return TRUE; }
By the way the link where you can find the CAvicap class is here: http://www.codeproject.com/audio/avicapwrp.asp Well I hope I informed you well, if you want my project to look at it, I can send it to you. And thank you :-> If my application works, I forget all my problems.