48 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
56 for (
int i=2; i<nrhs; i+=2) {
57 string key(rhs[i].toString());
58 if (key ==
"JpegQuality") {
62 else if (key ==
"JpegProgressive") {
64 params.
push_back(rhs[i+1].toBool() ? 1 : 0);
66 else if (key ==
"JpegOptimize") {
68 params.
push_back(rhs[i+1].toBool() ? 1 : 0);
70 else if (key ==
"JpegResetInterval") {
74 else if (key ==
"JpegLumaQuality") {
78 else if (key ==
"JpegChromaQuality") {
82 else if (key ==
"PngCompression") {
86 else if (key ==
"PngStrategy") {
90 else if (key ==
"PngBilevel") {
92 params.
push_back(rhs[i+1].toBool() ? 1 : 0);
94 else if (key ==
"PxmBinary") {
96 params.
push_back(rhs[i+1].toBool() ? 1 : 0);
98 else if (key ==
"ExrType") {
102 else if (key ==
"WebpQuality") {
106 else if (key ==
"PamTupleType") {
110 else if (key ==
"Params") {
113 if ((pvec.
size()%2) != 0)
115 "Params vectors must contain pairs of id/value.");
118 else if (key ==
"FlipChannels")
119 flip = rhs[i+1].toBool();
122 "Unrecognized option %s", key.
c_str());
126 string ext(rhs[0].toString());
135 bool success =
imencode(ext, img, buf, params);
const ConstMap< string, int > PamFormatMap
PAM tuple types for option processing.
void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0)
IMWRITE_PNG_STRATEGY_FILTERED
IMWRITE_PNG_STRATEGY_FIXED
IMWRITE_PAM_FORMAT_RGB_ALPHA
struct mxArray_tag mxArray
Forward declaration for mxArray.
IMWRITE_JPEG_RST_INTERVAL
bool imencode(const String &ext, InputArray img, std::vector< uchar > &buf, const std::vector< int > ¶ms=std::vector< int >())
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
const ConstMap< string, int > PngStrategyMap
PNG encoding strategies for option processing.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY
IMWRITE_JPEG_LUMA_QUALITY
IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA
IMWRITE_PAM_FORMAT_GRAYSCALE
IMWRITE_PNG_STRATEGY_DEFAULT
Global constant definitions.
const ConstMap< string, int > ExrTypeMap
EXR storage types for option processing.
IMWRITE_PAM_FORMAT_BLACKANDWHITE
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
void flip(InputArray src, OutputArray dst, int flipCode)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
std::map wrapper with one-line initialization and lookup method.
IMWRITE_JPEG_CHROMA_QUALITY