Table of Contents

Class ImageCollection

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Reads multi-page images on demand. Decodes pages lazily as they are accessed. Performance of page decoding is O(1) when the collection is accessed sequentially; accessing a page out of order is O(n) because the underlying reader has to restart from the beginning. Decoded pages are cached; call ReleaseCache(int) to free a decoded page's memory.

public class ImageCollection : CvObject, IDisposable, IEnumerable<Mat>, IEnumerable
Inheritance
ImageCollection
Implements
Inherited Members

Constructors

ImageCollection()

Creates an empty ImageCollection. Call Init(string, ImreadModes) before use.

ImageCollection(string, ImreadModes)

Creates an ImageCollection over the multi-page image file at the given path.

Properties

this[int]

Decodes and returns the page at the given index. Each call returns a freshly-copied Mat header that the caller owns and is responsible for disposing.

Size

Number of pages in the collection.

Methods

At(int)

Decodes and returns the page at the given index. Each call returns a freshly-copied Mat header that the caller owns and is responsible for disposing.

GetEnumerator()

Enumerates the pages of the collection in order (index 0, 1, 2, ...). Each yielded Mat is owned by the caller, which is responsible for disposing it (e.g. wrap the loop body in a using statement).

Init(string, ImreadModes)

(Re-)initializes this collection over the multi-page image file at the given path.

ReleaseCache(int)

Releases the cached decoded page at the given index.