cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svlSampleImage.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: 2010
8 
9  (C) Copyright 2006-2010 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 _svlSampleImage_h
23 #define _svlSampleImage_h
24 
26 
27 // Always include last!
29 
30 // Forward declarations
31 class svlSampleMatrix;
32 struct svlProcInfo;
33 
34 
36 {
37 public:
39  svlSampleImage(const svlSampleImage & other);
40  virtual ~svlSampleImage();
41 
42  virtual svlPixelType GetPixelType() const;
43  virtual int GetAlphaChannel() const;
44 
45  virtual svlSample* GetNewInstance() const = 0;
46  virtual svlStreamType GetType() const = 0;
47  virtual int SetSize(const svlSample* sample) = 0;
48  virtual int SetSize(const svlSample& sample) = 0;
49  virtual int CopyOf(const svlSample* sample) = 0;
50  virtual int CopyOf(const svlSample& sample) = 0;
51  virtual bool IsInitialized() const = 0;
52  virtual unsigned char* GetUCharPointer() = 0;
53  virtual const unsigned char* GetUCharPointer() const = 0;
54  virtual unsigned int GetDataSize() const = 0;
55  virtual void SerializeRaw(std::ostream & outputStream) const = 0;
56  virtual void DeSerializeRaw(std::istream & inputStream) = 0;
57 
58  virtual IplImage* IplImageRef(const unsigned int videochannel = 0) const = 0;
59  virtual cv::Mat CvMatRef(const unsigned int videochannel = 0) const = 0;
60  virtual unsigned char* GetUCharPointer(const unsigned int videochannel) = 0;
61  virtual const unsigned char* GetUCharPointer(const unsigned int videochannel) const = 0;
62  virtual unsigned char* GetUCharPointer(const unsigned int videochannel, const unsigned int x, const unsigned int y) = 0;
63  virtual const unsigned char* GetUCharPointer(const unsigned int videochannel, const unsigned int x, const unsigned int y) const = 0;
64  virtual void SetSize(const unsigned int width, const unsigned int height) = 0;
65  virtual void SetSize(const unsigned int videochannel, const unsigned int width, const unsigned int height) = 0;
66  virtual int SetSize(const IplImage* ipl_image, const unsigned int videochannel = 0) = 0;
67  virtual int SetSize(const cv::Mat& cv_mat, const unsigned int videochannel = 0) = 0;
68  virtual int CopyOf(const IplImage* ipl_image, const unsigned int videochannel = 0) = 0;
69  virtual int CopyOf(const cv::Mat& cv_mat, const unsigned int videochannel = 0) = 0;
70  virtual unsigned int GetVideoChannels() const = 0;
71  virtual unsigned int GetDataChannels() const = 0;
72  virtual unsigned int GetBPP() const = 0;
73  virtual unsigned int GetWidth(const unsigned int videochannel = 0) const = 0;
74  virtual unsigned int GetHeight(const unsigned int videochannel = 0) const = 0;
75  virtual unsigned int GetRowStride(const unsigned int videochannel = 0) const = 0;
76  virtual unsigned int GetDataSize(const unsigned int videochannel) const = 0;
77 
78  // Used to split up the image for multi-threaded processing
79  virtual svlSampleImage* GetSubImage(const unsigned int top, const unsigned int height, const unsigned int videochannel = 0) = 0;
80  virtual svlSampleImage* GetSubImage(svlProcInfo* procInfo, const unsigned int videochannel = 0) = 0;
81 
82  int ImportData(unsigned char* input, const unsigned int size, const int param = 0, const unsigned int videoch = SVL_LEFT);
83  int ImportData(unsigned short* input, const unsigned int size, const int param = 0, const unsigned int videoch = SVL_LEFT);
84  int ImportData(unsigned int* input, const unsigned int size, const int param = 0, const unsigned int videoch = SVL_LEFT);
85  int ImportData(float* input, const unsigned int size, const int param = 0, const unsigned int videoch = SVL_LEFT);
86  int ImportImage(const svlSampleImage* image, const int param = 0);
87  int ImportImage(const svlSampleImage& image, const int param = 0);
88  int ImportImage(const svlSampleImage* image, const unsigned int src_channel, const unsigned int dest_channel, const int param = 0);
89  int ImportImage(const svlSampleImage& image, const unsigned int src_channel, const unsigned int dest_channel, const int param = 0);
90  int ImportMatrix(const svlSampleMatrix* matrix, const int param = 0, const unsigned int videoch = SVL_LEFT);
91  int ImportSample(const svlSample* sample);
92  int ImportSample(const svlSample* sample, const unsigned int videoch);
93 };
94 
95 
96 #endif // _svlSampleImage_h
97 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Definition: svlSampleMatrix.h:34
virtual svlSample * GetNewInstance() const =0
svlStreamType
Definition: svlDefinitions.h:193
virtual svlStreamType GetType() const =0
virtual int CopyOf(const svlSample *sample)=0
virtual unsigned char * GetUCharPointer()=0
virtual unsigned int GetDataSize() const =0
void IplImage
Definition: svlTypes.h:70
virtual void SerializeRaw(std::ostream &outputStream) const =0
virtual int SetSize(const svlSample *sample)=0
virtual void DeSerializeRaw(std::istream &inputStream)=0
Definition: svlSampleImage.h:35
Macros to export the symbols of cisstStereoVision (in a Dll).
#define SVL_LEFT
Definition: svlDefinitions.h:121
std::string Mat
Definition: svlTypes.h:72
Definition: svlProcInfo.h:33
virtual bool IsInitialized() const
svlPixelType
Definition: svlDefinitions.h:286
Definition: svlSample.h:31