1/*M/////////////////////////////////////////////////////////////////////////////////////// 2// 3// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4// 5// By downloading, copying, installing or using the software you agree to this license. 6// If you do not agree to this license, do not download, install, 7// copy or use the software. 8// 9// 10// Intel License Agreement 11// For Open Source Computer Vision Library 12// 13// Copyright (C) 2000, Intel Corporation, all rights reserved. 14// Third party copyrights are property of their respective owners. 15// 16// Redistribution and use in source and binary forms, with or without modification, 17// are permitted provided that the following conditions are met: 18// 19// * Redistribution's of source code must retain the above copyright notice, 20// this list of conditions and the following disclaimer. 21// 22// * Redistribution's in binary form must reproduce the above copyright notice, 23// this list of conditions and the following disclaimer in the documentation 24// and/or other materials provided with the distribution. 25// 26// * The name of Intel Corporation may not be used to endorse or promote products 27// derived from this software without specific prior written permission. 28// 29// This software is provided by the copyright holders and contributors "as is" and 30// any express or implied warranties, including, but not limited to, the implied 31// warranties of merchantability and fitness for a particular purpose are disclaimed. 32// In no event shall the Intel Corporation or contributors be liable for any direct, 33// indirect, incidental, special, exemplary, or consequential damages 34// (including, but not limited to, procurement of substitute goods or services; 35// loss of use, data, or profits; or business interruption) however caused 36// and on any theory of liability, whether in contract, strict liability, 37// or tort (including negligence or otherwise) arising in any way out of 38// the use of this software, even if advised of the possibility of such damage. 39// 40//M*/ 41 42#ifndef __OPENCV_IMGCODECS_H__ 43#define __OPENCV_IMGCODECS_H__ 44 45#include "opencv2/core/core_c.h" 46 47#ifdef __cplusplus 48extern "C" { 49#endif /* __cplusplus */ 50 51/** @addtogroup imgcodecs_c 52 @{ 53 */ 54 55enum 56{ 57/* 8bit, color or not */ 58 CV_LOAD_IMAGE_UNCHANGED =-1, 59/* 8bit, gray */ 60 CV_LOAD_IMAGE_GRAYSCALE =0, 61/* ?, color */ 62 CV_LOAD_IMAGE_COLOR =1, 63/* any depth, ? */ 64 CV_LOAD_IMAGE_ANYDEPTH =2, 65/* ?, any color */ 66 CV_LOAD_IMAGE_ANYCOLOR =4 67}; 68 69/* load image from file 70 iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED 71 overrides the other flags 72 using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED 73 unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit 74*/ 75CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 76CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 77 78enum 79{ 80 CV_IMWRITE_JPEG_QUALITY =1, 81 CV_IMWRITE_JPEG_PROGRESSIVE =2, 82 CV_IMWRITE_JPEG_OPTIMIZE =3, 83 CV_IMWRITE_JPEG_RST_INTERVAL =4, 84 CV_IMWRITE_JPEG_LUMA_QUALITY =5, 85 CV_IMWRITE_JPEG_CHROMA_QUALITY =6, 86 CV_IMWRITE_PNG_COMPRESSION =16, 87 CV_IMWRITE_PNG_STRATEGY =17, 88 CV_IMWRITE_PNG_BILEVEL =18, 89 CV_IMWRITE_PNG_STRATEGY_DEFAULT =0, 90 CV_IMWRITE_PNG_STRATEGY_FILTERED =1, 91 CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2, 92 CV_IMWRITE_PNG_STRATEGY_RLE =3, 93 CV_IMWRITE_PNG_STRATEGY_FIXED =4, 94 CV_IMWRITE_PXM_BINARY =32, 95 CV_IMWRITE_WEBP_QUALITY =64 96}; 97 98/* save image to file */ 99CVAPI(int) cvSaveImage( const char* filename, const CvArr* image, 100 const int* params CV_DEFAULT(0) ); 101 102/* decode image stored in the buffer */ 103CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 104CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 105 106/* encode image and store the result as a byte vector (single-row 8uC1 matrix) */ 107CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image, 108 const int* params CV_DEFAULT(0) ); 109 110enum 111{ 112 CV_CVTIMG_FLIP =1, 113 CV_CVTIMG_SWAP_RB =2 114}; 115 116/* utility function: convert one image to another with optional vertical flip */ 117CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0)); 118 119CVAPI(int) cvHaveImageReader(const char* filename); 120CVAPI(int) cvHaveImageWriter(const char* filename); 121 122 123/****************************************************************************************\ 124* Obsolete functions/synonyms * 125\****************************************************************************************/ 126 127#define cvvLoadImage(name) cvLoadImage((name),1) 128#define cvvSaveImage cvSaveImage 129#define cvvConvertImage cvConvertImage 130 131/** @} imgcodecs_c */ 132 133#ifdef __cplusplus 134} 135#endif 136 137#endif // __OPENCV_IMGCODECS_H__ 138