Operator Console
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
SimpleDirectShowAcq Class Reference

A class for acquiring directly from a camera with a DirectShow driver. More...

#include <SimpleDirectShowAcq.h>

Inheritance diagram for SimpleDirectShowAcq:
[legend]

Public Member Functions

 SimpleDirectShowAcq (void)
 
 ~SimpleDirectShowAcq (void)
 
bool CaptureFrame ()
 Captures a single frame into m_buf. More...
 
bool Close ()
 
bool Open ()
 
 SimpleDirectShowAcq (void)
 
 ~SimpleDirectShowAcq (void)
 
bool CaptureFrame ()
 Captures a single frame into m_buf. More...
 
bool Close ()
 
bool Open ()
 
- Public Member Functions inherited from ImageAcquisition
 ImageAcquisition (void)
 
virtual ~ImageAcquisition (void)
 
void GetFrame (void *buf)
 
virtual bool Init (int width, int height, int bytesPerPixel=4)
 may be overridden, but be sure to call parent function also More...
 
unsigned int BytesPerFrame ()
 
unsigned int PixelsPerFrame ()
 
int GetHeight ()
 
CString & GetInfo ()
 
int GetWidth ()
 
void SetHeight (int height)
 
void SetWidth (int width)
 
 ImageAcquisition (void)
 
virtual ~ImageAcquisition (void)
 
void GetFrame (void *buf)
 
virtual bool Init (int width, int height, int bytesPerPixel=4)
 may be overridden, but be sure to call parent function also More...
 
unsigned int BytesPerFrame ()
 
unsigned int PixelsPerFrame ()
 
int GetHeight ()
 
CString & GetInfo ()
 
int GetWidth ()
 
void SetHeight (int height)
 
void SetWidth (int width)
 

Protected Attributes

int m_numCameras
 
int m_cameraIndex
 
bool m_inited
 TRUE if camera is initialized. More...
 
- Protected Attributes inherited from ImageAcquisition
CriticalBuf m_frame
 shared memory to hold copy of current frame More...
 
int m_width
 width of image in pixels More...
 
int m_height
 height of image in pixels More...
 
unsigned int m_numBytes
 number of bytes in a frame More...
 
unsigned int m_numPixels
 number of pixels in a frame More...
 
CString m_logMsg
 error or information message More...
 
void * m_buf
 buffer to capture into More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ImageAcquisition
static UINT __cdecl ThreadProc (LPVOID param)
 
static UINT __cdecl ThreadProc (LPVOID param)
 
- Public Attributes inherited from ImageAcquisition
int m_source_ID
 The source ID for acquire_image() that indicates what type of device is in use. More...
 
int m_device_ID
 [Used Epiphan only]: indicates from which of the two sources to capture More...
 
std::string m_ini_file
 The fully-qualified name (including full path) of an Imatest INI file. More...
 

Detailed Description

A class for acquiring directly from a camera with a DirectShow driver.

Constructor & Destructor Documentation

SimpleDirectShowAcq::SimpleDirectShowAcq ( void  )

References ImageAcquisition::m_buf, ImageAcquisition::m_height, ImageAcquisition::m_numBytes, ImageAcquisition::m_numPixels, and ImageAcquisition::m_width.

26 {
27  m_width = 0;
28  m_height = 0;
29  m_numBytes = 0;
30  m_numPixels = 0;
31  m_buf = NULL;
32 }
unsigned int m_numPixels
number of pixels in a frame
Definition: ImageAcquisition.h:56
unsigned int m_numBytes
number of bytes in a frame
Definition: ImageAcquisition.h:55
int m_height
height of image in pixels
Definition: ImageAcquisition.h:54
void * m_buf
buffer to capture into
Definition: ImageAcquisition.h:58
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53
SimpleDirectShowAcq::~SimpleDirectShowAcq ( void  )
36 {
37 }
SimpleDirectShowAcq::SimpleDirectShowAcq ( void  )
SimpleDirectShowAcq::~SimpleDirectShowAcq ( void  )

Member Function Documentation

bool SimpleDirectShowAcq::CaptureFrame ( )
virtual

Captures a single frame into m_buf.

Returns
Returns TRUE upon completion

Implements ImageAcquisition.

References doCapture, isCaptureDone, and m_cameraIndex.

94 {
96 
97  while (!isCaptureDone(m_cameraIndex)) // captures into m_buf
98  {
99  Sleep(1);
100  }
101 
102  return true;
103 }
doCaptureProc doCapture
Definition: escapi.cpp:7
int m_cameraIndex
Definition: SimpleDirectShowAcq.h:39
isCaptureDoneProc isCaptureDone
Definition: escapi.cpp:8
bool SimpleDirectShowAcq::CaptureFrame ( )
virtual

Captures a single frame into m_buf.

Implements ImageAcquisition.

bool SimpleDirectShowAcq::Close ( )
virtual

Implements ImageAcquisition.

bool SimpleDirectShowAcq::Close ( )
virtual
Returns
Returns TRUE upon completion

Implements ImageAcquisition.

References deinitCapture, m_cameraIndex, and m_inited.

81 {
82  if (m_inited)
83  {
85  }
86 
87  return true;
88 }
deinitCaptureProc deinitCapture
Definition: escapi.cpp:6
int m_cameraIndex
Definition: SimpleDirectShowAcq.h:39
bool m_inited
TRUE if camera is initialized.
Definition: SimpleDirectShowAcq.h:40
bool SimpleDirectShowAcq::Open ( )
virtual
Returns
Returns the value of m_inited after initialization, e.g. returns TRUE if the camera is successfully initialized

Implements ImageAcquisition.

References initCapture, ImageAcquisition::m_buf, m_cameraIndex, ImageAcquisition::m_height, m_inited, ImageAcquisition::m_logMsg, m_numCameras, ImageAcquisition::m_width, SimpleCapParams::mHeight, SimpleCapParams::mTargetBuf, SimpleCapParams::mWidth, and setupESCAPI().

42 {
43  struct SimpleCapParams params;
44  bool success = false;
45 
46 
47  if (m_width == 0 || m_height == 0) // these get set in Init()
48  {
49  m_logMsg = "Unable to Open camera: width and height are not set.";
50  }
51  else
52  {
54 
55  if (m_numCameras == 0)
56  {
57  m_logMsg.Format("%s: no cameras found.\n", __FUNCTION__);
58  }
59  else
60  {
61  params.mWidth = m_width;
62  params.mHeight = m_height;
63  params.mTargetBuf = (int *)m_buf; // m_buf gets set in Init()
64  m_cameraIndex = 0;
65 
66  if (initCapture(m_cameraIndex, &params))
67  {
68  m_inited = true; // assigning it here avoids an annoying compiler warning
69  }
70  }
71  }
72 
73  return m_inited;
74 }
int m_height
height of image in pixels
Definition: ImageAcquisition.h:54
Definition: escapi.h:3
initCaptureProc initCapture
Definition: escapi.cpp:5
int m_cameraIndex
Definition: SimpleDirectShowAcq.h:39
void * m_buf
buffer to capture into
Definition: ImageAcquisition.h:58
CString m_logMsg
error or information message
Definition: ImageAcquisition.h:57
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53
int m_numCameras
Definition: SimpleDirectShowAcq.h:38
bool m_inited
TRUE if camera is initialized.
Definition: SimpleDirectShowAcq.h:40
int setupESCAPI()
Definition: escapi.cpp:16

Here is the call graph for this function:

bool SimpleDirectShowAcq::Open ( )
virtual

Implements ImageAcquisition.

Member Data Documentation

int SimpleDirectShowAcq::m_cameraIndex
protected

Referenced by CaptureFrame(), Close(), and Open().

bool SimpleDirectShowAcq::m_inited
protected

TRUE if camera is initialized.

Referenced by Close(), and Open().

int SimpleDirectShowAcq::m_numCameras
protected

Referenced by Open().


The documentation for this class was generated from the following files: