mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -173,6 +173,8 @@ Currently, the following file formats are supported:
|
||||
- If EXIF information are embedded in the image file, the EXIF orientation will be taken into account
|
||||
and thus the image will be rotated accordingly except if the flag @ref IMREAD_IGNORE_ORIENTATION is passed.
|
||||
- Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
|
||||
- By default number of pixels must be less than 2^30. Limit can be set using system
|
||||
variable OPENCV_IO_MAX_IMAGE_PIXELS
|
||||
|
||||
@param filename Name of file to be loaded.
|
||||
@param flags Flag that can take values of cv::ImreadModes
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
#undef max
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <opencv2/core/utils/configuration.private.hpp>
|
||||
|
||||
|
||||
/****************************************************************************************\
|
||||
* Image Codecs *
|
||||
@@ -58,18 +60,17 @@
|
||||
|
||||
namespace cv {
|
||||
|
||||
// TODO Add runtime configuration
|
||||
#define CV_IO_MAX_IMAGE_PARAMS (50)
|
||||
#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
|
||||
#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
|
||||
#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
|
||||
static const size_t CV_IO_MAX_IMAGE_PARAMS = cv::utils::getConfigurationParameterSizeT("OPENCV_IO_MAX_IMAGE_PARAMS", 50);
|
||||
static const size_t CV_IO_MAX_IMAGE_WIDTH = utils::getConfigurationParameterSizeT("OPENCV_IO_MAX_IMAGE_WIDTH", 1 << 20);
|
||||
static const size_t CV_IO_MAX_IMAGE_HEIGHT = utils::getConfigurationParameterSizeT("OPENCV_IO_MAX_IMAGE_HEIGHT", 1 << 20);
|
||||
static const size_t CV_IO_MAX_IMAGE_PIXELS = utils::getConfigurationParameterSizeT("OPENCV_IO_MAX_IMAGE_PIXELS", 1 << 30);
|
||||
|
||||
static Size validateInputImageSize(const Size& size)
|
||||
{
|
||||
CV_Assert(size.width > 0);
|
||||
CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
|
||||
CV_Assert(static_cast<size_t>(size.width) <= CV_IO_MAX_IMAGE_WIDTH);
|
||||
CV_Assert(size.height > 0);
|
||||
CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
|
||||
CV_Assert(static_cast<size_t>(size.height) <= CV_IO_MAX_IMAGE_HEIGHT);
|
||||
uint64 pixels = (uint64)size.width * (uint64)size.height;
|
||||
CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
|
||||
return size;
|
||||
|
||||
Reference in New Issue
Block a user