ImageInputStream.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimage - An image library
  4. * See file License for license information.
  5. */
  6. #ifndef _IMAGEINPUTSTREAM_IMAGE_H
  7. #define _IMAGEINPUTSTREAM_IMAGE_H
  8. #include "core/image/ColorImageT.h"
  9. namespace NICE {
  10. /**
  11. * Abstract base class for an image input stream (like cameras and videos).
  12. *
  13. * @author Ferid Bajramovic (ferid [dot] bajramovic [at] informatik [dot] uni-jena [dot] de)
  14. *
  15. * @note
  16. * This class is HIGHLY experimental and might change in the future.
  17. */
  18. class ImageInputStream {
  19. public:
  20. //! destructor
  21. virtual ~ImageInputStream();
  22. /**
  23. * Has the end of the stream been reached or are more images available?
  24. * @return true if end of stream has been reached (cannot read images)
  25. */
  26. virtual bool endOfStream() = 0;
  27. /**
  28. * Read the next image from the stream (as RGB color image) .
  29. * @param buffer Will recieve the image data
  30. * @throw ImageException if no more images available
  31. */
  32. virtual void readColorImage(ColorImage& buffer) = 0;
  33. /**
  34. * Read the next image from the stream (as RGB color image)
  35. * and store the image data in a new ColorImage.
  36. * @return a new ColorImage conaining the image data.
  37. * @throw ImageException if no more images available
  38. */
  39. virtual ColorImage* readColorImageNew();
  40. /**
  41. * Read the next image from the stream (as gray image) .
  42. * @param buffer Will recieve the image data
  43. * @throw ImageException if no more images available
  44. */
  45. virtual void readGrayImage(Image& buffer) = 0;
  46. /**
  47. * Read the next image from the stream (as gray image)
  48. * and store the image data in a new Image.
  49. * @return a new Image conaining the image data.
  50. * @throw ImageException if no more images available
  51. */
  52. virtual Image* readGrayImageNew();
  53. /**
  54. * Get the width of the images.
  55. * @return width
  56. */
  57. virtual int imageWidth() = 0;
  58. /**
  59. * Get the height of the images.
  60. * @return height
  61. */
  62. virtual int imageHeight() = 0;
  63. // the following methods only make sense for video sources, not for cameras
  64. // they aren't needed in general anyway
  65. /**
  66. * Get the number of frames which can be read.
  67. * @return number of frames
  68. */
  69. //virtual int getNumberOfFrames() = 0;
  70. /**
  71. * Reset the stream back to the first image.
  72. */
  73. //virtual void reset() = 0;
  74. /**
  75. * Leave out the next \c frames frames.
  76. * @param frames Number of frames to ignore
  77. */
  78. //virtual void ignoreFrames(int frames) = 0;
  79. };
  80. } // namespace
  81. #endif // _IMAGEINPUTSTREAM_IMAGE_H