Back to Jetson Inference

Jetson Inference: imageLoader Class Reference

docs/html/classimageLoader.html

latest22.2 KB
Original Source

| | Jetson Inference

DNN Vision Library |

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members

imageLoader Class Reference Utilities Library (jetson-utils) » Image I/O

Load an image or set of images from disk into GPU memory. More...

#include <imageLoader.h>

Inheritance diagram for imageLoader:

|

Public Member Functions

| | virtual | ~imageLoader () | | | Destructor. More...
| | | | virtual bool | Capture (void **image, imageFormat format, uint64_t timeout=DEFAULT_TIMEOUT, int *status=NULL) | | | Load the next frame. More...
| | | | virtual bool | Open () | | | Open the stream. More...
| | | | virtual void | Close () | | | Close the stream. More...
| | | | bool | IsEOS () const | | | Return true if End Of Stream (EOS) has been reached. More...
| | | | virtual uint32_t | GetType () const | | | Return the interface type (imageLoader::Type) More...
| | | | Public Member Functions inherited from videoSource | | virtual | ~videoSource () | | | Destroy interface and release all resources. More...
| | | | template<typename T > | | bool | Capture (T **image, int *status) | | | Capture the next image from the video stream, using the default timeout of 1000ms. More...
| | | | template<typename T > | | bool | Capture (T **image, uint64_t timeout=DEFAULT_TIMEOUT, int *status=NULL) | | | Capture the next image from the video stream. More...
| | | | bool | IsStreaming () const | | | Check if the device is actively streaming or not. More...
| | | | uint32_t | GetWidth () const | | | Return the width of the stream, in pixels. More...
| | | | uint32_t | GetHeight () const | | | Return the height of the stream, in pixels. More...
| | | | uint32_t | GetFrameRate () const | | | Return the framerate, in Hz or FPS. More...
| | | | uint64_t | GetFrameCount () const | | | Return the number of frames captured. More...
| | | | uint64_t | GetLastTimestamp () const | | | Get timestamp of the last captured frame, in nanoseconds. More...
| | | | imageFormat | GetRawFormat () const | | | Get raw image format. More...
| | | | const URI & | GetResource () const | | | Return the resource URI of the stream. More...
| | | | const videoOptions & | GetOptions () const | | | Return the videoOptions of the stream. More...
| | | | bool | IsType (uint32_t type) const | | | Check if this stream is of a particular type. More...
| | | | template<typename T > | | bool | IsType () const | | | Check if a this stream is of a particular type. More...
| | | | const char * | TypeToStr () const | | | Convert this stream's class type to string. More...
| | |

|

Static Public Member Functions

| | static imageLoader * | Create (const char *path, const videoOptions &options=videoOptions()) | | | Create an imageLoader instance from a path and optional videoOptions. More...
| | | | static imageLoader * | Create (const videoOptions &options) | | | Create an imageLoader instance from the provided video options. More...
| | | | static bool | IsSupportedExtension (const char *ext) | | | Return true if the extension is in the list of SupportedExtensions. More...
| | | | Static Public Member Functions inherited from videoSource | | static videoSource * | Create (const videoOptions &options) | | | Create videoSource interface from a videoOptions struct that's already been filled out. More...
| | | | static videoSource * | Create (const char *URI, const videoOptions &options=videoOptions()) | | | Create videoSource interface from a resource URI string and optional videoOptions. More...
| | | | static videoSource * | Create (const char *URI, const commandLine &cmdLine) | | | Create videoSource interface from a resource URI string and parsing command line arguments. More...
| | | | static videoSource * | Create (const char *URI, const int argc, char **argv) | | | Create videoSource interface from a resource URI string and parsing command line arguments. More...
| | | | static videoSource * | Create (const int argc, char **argv, int positionArg=-1) | | | Create videoSource interface by parsing command line arguments, including the resource URI. More...
| | | | static videoSource * | Create (const commandLine &cmdLine, int positionArg=-1) | | | Create videoSource interface by parsing command line arguments, including the resource URI. More...
| | | | static const char * | Usage () | | | Usage string for command line arguments to Create()More...
| | | | static const char * | TypeToStr (uint32_t type) | | | Convert a class type to a string. More...
| | |

|

Static Public Attributes

| | static const uint32_t | Type = (1 << 4) | | | Unique type identifier of imageLoader class. More...
| | | | static const char * | SupportedExtensions [] | | | String array of supported image file extensions, terminated with a NULL sentinel value. More...
| | | | Static Public Attributes inherited from videoSource | | static const uint64_t | DEFAULT_TIMEOUT =1000 | | | The default Capture timeout (1000ms) More...
| | |

|

Protected Member Functions

| | | imageLoader (const videoOptions &options) | | | | bool | isLooping () const | | | | Protected Member Functions inherited from videoSource | | | videoSource (const videoOptions &options) | | |

|

Protected Attributes

| | bool | mEOS | | | | size_t | mLoopCount | | | | size_t | mNextFile | | | | std::vector< std::string > | mFiles | | | | std::vector< void * > | mBuffers | | | | Protected Attributes inherited from videoSource | | bool | mStreaming | | | | videoOptions | mOptions | | | | uint64_t | mLastTimestamp | | | | imageFormat | mRawFormat | | |

|

Additional Inherited Members

| | Public Types inherited from videoSource | | enum | Status { ERROR = -2, EOS = -1, TIMEOUT = 0, OK = 1 } | | | Stream status codes that are optionally returned from Capture()More...
| | |

Detailed Description

Load an image or set of images from disk into GPU memory.

Supported image formats for loading are JPG, PNG, TGA, BMP, GIF, PSD, HDR, PIC, and PNM (PPM/PGM binary). Internally, imageLoader uses the loadImage() function to load the images, so the supported formats are the same.

imageLoader has the ability to load an sequence of images from a directory, including wildcard characters (e.g. images/*.jpg), or just a single image. When given just the path to a directory, it will load all valid images from that directory.

NoteimageLoader implements the videoSource interface and is intended to be used through that as opposed to directly. videoSource implements additional command-line parsing of videoOptions to construct instances.See alsovideoSource

Constructor & Destructor Documentation

~imageLoader()

|

| virtual imageLoader::~imageLoader | ( | | ) | |

| virtual |

Destructor.

imageLoader()

|

| imageLoader::imageLoader | ( | const videoOptions & | options | ) | |

| protected |

Member Function Documentation

Capture()

|

| virtual bool imageLoader::Capture | ( | void ** | image, | | | | imageFormat | format, | | | | uint64_t | timeout = DEFAULT_TIMEOUT, | | | | int * | status = NULL | | | ) | | |

| virtual |

Load the next frame.

See alsovideoSource::Capture()

Implements videoSource.

Close()

|

| virtual void imageLoader::Close | ( | | ) | |

| virtual |

Close the stream.

See alsovideoSource::Close()

Reimplemented from videoSource.

Create() [1/2]

|

| static imageLoader* imageLoader::Create | ( | const char * | path, | | | | const videoOptions & | options = videoOptions() | | | ) | | |

| static |

Create an imageLoader instance from a path and optional videoOptions.

Create() [2/2]

|

| static imageLoader* imageLoader::Create | ( | const videoOptions & | options | ) | |

| static |

Create an imageLoader instance from the provided video options.

GetType()

|

| virtual uint32_t imageLoader::GetType | ( | | ) | const |

| inlinevirtual |

Return the interface type (imageLoader::Type)

Reimplemented from videoSource.

IsEOS()

|

| bool imageLoader::IsEOS | ( | | ) | const |

| inline |

Return true if End Of Stream (EOS) has been reached.

In the context of imageLoader, EOS means that all images in the sequence have been loaded, and looping is either disabled or all loops have already been run.

isLooping()

|

| bool imageLoader::isLooping | ( | | ) | const |

| inlineprotected |

IsSupportedExtension()

|

| static bool imageLoader::IsSupportedExtension | ( | const char * | ext | ) | |

| static |

Return true if the extension is in the list of SupportedExtensions.

Parameters

| ext | string containing the extension to be checked (should not contain leading dot) |

See alsoSupportedExtensions for the list of supported Video Streaming file extensions.

Open()

|

| virtual bool imageLoader::Open | ( | | ) | |

| virtual |

Open the stream.

See alsovideoSource::Open()

Reimplemented from videoSource.

Member Data Documentation

mBuffers

|

| std::vector<void*> imageLoader::mBuffers |

| protected |

mEOS

|

| bool imageLoader::mEOS |

| protected |

mFiles

|

| std::vector<std::string> imageLoader::mFiles |

| protected |

mLoopCount

|

| size_t imageLoader::mLoopCount |

| protected |

mNextFile

|

| size_t imageLoader::mNextFile |

| protected |

SupportedExtensions

|

| const char* imageLoader::SupportedExtensions[] |

| static |

String array of supported image file extensions, terminated with a NULL sentinel value.

The supported extension are:

  • JPG / JPEG

  • PNG

  • TGA / TARGA

  • BMP

  • GIF

    • PSD
  • HDR

  • PIC

  • PNM / PBM / PPM / PGM

See alsoIsSupportedExtension() to check a string against this list.

Type

|

| const uint32_t imageLoader::Type = (1 << 4) |

| static |

Unique type identifier of imageLoader class.


The documentation for this class was generated from the following file: