Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help me with displaying capture image

Help me with displaying capture image

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SimCom
    wrote on last edited by
    #1

    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.

    C 1 Reply Last reply
    0
    • S SimCom

      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.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • C Cedric Moonen

        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

        S Offline
        S Offline
        SimCom
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • S SimCom

          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.

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          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.

          S 1 Reply Last reply
          0
          • C Cedric Moonen

            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.

            S Offline
            S Offline
            SimCom
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups