Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoServer.hh
1 #ifndef __BIAS_VIDEOSERVER_HH__
2 #define __BIAS_VIDEOSERVER_HH__
3 
4 #include <iostream>
5 #include <sstream>
6 #include <string>
7 
8 #include <bias_config.h>
9 // BIAS
10 #include <Base/Debug/Debug.hh>
11 #include <Base/Image/ImageIO.hh>
12 #include <Filter/Rescale.hh>
13 #include <Image/Camera.hh>
14 #include <VideoSource/VideoSource_Base.hh>
15 #include <NetworkComm/CScommServer.hh>
16 
17 
18 #ifdef BIAS_HAVE_LIBJPEG
19 #include <Base/Image/CompressJpeg.hh>
20 #include <Base/Image/ImageConvert.hh>
21 #endif // BIAS_HAVE_LIBJPEG
22 
23 
24 namespace BIAS {
25 
26 /** @class VideoServer
27  @ingroup g_videotransmission
28  @ingroup network
29  @brief class to send images from a camera or disk to a client
30 
31  uses TCP or UDPServer
32  Catch images with the VideoSourve_Net class. <br>
33 
34  @todo fkellner 1/11: udp not working, options are hardcoded, needs doc
35  @author grest Nov. 2005
36 */
37 class BIASVideoSource_EXPORT VideoServer :public BIAS::Debug {
38 public:
39  VideoServer();
40  ~VideoServer();
41 
42  int Init(int port=D_CS_DEFAULT_PORT);
43 
44  int InitFromExistingSource(VideoSource *theSource, int port=D_CS_DEFAULT_PORT);
45 
46  void SetCompression(int compLvl = 60) { jpeg_ = compLvl; }
47 
48  void SetCameraType(int camType = 1) { camType_ = camType; }
49 
50  int ProcessOneImage();
51 
52  VideoSource *GetCamera() {return camera_;}
53 
54  double GetFPS(){return camParam_[0];}
55 
56  BIAS::Camera<unsigned char> *GetSendImage(){return &SendImage_;}
57 
58  inline unsigned int GetMessageSize() { return msgSize_; }
59 
60 protected:
61  int port_;
62  std::string targetAddress_;
64  int camType_, imgWidth_, imgHeight_, jpeg_;
65  double resizeFactor_;
67  bool useUDP_;
68 
69 
74  std::ostringstream SendBuffer_;
76 
77  unsigned int msgSize_;
78  // bool *CompressedMode_;
80  // int *CompressionQuality_;
81 
83 
84 #ifdef BIAS_HAVE_LIBJPEG
86 #endif //BIAS_HAVE_LIBJPEG
87 
88 private:
89  // disabled copy-constructor
90  VideoServer(const VideoServer &){};
91  VideoServer &operator=(const VideoServer &) {return *this;};
92 
93 }; // class VideoServer
94 
95 } // namespace BIAS
96 
97 
98 #endif
99 
100 
Wrapper for fast libjpeg methods.
Definition: CompressJpeg.hh:50
CScommServer server_
Definition: VideoServer.hh:82
Defines a common interface to different devices.
BIAS::Vector< double > camParam_
Definition: VideoServer.hh:63
BIAS::Camera< unsigned char > CamImage_
Definition: VideoServer.hh:71
BIAS::Camera< unsigned char > SendImage_
Definition: VideoServer.hh:72
BIAS::Camera< unsigned char > * GetSendImage()
Definition: VideoServer.hh:56
unsigned int msgSize_
Definition: VideoServer.hh:77
std::ostringstream SendBuffer_
Definition: VideoServer.hh:74
class for sending/receiving data between clients and serversOnly registered msgs will be accepted at ...
Definition: CScommServer.hh:55
VideoSource * GetCamera()
Definition: VideoServer.hh:52
JpegHandler Compressor_
Definition: VideoServer.hh:85
void SetCameraType(int camType=1)
Definition: VideoServer.hh:48
BIAS::Rescale< unsigned char, unsigned char > RescaleFilter_
Definition: VideoServer.hh:75
VideoSource * camera_
Definition: VideoServer.hh:70
void SetCompression(int compLvl=60)
Definition: VideoServer.hh:46
class to send images from a camera or disk to a client
Definition: VideoServer.hh:37
std::string targetAddress_
Definition: VideoServer.hh:62
unsigned int GetMessageSize()
Definition: VideoServer.hh:58