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

A class for acquiring from a file with the data in RGB format. More...

#include <FileAcq.h>

Inheritance diagram for FileAcq:
[legend]

Public Member Functions

 FileAcq (void)
 
 ~FileAcq (void)
 
bool CaptureFrame ()
 image is already in m_frame, so there's nothing to do More...
 
bool Close ()
 
void Init (const char *filepathname)
 Copies *filepathname to m_filename. More...
 
bool Open ()
 Loads a file first into the CImage object m_image, and then into m_buf inherited from class ImageAcquisition if allocation is successful. More...
 
 FileAcq (void)
 
 ~FileAcq (void)
 
bool CaptureFrame ()
 image is already in m_frame, so there's nothing to do More...
 
bool Close ()
 
void Init (const char *filepathname)
 
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

CImage m_image
 
CString m_filename
 fully-qualified image file name 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 from a file with the data in RGB format.

Constructor & Destructor Documentation

FileAcq::FileAcq ( void  )
24 {
25 }
FileAcq::~FileAcq ( void  )
29 {
30 }
FileAcq::FileAcq ( void  )
FileAcq::~FileAcq ( void  )

Member Function Documentation

bool FileAcq::CaptureFrame ( )
inlinevirtual

image is already in m_frame, so there's nothing to do

Implements ImageAcquisition.

bool FileAcq::CaptureFrame ( )
inlinevirtual

image is already in m_frame, so there's nothing to do

Implements ImageAcquisition.

bool FileAcq::Close ( )
inlinevirtual

Implements ImageAcquisition.

36 {return true;}
bool FileAcq::Close ( )
inlinevirtual

Implements ImageAcquisition.

36 {return true;}
void FileAcq::Init ( const char *  filepathname)
void FileAcq::Init ( const char *  filepathname)

Copies *filepathname to m_filename.

References m_filename.

36 {
37  m_filename = filepathname;
38 }
CString m_filename
fully-qualified image file name
Definition: FileAcq.h:42
bool FileAcq::Open ( )
virtual

Loads a file first into the CImage object m_image, and then into m_buf inherited from class ImageAcquisition if allocation is successful.

Returns
Returns TRUE if m_buf is successfully allocated, FALSE otherwise

Implements ImageAcquisition.

References height, ImageAcquisition::Init(), ImageAcquisition::m_buf, m_filename, ImageAcquisition::m_height, m_image, ImageAcquisition::m_width, and width.

45 {
46  bool success = false;
47  int width, height, bytesPerPixel;
48  HRESULT result;
49 
50  result = m_image.Load(m_filename);
51 
52  if (result == S_OK)
53  {
54  bytesPerPixel = m_image.GetBPP() / 8;
55  width = m_image.GetWidth();
56  height = m_image.GetHeight();
57  success = ImageAcquisition::Init(width, height, bytesPerPixel);
58 
59  if (success)
60  {
61  // copy the pixels into m_buf:
62  // create a memory drawing context
63  //
64  HDC hdc = m_image.GetDC();
65  HBITMAP hbitmap = (HBITMAP)m_image;//GetCurrentObject(hdc, OBJ_BITMAP);
66  BITMAPINFO info;
67 
68  memset(&info, 0, sizeof(info));
69  info.bmiHeader.biSize = sizeof(info.bmiHeader);
70  info.bmiHeader.biWidth = m_width;
71  info.bmiHeader.biHeight = -m_height; // a negative value means top-down instead of bottom-up
72  info.bmiHeader.biPlanes = 1;
73  info.bmiHeader.biBitCount = 32;
74  info.bmiHeader.biCompression = BI_RGB;
75  info.bmiHeader.biSizeImage = 0;
76  info.bmiHeader.biXPelsPerMeter = 1;
77  info.bmiHeader.biYPelsPerMeter = 1;
78  info.bmiHeader.biClrUsed = 0;
79  info.bmiHeader.biClrImportant = 0;
80 
81  GetDIBits(hdc, hbitmap, 0, m_height, m_buf, &info, DIB_RGB_COLORS);
82  m_image.ReleaseDC();
83  }
84  }
85 
86  return success;
87 }
CString m_filename
fully-qualified image file name
Definition: FileAcq.h:42
virtual bool Init(int width, int height, int bytesPerPixel=4)
may be overridden, but be sure to call parent function also
Definition: ImageAcquisition.cpp:43
CImage m_image
Definition: FileAcq.h:41
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
width
Definition: calculation_checks.m:1
height
Definition: calculation_checks.m:2

Here is the call graph for this function:

bool FileAcq::Open ( )
virtual

Implements ImageAcquisition.

Member Data Documentation

CString FileAcq::m_filename
protected

fully-qualified image file name

Referenced by Init(), and Open().

CImage FileAcq::m_image
protected

Referenced by Open().


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