Jetson Inference
DNN Vision Library
imageWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __IMAGE_WRITER_H_
24 #define __IMAGE_WRITER_H_
25 
26 
27 #include "videoOutput.h"
28 
29 
50 class imageWriter : public videoOutput
51 {
52 public:
56  static imageWriter* Create( const char* path, const videoOptions& options=videoOptions() );
57 
61  static imageWriter* Create( const videoOptions& options );
62 
66  virtual ~imageWriter();
67 
72  template<typename T> bool Render( T* image, uint32_t width, uint32_t height ) { return Render((void**)image, width, height, imageFormatFromType<T>()); }
73 
78  virtual bool Render( void* image, uint32_t width, uint32_t height, imageFormat format );
79 
83  virtual inline uint32_t GetType() const { return Type; }
84 
88  static const uint32_t Type = (1 << 5);
89 
101  static const char* SupportedExtensions[];
102 
108  static bool IsSupportedExtension( const char* ext );
109 
110 protected:
111  imageWriter( const videoOptions& options );
112 
113  uint32_t mFileCount;
114  char mFileOut[1024];
115 };
116 
117 #endif
imageWriter::Type
static const uint32_t Type
Unique type identifier of imageWriter class.
Definition: imageWriter.h:88
imageWriter::mFileCount
uint32_t mFileCount
Definition: imageWriter.h:113
imageWriter::mFileOut
char mFileOut[1024]
Definition: imageWriter.h:114
imageWriter::~imageWriter
virtual ~imageWriter()
Destructor.
imageWriter::SupportedExtensions
static const char * SupportedExtensions[]
String array of supported image file extensions, terminated with a NULL sentinel value.
Definition: imageWriter.h:101
imageWriter::GetType
virtual uint32_t GetType() const
Return the interface type (imageWriter::Type)
Definition: imageWriter.h:83
imageWriter::imageWriter
imageWriter(const videoOptions &options)
imageWriter::Create
static imageWriter * Create(const char *path, const videoOptions &options=videoOptions())
Create an imageWriter instance from a path and optional videoOptions.
imageWriter
Save an image or set of images to disk.
Definition: imageWriter.h:50
imageWriter::IsSupportedExtension
static bool IsSupportedExtension(const char *ext)
Return true if the extension is in the list of SupportedExtensions.
videoOutput
The videoOutput API is for rendering and transmitting frames to video input devices such as display w...
Definition: videoOutput.h:104
videoOptions
The videoOptions struct contains common settings that are used to configure and query videoSource and...
Definition: videoOptions.h:37
imageWriter::Render
bool Render(T *image, uint32_t width, uint32_t height)
Save the next frame.
Definition: imageWriter.h:72
videoOutput.h
imageFormat
imageFormat
The imageFormat enum is used to identify the pixel format and colorspace of an image.
Definition: imageFormat.h:49