imgcodecs_c.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. #ifndef OPENCV_IMGCODECS_H
  42. #define OPENCV_IMGCODECS_H
  43. #include "opencv2/core/core_c.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif /* __cplusplus */
  47. /** @addtogroup imgcodecs_c
  48. @{
  49. */
  50. enum
  51. {
  52. /* 8bit, color or not */
  53. CV_LOAD_IMAGE_UNCHANGED =-1,
  54. /* 8bit, gray */
  55. CV_LOAD_IMAGE_GRAYSCALE =0,
  56. /* ?, color */
  57. CV_LOAD_IMAGE_COLOR =1,
  58. /* any depth, ? */
  59. CV_LOAD_IMAGE_ANYDEPTH =2,
  60. /* ?, any color */
  61. CV_LOAD_IMAGE_ANYCOLOR =4,
  62. /* ?, no rotate */
  63. CV_LOAD_IMAGE_IGNORE_ORIENTATION =128
  64. };
  65. /* load image from file
  66. iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
  67. overrides the other flags
  68. using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED
  69. unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit
  70. */
  71. CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
  72. CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
  73. enum
  74. {
  75. CV_IMWRITE_JPEG_QUALITY =1,
  76. CV_IMWRITE_JPEG_PROGRESSIVE =2,
  77. CV_IMWRITE_JPEG_OPTIMIZE =3,
  78. CV_IMWRITE_JPEG_RST_INTERVAL =4,
  79. CV_IMWRITE_JPEG_LUMA_QUALITY =5,
  80. CV_IMWRITE_JPEG_CHROMA_QUALITY =6,
  81. CV_IMWRITE_PNG_COMPRESSION =16,
  82. CV_IMWRITE_PNG_STRATEGY =17,
  83. CV_IMWRITE_PNG_BILEVEL =18,
  84. CV_IMWRITE_PNG_STRATEGY_DEFAULT =0,
  85. CV_IMWRITE_PNG_STRATEGY_FILTERED =1,
  86. CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2,
  87. CV_IMWRITE_PNG_STRATEGY_RLE =3,
  88. CV_IMWRITE_PNG_STRATEGY_FIXED =4,
  89. CV_IMWRITE_PXM_BINARY =32,
  90. CV_IMWRITE_EXR_TYPE = 48,
  91. CV_IMWRITE_WEBP_QUALITY =64,
  92. CV_IMWRITE_PAM_TUPLETYPE = 128,
  93. CV_IMWRITE_PAM_FORMAT_NULL = 0,
  94. CV_IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1,
  95. CV_IMWRITE_PAM_FORMAT_GRAYSCALE = 2,
  96. CV_IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3,
  97. CV_IMWRITE_PAM_FORMAT_RGB = 4,
  98. CV_IMWRITE_PAM_FORMAT_RGB_ALPHA = 5,
  99. };
  100. /* save image to file */
  101. CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
  102. const int* params CV_DEFAULT(0) );
  103. /* decode image stored in the buffer */
  104. CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
  105. CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
  106. /* encode image and store the result as a byte vector (single-row 8uC1 matrix) */
  107. CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image,
  108. const int* params CV_DEFAULT(0) );
  109. enum
  110. {
  111. CV_CVTIMG_FLIP =1,
  112. CV_CVTIMG_SWAP_RB =2
  113. };
  114. /* utility function: convert one image to another with optional vertical flip */
  115. CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0));
  116. CVAPI(int) cvHaveImageReader(const char* filename);
  117. CVAPI(int) cvHaveImageWriter(const char* filename);
  118. /****************************************************************************************\
  119. * Obsolete functions/synonyms *
  120. \****************************************************************************************/
  121. #define cvvLoadImage(name) cvLoadImage((name),1)
  122. #define cvvSaveImage cvSaveImage
  123. #define cvvConvertImage cvConvertImage
  124. /** @} imgcodecs_c */
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128. #endif // OPENCV_IMGCODECS_H