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

the base class for image acquisition More...

#include <ImageAcquisition.h>

Inheritance diagram for ImageAcquisition:
[legend]

Public Member Functions

 ImageAcquisition (void)
 
virtual ~ImageAcquisition (void)
 
virtual bool CaptureFrame ()=0
 capture a single image into m_buf More...
 
virtual bool Close ()=0
 
virtual bool Open ()=0
 
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)
 
virtual bool CaptureFrame ()=0
 capture a single image into m_buf More...
 
virtual bool Close ()=0
 
virtual bool Open ()=0
 
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)
 

Static Public Member Functions

static UINT __cdecl ThreadProc (LPVOID param)
 
static UINT __cdecl ThreadProc (LPVOID param)
 

Public Attributes

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...
 

Protected Attributes

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...
 

Detailed Description

the base class for image acquisition

Constructor & Destructor Documentation

ImageAcquisition::ImageAcquisition ( void  )

References m_buf, m_height, m_numBytes, m_numPixels, and 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
ImageAcquisition::~ImageAcquisition ( void  )
virtual

References m_buf.

36 {
37  if (m_buf != NULL)
38  {
39  delete [] m_buf;
40  }
41 }
void * m_buf
buffer to capture into
Definition: ImageAcquisition.h:58
ImageAcquisition::ImageAcquisition ( void  )
virtual ImageAcquisition::~ImageAcquisition ( void  )
virtual

Member Function Documentation

unsigned int ImageAcquisition::BytesPerFrame ( )
inline

References m_numBytes.

Referenced by COperatorConsoleApp::AllocateImageBuf().

41 {return m_numBytes;}
unsigned int m_numBytes
number of bytes in a frame
Definition: ImageAcquisition.h:55

Here is the caller graph for this function:

unsigned int ImageAcquisition::BytesPerFrame ( )
inline

References m_numBytes.

41 {return m_numBytes;}
unsigned int m_numBytes
number of bytes in a frame
Definition: ImageAcquisition.h:55
virtual bool ImageAcquisition::CaptureFrame ( )
pure virtual

capture a single image into m_buf

Implemented in FileAcq, FileAcq, ImatestLibAcq, SimpleDirectShowAcq, ImatestLibAcq, SimpleDirectShowAcq, FileAcquisition, FileAcquisition, ImatestLibAcq, and ImatestLibAcq.

Referenced by ThreadProc().

Here is the caller graph for this function:

virtual bool ImageAcquisition::CaptureFrame ( )
pure virtual
virtual bool ImageAcquisition::Close ( )
pure virtual
virtual bool ImageAcquisition::Close ( )
pure virtual
void ImageAcquisition::GetFrame ( void *  buf)
inline

References CriticalBuf::Get(), and m_frame.

38 {m_frame.Get(buf);}
void Get(void *buf)
Definition: CriticalBuf.cpp:59
CriticalBuf m_frame
shared memory to hold copy of current frame
Definition: ImageAcquisition.h:52

Here is the call graph for this function:

void ImageAcquisition::GetFrame ( void *  buf)
inline

References CriticalBuf::Get(), and m_frame.

Referenced by COperatorConsoleApp::OnFrameReady(), and COperatorConsoleApp::OnRunTest().

38 {m_frame.Get(buf);}
void Get(void *buf)
Definition: CriticalBuf.cpp:59
CriticalBuf m_frame
shared memory to hold copy of current frame
Definition: ImageAcquisition.h:52

Here is the call graph for this function:

Here is the caller graph for this function:

int ImageAcquisition::GetHeight ( )
inline

References m_height.

Referenced by COperatorConsoleApp::InitBlemishThread(), and COperatorConsoleApp::InitSFRplusThread().

43 {return m_height;}
int m_height
height of image in pixels
Definition: ImageAcquisition.h:54

Here is the caller graph for this function:

int ImageAcquisition::GetHeight ( )
inline

References m_height.

43 {return m_height;}
int m_height
height of image in pixels
Definition: ImageAcquisition.h:54
CString& ImageAcquisition::GetInfo ( )
inline

References m_logMsg.

Referenced by COperatorConsoleApp::Init(), and COperatorConsoleApp::ReInit().

44 {return m_logMsg;}
CString m_logMsg
error or information message
Definition: ImageAcquisition.h:57

Here is the caller graph for this function:

CString& ImageAcquisition::GetInfo ( )
inline

References m_logMsg.

44 {return m_logMsg;}
CString m_logMsg
error or information message
Definition: ImageAcquisition.h:57
int ImageAcquisition::GetWidth ( )
inline

References m_width.

45 {return m_width;}
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53
int ImageAcquisition::GetWidth ( )
inline

References m_width.

Referenced by COperatorConsoleApp::InitBlemishThread(), and COperatorConsoleApp::InitSFRplusThread().

45 {return m_width;}
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53

Here is the caller graph for this function:

bool ImageAcquisition::Init ( int  width,
int  height,
int  bytesPerPixel = 4 
)
virtual

may be overridden, but be sure to call parent function also

References height, CriticalBuf::Init(), m_buf, m_frame, m_height, m_logMsg, m_numBytes, m_numPixels, m_width, and width.

Referenced by FileAcquisition::Init(), COperatorConsoleApp::InitCamera(), and FileAcq::Open().

44 {
45  bool success = false;
46 
47  m_width = width;
48  m_height = height;
50  m_numBytes = m_numPixels * bytesPerPixel;
51 
52  if ( m_buf != NULL) // allow for resizing of buffer by re-initialization
53  {
54  delete[] m_buf;
55  }
56 
57  m_buf = new byte[m_numBytes];
58 
59  if (m_buf == NULL)
60  {
61  m_logMsg.Format("%s: Unable to allocate image buffer (%u bytes)", __FUNCTION__, m_numPixels);
62  }
63  else
64  {
65  success = m_frame.Init(m_numBytes);
66  }
67 
68  return success;
69 }
unsigned int m_numPixels
number of pixels in a frame
Definition: ImageAcquisition.h:56
CriticalBuf m_frame
shared memory to hold copy of current frame
Definition: ImageAcquisition.h:52
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
CString m_logMsg
error or information message
Definition: ImageAcquisition.h:57
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53
width
Definition: calculation_checks.m:1
bool Init(unsigned int bufLen)
Definition: CriticalBuf.cpp:39
height
Definition: calculation_checks.m:2

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool ImageAcquisition::Init ( int  width,
int  height,
int  bytesPerPixel = 4 
)
virtual

may be overridden, but be sure to call parent function also

virtual bool ImageAcquisition::Open ( )
pure virtual
virtual bool ImageAcquisition::Open ( )
pure virtual
unsigned int ImageAcquisition::PixelsPerFrame ( )
inline

References m_numPixels.

42 {return m_numPixels;}
unsigned int m_numPixels
number of pixels in a frame
Definition: ImageAcquisition.h:56
unsigned int ImageAcquisition::PixelsPerFrame ( )
inline

References m_numPixels.

42 {return m_numPixels;}
unsigned int m_numPixels
number of pixels in a frame
Definition: ImageAcquisition.h:56
void ImageAcquisition::SetHeight ( int  height)
inline

References height, and m_height.

46 {m_height = height;}
int m_height
height of image in pixels
Definition: ImageAcquisition.h:54
height
Definition: calculation_checks.m:2
void ImageAcquisition::SetHeight ( int  height)
inline

References height, and m_height.

46 {m_height = height;}
int m_height
height of image in pixels
Definition: ImageAcquisition.h:54
height
Definition: calculation_checks.m:2
void ImageAcquisition::SetWidth ( int  width)
inline

References m_width, and width.

47 {m_width = width;}
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53
width
Definition: calculation_checks.m:1
void ImageAcquisition::SetWidth ( int  width)
inline

References m_width, and width.

47 {m_width = width;}
int m_width
width of image in pixels
Definition: ImageAcquisition.h:53
width
Definition: calculation_checks.m:1
UINT __cdecl ImageAcquisition::ThreadProc ( LPVOID  param)
static

References CaptureFrame(), DONE_INDEX, m_buf, ThreadControl::m_data, ThreadControl::m_events, m_frame, ThreadControl::m_parentID, ThreadControl::m_threadMsg, NUM_THREAD_EVENTS, RUN_INDEX, and CriticalBuf::Set().

Referenced by COperatorConsoleApp::InitCameraThread().

73 {
74  ThreadControl *info = (ThreadControl *)param;
76  bool done = false;
77  DWORD eventIndex;
78 
79  while (!done)
80  {
81  eventIndex = ::WaitForMultipleObjects(NUM_THREAD_EVENTS, info->m_events, FALSE, INFINITE);
82 
83  if (eventIndex == DONE_INDEX)
84  {
85  done = TRUE;
86  }
87  else if (eventIndex == RUN_INDEX)
88  {
89  acq->CaptureFrame();
90  acq->m_frame.Set(acq->m_buf);
91 // acq->m_mwarray.Set(acq->m_mwarray);
92  ::PostThreadMessage(info->m_parentID, info->m_threadMsg, (WPARAM)0, (LPARAM)0);
93  }
94  }
95 
96  return 0; // this terminates the thread
97 }
Thread synchronization and communication class.
Definition: ThreadControl.h:56
void * m_data
pointer to whatever is useful
Definition: ThreadControl.h:77
virtual bool CaptureFrame()=0
capture a single image into m_buf
HANDLE m_events[2]
Definition: ThreadControl.h:74
the base class for image acquisition
Definition: ImageAcquisition.h:28
CriticalBuf m_frame
shared memory to hold copy of current frame
Definition: ImageAcquisition.h:52
#define NUM_THREAD_EVENTS
Definition: ThreadControl.h:51
void Set(void *buf)
Definition: CriticalBuf.cpp:74
#define RUN_INDEX
Definition: ThreadControl.h:49
void * m_buf
buffer to capture into
Definition: ImageAcquisition.h:58
#define DONE_INDEX
Definition: ThreadControl.h:50
DWORD m_parentID
the thread to send the message to
Definition: ThreadControl.h:76
UINT m_threadMsg
message to send to parent thread
Definition: ThreadControl.h:75

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT __cdecl ImageAcquisition::ThreadProc ( LPVOID  param)
static

Member Data Documentation

void * ImageAcquisition::m_buf
protected
int ImageAcquisition::m_device_ID

[Used Epiphan only]: indicates from which of the two sources to capture

CriticalBuf ImageAcquisition::m_frame
protected

shared memory to hold copy of current frame

Referenced by GetFrame(), Init(), and ThreadProc().

int ImageAcquisition::m_height
protected
std::string ImageAcquisition::m_ini_file

The fully-qualified name (including full path) of an Imatest INI file.

CString ImageAcquisition::m_logMsg
protected

error or information message

Referenced by GetInfo(), Init(), and SimpleDirectShowAcq::Open().

unsigned int ImageAcquisition::m_numBytes
protected

number of bytes in a frame

Referenced by BytesPerFrame(), ImageAcquisition(), Init(), and SimpleDirectShowAcq::SimpleDirectShowAcq().

unsigned int ImageAcquisition::m_numPixels
protected

number of pixels in a frame

Referenced by ImageAcquisition(), Init(), PixelsPerFrame(), and SimpleDirectShowAcq::SimpleDirectShowAcq().

int ImageAcquisition::m_source_ID

The source ID for acquire_image() that indicates what type of device is in use.

int ImageAcquisition::m_width
protected

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