1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2023-07-27 18:38:25 +03:00
151 changed files with 5199 additions and 1111 deletions
@@ -95,11 +95,11 @@ enum ImwriteFlags {
IMWRITE_PNG_STRATEGY = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_RLE.
IMWRITE_PNG_BILEVEL = 18, //!< Binary level PNG, 0 or 1, default is 0.
IMWRITE_PXM_BINARY = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.
IMWRITE_EXR_TYPE = (3 << 4) + 0, /* 48 */ //!< override EXR storage type (FLOAT (FP32) is default)
IMWRITE_EXR_COMPRESSION = (3 << 4) + 1, /* 49 */ //!< override EXR compression type (ZIP_COMPRESSION = 3 is default)
IMWRITE_EXR_DWA_COMPRESSION_LEVEL = (3 << 4) + 2, /* 50 */ //!< override EXR DWA compression level (45 is default)
IMWRITE_EXR_TYPE = (3 << 4) + 0 /* 48 */, //!< override EXR storage type (FLOAT (FP32) is default)
IMWRITE_EXR_COMPRESSION = (3 << 4) + 1 /* 49 */, //!< override EXR compression type (ZIP_COMPRESSION = 3 is default)
IMWRITE_EXR_DWA_COMPRESSION_LEVEL = (3 << 4) + 2 /* 50 */, //!< override EXR DWA compression level (45 is default)
IMWRITE_WEBP_QUALITY = 64, //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used.
IMWRITE_HDR_COMPRESSION = (5 << 4) + 0, /* 80 */ //!< specify HDR compression
IMWRITE_HDR_COMPRESSION = (5 << 4) + 0 /* 80 */, //!< specify HDR compression
IMWRITE_PAM_TUPLETYPE = 128,//!< For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format
IMWRITE_TIFF_RESUNIT = 256,//!< For TIFF, use to specify which DPI resolution unit to set; see libtiff documentation for valid values
IMWRITE_TIFF_XDPI = 257,//!< For TIFF, use to specify the X direction DPI
+6 -3
View File
@@ -148,11 +148,14 @@ AvifDecoder::~AvifDecoder() {
size_t AvifDecoder::signatureLength() const { return kAvifSignatureSize; }
bool AvifDecoder::checkSignature(const String &signature) const {
avifDecoderSetIOMemory(decoder_,
avifDecoder *decoder = avifDecoderCreate();
if (!decoder) return false;
avifDecoderSetIOMemory(decoder,
reinterpret_cast<const uint8_t *>(signature.c_str()),
signature.size());
decoder_->io->sizeHint = 1e9;
const avifResult status = avifDecoderParse(decoder_);
decoder->io->sizeHint = 1e9;
const avifResult status = avifDecoderParse(decoder);
avifDecoderDestroy(decoder);
return (status == AVIF_RESULT_OK || status == AVIF_RESULT_TRUNCATED_DATA);
}
+3 -3
View File
@@ -43,7 +43,7 @@
#include "precomp.hpp"
#include "utils.hpp"
#include "grfmt_pxm.hpp"
#include <iostream>
#include <opencv2/core/utils/logger.hpp>
#ifdef HAVE_IMGCODEC_PXM
@@ -191,7 +191,7 @@ bool PxMDecoder::readHeader()
}
catch (...)
{
std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "PXM::readHeader(): unknown C++ exception");
throw;
}
@@ -364,7 +364,7 @@ bool PxMDecoder::readData( Mat& img )
}
catch (...)
{
std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "PXM::readData(): unknown exception");
throw;
}
+25 -26
View File
@@ -437,12 +437,12 @@ imread_( const String& filename, int flags, Mat& mat )
}
catch (const cv::Exception& e)
{
std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imread_('" << filename << "'): can't read header: " << e.what());
return 0;
}
catch (...)
{
std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imread_('" << filename << "'): can't read header: unknown exception");
return 0;
}
@@ -475,11 +475,11 @@ imread_( const String& filename, int flags, Mat& mat )
}
catch (const cv::Exception& e)
{
std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imread_('" << filename << "'): can't read data: " << e.what());
}
catch (...)
{
std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imread_('" << filename << "'): can't read data: unknown exception");
}
if (!success)
{
@@ -542,12 +542,12 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats, int star
}
catch (const cv::Exception& e)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read header: " << e.what());
return 0;
}
catch (...)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read header: unknown exception");
return 0;
}
@@ -591,11 +591,11 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats, int star
}
catch (const cv::Exception& e)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read data: " << e.what());
}
catch (...)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read data: unknown exception");
}
if (!success)
break;
@@ -672,7 +672,7 @@ size_t imcount_(const String& filename, int flags)
return collection.size();
} catch(cv::Exception const& e) {
// Reading header or finding decoder for the filename is failed
std::cerr << "imcount_('" << filename << "'): can't read header or can't find decoder: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imcount_('" << filename << "'): can't read header or can't find decoder: " << e.what());
}
return 0;
}
@@ -750,14 +750,13 @@ static bool imwrite_( const String& filename, const std::vector<Mat>& img_vec,
}
catch (const cv::Exception& e)
{
std::cerr << "imwrite_('" << filename << "'): can't write data: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imwrite_('" << filename << "'): can't write data: " << e.what());
}
catch (...)
{
std::cerr << "imwrite_('" << filename << "'): can't write data: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imwrite_('" << filename << "'): can't write data: unknown exception");
}
// CV_Assert( code );
return code;
}
@@ -833,11 +832,11 @@ imdecode_( const Mat& buf, int flags, Mat& mat )
}
catch (const cv::Exception& e)
{
std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imdecode_('" << filename << "'): can't read header: " << e.what());
}
catch (...)
{
std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imdecode_('" << filename << "'): can't read header: unknown exception");
}
if (!success)
{
@@ -846,7 +845,7 @@ imdecode_( const Mat& buf, int flags, Mat& mat )
{
if (0 != remove(filename.c_str()))
{
std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
CV_LOG_WARNING(NULL, "unable to remove temporary file:" << filename);
}
}
return 0;
@@ -878,18 +877,18 @@ imdecode_( const Mat& buf, int flags, Mat& mat )
}
catch (const cv::Exception& e)
{
std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imdecode_('" << filename << "'): can't read data: " << e.what());
}
catch (...)
{
std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imdecode_('" << filename << "'): can't read data: unknown exception");
}
if (!filename.empty())
{
if (0 != remove(filename.c_str()))
{
std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
CV_LOG_WARNING(NULL, "unable to remove temporary file: " << filename);
}
}
@@ -982,11 +981,11 @@ imdecodemulti_(const Mat& buf, int flags, std::vector<Mat>& mats, int start, int
}
catch (const cv::Exception& e)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read header: " << e.what());
}
catch (...)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read header: unknown exception");
}
int current = start;
@@ -1007,7 +1006,7 @@ imdecodemulti_(const Mat& buf, int flags, std::vector<Mat>& mats, int start, int
{
if (0 != remove(filename.c_str()))
{
std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
CV_LOG_WARNING(NULL, "unable to remove temporary file: " << filename);
}
}
return 0;
@@ -1042,11 +1041,11 @@ imdecodemulti_(const Mat& buf, int flags, std::vector<Mat>& mats, int start, int
}
catch (const cv::Exception& e)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read data: " << e.what());
}
catch (...)
{
std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "imreadmulti_('" << filename << "'): can't read data: unknown exception");
}
if (!success)
break;
@@ -1069,7 +1068,7 @@ imdecodemulti_(const Mat& buf, int flags, std::vector<Mat>& mats, int start, int
{
if (0 != remove(filename.c_str()))
{
std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
CV_LOG_WARNING(NULL, "unable to remove temporary file: " << filename);
}
}
@@ -1280,10 +1279,10 @@ Mat ImageCollection::Impl::readData() {
success = true;
}
catch (const cv::Exception &e) {
std::cerr << "ImageCollection class: can't read data: " << e.what() << std::endl << std::flush;
CV_LOG_ERROR(NULL, "ImageCollection class: can't read data: " << e.what());
}
catch (...) {
std::cerr << "ImageCollection class:: can't read data: unknown exception" << std::endl << std::flush;
CV_LOG_ERROR(NULL, "ImageCollection class:: can't read data: unknown exception");
}
if (!success)
return cv::Mat();