Converts image type ImageType::JPG2000.
More...
#include <ImageEncoder.h>
|
|
| Jp2ImageEncoder () |
| | Construct a new Jpeg 2000 Image Encoder object The default compression ratio is 4:1.
|
| void | SetCompressionRatio (int ratio) |
| | Set compression ratio.
|
| int | GetCompressionRatio () const |
| | Provides compression ratio.
|
| bool | IsLossy () const |
| | Check if encoder setup is lossy.
|
| bool | IsLossless () const |
| | Check if encoder setup is lossless.
|
| void | Accept (ImageEncoderVisitor &visitor) const final |
| | Allow visitor to visit concrete type of encoder.
|
| std::vector< uint8_t > | Encode (const RawImage &raw) const final |
| | Saves given RawImage as formatted image.
|
Converts image type ImageType::JPG2000.
◆ Accept()
Allow visitor to visit concrete type of encoder.
- Parameters
-
Implements ImageEncoder.
◆ Create()
◆ Encode()
| std::vector< uint8_t > Encode |
( |
const RawImage & | raw | ) |
const |
|
inlinefinalvirtualinherited |
Saves given RawImage as formatted image.
- Parameters
-
- Returns
- encoded image
- Exceptions
-
| ImageException | when it is not possible to encode image |
| InvalidImageArgumentException | when image is empty |
Implements ImageEncoder.
◆ GetCompressionRatio()
| int GetCompressionRatio |
( |
| ) |
const |
|
inline |
Provides compression ratio.
- Returns
- compression ratio, the value 1 has meaning lossless compression
◆ IsLossless()
| bool IsLossless |
( |
| ) |
const |
|
inline |
Check if encoder setup is lossless.
- Returns
- true lossless encoding
-
false lossy encoding
◆ IsLossy()
Check if encoder setup is lossy.
- Returns
- true lossy encoding
-
false lossless encoding
◆ SetCompressionRatio()
| void SetCompressionRatio |
( |
int | ratio | ) |
|
|
inline |
Set compression ratio.
In JPEG2000, the compression ratio is defined as the ratio of the size of the uncompressed, raw image to the size of the compressed image. \( raw\_size = width * height * number\_of\_channels * bit\_depth /8 \) where bit_depth is number of bits in channel (e.g. 8,16). For example, a compression ratio of 20:1 indicates that the compressed image is 1/20th the size of the raw image. Be aware that even if compression ratio is 1 (lossless) the image will not have raw_size because of used compaction.
To get for example half (ratio 2:1) of image size (the encoded lossless size) use formula \( raw\_size / lossless\_encoded\_jp2\_size * 2 \). The size will be closed to half due to additional size of JP2 overhead.
- Parameters
-
| ratio | specifies compression ratio ratio:1. It means that image size will be 1/ratio of uncompressed, raw image size. valid range is <1,1000>. The value 1 mean no compression, lossless. |
- Exceptions
-
| EnrollmentInvalidArgumentException | if the bitrate is not in the valid range <1,1000>. |
The documentation for this class was generated from the following file: