[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 663
  • Last Modified:

Webcam With VC++ 2008

How can i capture video through webcam and display on the screen using C++/Vc++.
I have SDk (may be aug/2008) version and Directx Sdk(June 2008). Do you think i can use DirectShow Api for this. does Microsoft SDK or Directx Sdk has it?


0
kishan66
Asked:
kishan66
  • 8
  • 6
1 Solution
 
jkrCommented:
Sorry, but isn't that the same as in http:Q_24130290.html ?
0
 
kishan66Author Commented:
sorry.
 I thought for every question i have to make a new Post.
i will continue asking here regarding my issue.

can you tell (guide) how to do this Video capturing using vc++2008.
0
 
jkrCommented:
Take a look at MS' samples listed at http://msdn.microsoft.com/en-us/library/dd377437(VS.85).aspx ("PlayCap Sample") and http://msdn.microsoft.com/en-us/library/dd373424(VS.85).aspx ("AmCap Sample"). You'll find the on your disk as part of the DirectShow samples in "[SDK Root]\Samples\Multimedia\DirectShow\Capture\PlayCap" and "[SDK Root]\Samples\Multimedia\DirectShow\Capture\AmCap"
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
kishan66Author Commented:
I checked in the link .....but SDK root folder doesn't have /Samples folder .
SDK has only "C:\Program Files\Microsoft SDKs\Windows\V5.0 or V6.0A
so no sample programs to look at.
can you give me some other link..
0
 
jkrCommented:
Any chance that you haven't installed the samples during the SDK setup? They should be there, more info at http://social.msdn.microsoft.com/Forums/en-US/windowsdirectshowdevelopment/thread/fb552ee7-5637-43d5-8cda-7884dd15e63f/
0
 
jkrCommented:
BTW, while you are trying to locate these samples, take a look at http://www.codeproject.com/KB/directx/LiveVideo.aspx ("Capture Live Video from various Video Devices.")
0
 
kishan66Author Commented:
when i am trying to look through some examples using " directshow" , i came across this statements..

#if !defined(AFX_VMR_CAPTURE_H__186091F3_30FA_4FAA_AC8B_EF25E8463B9A__INCLUDED_)
#define AFX_VMR_CAPTURE_H__186091F3_30FA_4FAA_AC8B_EF25E8463B9A__INCLUDED_

i can not find any good answer from net. can you explain me what does this say?

0
 
jkrCommented:
These are so called "header guards", see http://www.cs.niu.edu/~mcmahon/cs241/c241man/node90.html for more. Their purpose is to prevent header files from being multiply included, which would result in "symbol already defined" errors. The "strange" names result from the fact that these have been automatically generated, the numeric part is a so-called "GUID"(http://en.wikipedia.org/wiki/Globally_Unique_Identifier)
0
 
kishan66Author Commented:
what Does the Timer functions in afxWin.h indicate? when do we use them

SetTimer() & KillTimer()

Can i use them to caliculate the latency? i mean frame latency?
please explain me in brief.
0
 
jkrCommented:
No, these timer functions are meant to be used for triggering actions, not measuring time. For the latter, the easiest way might be 'GetTickCount()' (http://msdn.microsoft.com/en-us/library/ms724408(VS.85).aspx), e.g.
DWORD dwStart = GetTickCount();
 
// ... some lengthy task here ...
 
DWORD dwEnd = GetTickCount();
 
DWORD dwElapsedTime = dwEnd - dwStart;

Open in new window

0
 
kishan66Author Commented:
unable to call OnTimer() from a button click.

I am trying to capture live video and show it on the same screen using webcam.
i have two buttons. "Start" & "Show" .
when clicked "Start" i can see my live video working but when i click on the "Show" button, which  i trying to call a OnTimer(UINT nIDEvent) function ...which will show up the captured live video on the screen, is not working.
No errors are displayed. using debugging i find that the function is "OnTimer()"  not at all called.

can you tell me where am i going wrong.

im using vc++2008.
void CDialogDlg::OnShow()
{
	// TODO: Add your control notification handler code here
 
	this->KillTimer (TIMER_ID);
	this->SetTimer (TIMER_ID,TIMER_DELAY,NULL);
}
 
void CDialogDlg::OnTimer(UINT nIDEvent) 
{
	
	DWORD dwSize;
	
	dwSize=this->m_VMRCap.GrabFrame ();
	if(dwSize>0)
	{
		BYTE *pImage;
		this->m_VMRCap.GetFrame(&pImage);
		this->m_ctrlCaptureIMG.ShowImage(pImage);
	}
	
	CDialog::OnTimer(nIDEvent);
}

Open in new window

0
 
jkrCommented:
What is your timer ID, the interval, and even more important: What return value do you get from

UINT ret =         this->SetTimer (TIMER_ID,TIMER_DELAY,NULL);

?
0
 
kishan66Author Commented:
#define TIMER_DELAY 10
#define TIMER_ID 1

// Timer Functions in   << afxwin.h >>
      UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse,
            void (CALLBACK* lpfnTimer)(HWND, UINT, UINT_PTR, DWORD));
      BOOL KillTimer(UINT_PTR nIDEvent);

please let me know if you need any thing
0
 
jkrCommented:
Do you have a message map entry for 'CDialogDlg::OnTimer()'?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now