cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svlBufferImage.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Balazs Vagvolgyi
7  Created on: 2008
8 
9  (C) Copyright 2006-2008 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 
20 */
21 
22 #ifndef _svlBufferImage_h
23 #define _svlBufferImage_h
24 
28 
29 #if (CISST_OS == CISST_WINDOWS)
30 #include <windows.h>
31 #endif
32 
33 // Always include last!
35 
36 
38 {
39 public:
40  svlBufferImage(unsigned int width, unsigned int height);
41  ~svlBufferImage();
42 
43  unsigned int GetWidth();
44  unsigned int GetHeight();
45  unsigned int GetDataSize();
46 
47  unsigned char* GetPushBuffer();
48  unsigned char* GetPushBuffer(unsigned int& size);
49  void Push();
50  bool Push(const unsigned char* buffer, unsigned int size, bool topdown);
51 #if CISST_SVL_HAS_OPENCV
52  bool PushIplImage(IplImage* image);
53 #endif // CISST_SVL_HAS_OPENCV
54 
55  svlImageRGB* Pull(bool waitfornew, double timeout = 5.0);
56 #if CISST_SVL_HAS_OPENCV
57  IplImage* PullIplImage(bool waitfornew, double timeout = 5.0);
58 #endif // CISST_SVL_HAS_OPENCV
59 
60 private:
61  svlBufferImage() {}
62 
63 #if (CISST_OS == CISST_WINDOWS)
64  LONG Next, Latest, Locked;
65 #else
66  unsigned int Next, Latest, Locked;
67 #endif
68  int InitializationCounter;
69  osaThreadSignal NewFrameEvent;
70  svlImageRGB Buffer[3];
71 #if CISST_SVL_HAS_OPENCV
72  IplImage* OCVImage[3];
73  vctDynamicVector<unsigned char> OCVConvBuffer;
74 #endif // CISST_SVL_HAS_OPENCV
75 
76 #if (CISST_OS == CISST_LINUX_RTAI) || (CISST_OS == CISST_LINUX) || (CISST_OS == CISST_DARWIN) || (CISST_OS == CISST_SOLARIS)
78 #endif
79 
80  bool TopDownCopy(unsigned char *targetbuffer, const unsigned char *sourcebuffer);
81 };
82 
83 
84 #endif // _svlBufferImage_h
85 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Definition: osaCriticalSection.h:36
Definition: svlBufferImage.h:37
void IplImage
Definition: svlTypes.h:70
Declaration of osaThreadSignal.
Macros to export the symbols of cisstStereoVision (in a Dll).
Definition: osaThreadSignal.h:40