mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 09:25:45 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
7842181b47
@ -1390,11 +1390,21 @@ OPENCV_HAL_IMPL_AVX_CHECK_SHORT(v_int16x16)
|
|||||||
////////// Other math /////////
|
////////// Other math /////////
|
||||||
|
|
||||||
/** Some frequent operations **/
|
/** Some frequent operations **/
|
||||||
|
#if CV_FMA3
|
||||||
#define OPENCV_HAL_IMPL_AVX_MULADD(_Tpvec, suffix) \
|
#define OPENCV_HAL_IMPL_AVX_MULADD(_Tpvec, suffix) \
|
||||||
inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
{ return _Tpvec(_mm256_fmadd_##suffix(a.val, b.val, c.val)); } \
|
{ return _Tpvec(_mm256_fmadd_##suffix(a.val, b.val, c.val)); } \
|
||||||
inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
{ return _Tpvec(_mm256_fmadd_##suffix(a.val, b.val, c.val)); } \
|
{ return _Tpvec(_mm256_fmadd_##suffix(a.val, b.val, c.val)); }
|
||||||
|
#else
|
||||||
|
#define OPENCV_HAL_IMPL_AVX_MULADD(_Tpvec, suffix) \
|
||||||
|
inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
|
{ return _Tpvec(_mm256_add_##suffix(_mm256_mul_##suffix(a.val, b.val), c.val)); } \
|
||||||
|
inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
|
{ return _Tpvec(_mm256_add_##suffix(_mm256_mul_##suffix(a.val, b.val), c.val)); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPENCV_HAL_IMPL_AVX_MISC(_Tpvec, suffix) \
|
||||||
inline _Tpvec v_sqrt(const _Tpvec& x) \
|
inline _Tpvec v_sqrt(const _Tpvec& x) \
|
||||||
{ return _Tpvec(_mm256_sqrt_##suffix(x.val)); } \
|
{ return _Tpvec(_mm256_sqrt_##suffix(x.val)); } \
|
||||||
inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \
|
inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \
|
||||||
@ -1404,6 +1414,8 @@ OPENCV_HAL_IMPL_AVX_CHECK_SHORT(v_int16x16)
|
|||||||
|
|
||||||
OPENCV_HAL_IMPL_AVX_MULADD(v_float32x8, ps)
|
OPENCV_HAL_IMPL_AVX_MULADD(v_float32x8, ps)
|
||||||
OPENCV_HAL_IMPL_AVX_MULADD(v_float64x4, pd)
|
OPENCV_HAL_IMPL_AVX_MULADD(v_float64x4, pd)
|
||||||
|
OPENCV_HAL_IMPL_AVX_MISC(v_float32x8, ps)
|
||||||
|
OPENCV_HAL_IMPL_AVX_MISC(v_float64x4, pd)
|
||||||
|
|
||||||
inline v_int32x8 v_fma(const v_int32x8& a, const v_int32x8& b, const v_int32x8& c)
|
inline v_int32x8 v_fma(const v_int32x8& a, const v_int32x8& b, const v_int32x8& c)
|
||||||
{
|
{
|
||||||
|
@ -1385,11 +1385,21 @@ inline v_uint64x8 v_popcount(const v_uint64x8& a) { return v_popcount(v_reinte
|
|||||||
////////// Other math /////////
|
////////// Other math /////////
|
||||||
|
|
||||||
/** Some frequent operations **/
|
/** Some frequent operations **/
|
||||||
|
#if CV_FMA3
|
||||||
#define OPENCV_HAL_IMPL_AVX512_MULADD(_Tpvec, suffix) \
|
#define OPENCV_HAL_IMPL_AVX512_MULADD(_Tpvec, suffix) \
|
||||||
inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
{ return _Tpvec(_mm512_fmadd_##suffix(a.val, b.val, c.val)); } \
|
{ return _Tpvec(_mm512_fmadd_##suffix(a.val, b.val, c.val)); } \
|
||||||
inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
{ return _Tpvec(_mm512_fmadd_##suffix(a.val, b.val, c.val)); } \
|
{ return _Tpvec(_mm512_fmadd_##suffix(a.val, b.val, c.val)); }
|
||||||
|
#else
|
||||||
|
#define OPENCV_HAL_IMPL_AVX512_MULADD(_Tpvec, suffix) \
|
||||||
|
inline _Tpvec v_fma(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
|
{ return _Tpvec(_mm512_add_##suffix(_mm512_mul_##suffix(a.val, b.val), c.val)); } \
|
||||||
|
inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
|
||||||
|
{ return _Tpvec(_mm512_add_##suffix(_mm512_mul_##suffix(a.val, b.val), c.val)); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPENCV_HAL_IMPL_AVX512_MISC(_Tpvec, suffix) \
|
||||||
inline _Tpvec v_sqrt(const _Tpvec& x) \
|
inline _Tpvec v_sqrt(const _Tpvec& x) \
|
||||||
{ return _Tpvec(_mm512_sqrt_##suffix(x.val)); } \
|
{ return _Tpvec(_mm512_sqrt_##suffix(x.val)); } \
|
||||||
inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \
|
inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \
|
||||||
@ -1399,6 +1409,8 @@ inline v_uint64x8 v_popcount(const v_uint64x8& a) { return v_popcount(v_reinte
|
|||||||
|
|
||||||
OPENCV_HAL_IMPL_AVX512_MULADD(v_float32x16, ps)
|
OPENCV_HAL_IMPL_AVX512_MULADD(v_float32x16, ps)
|
||||||
OPENCV_HAL_IMPL_AVX512_MULADD(v_float64x8, pd)
|
OPENCV_HAL_IMPL_AVX512_MULADD(v_float64x8, pd)
|
||||||
|
OPENCV_HAL_IMPL_AVX512_MISC(v_float32x16, ps)
|
||||||
|
OPENCV_HAL_IMPL_AVX512_MISC(v_float64x8, pd)
|
||||||
|
|
||||||
inline v_int32x16 v_fma(const v_int32x16& a, const v_int32x16& b, const v_int32x16& c)
|
inline v_int32x16 v_fma(const v_int32x16& a, const v_int32x16& b, const v_int32x16& c)
|
||||||
{ return a * b + c; }
|
{ return a * b + c; }
|
||||||
|
@ -14,9 +14,6 @@ ocv_add_dispatched_file_force_all("int8layers/layers_common" AVX2 AVX512_SKX)
|
|||||||
ocv_add_module(dnn opencv_core opencv_imgproc WRAP python java objc js)
|
ocv_add_module(dnn opencv_core opencv_imgproc WRAP python java objc js)
|
||||||
|
|
||||||
ocv_option(OPENCV_DNN_OPENCL "Build with OpenCL support" HAVE_OPENCL AND NOT APPLE)
|
ocv_option(OPENCV_DNN_OPENCL "Build with OpenCL support" HAVE_OPENCL AND NOT APPLE)
|
||||||
if(HAVE_TENGINE)
|
|
||||||
add_definitions(-DHAVE_TENGINE=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
|
if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
|
||||||
add_definitions(-DCV_OCL4DNN=1)
|
add_definitions(-DCV_OCL4DNN=1)
|
||||||
@ -44,6 +41,10 @@ endif()
|
|||||||
|
|
||||||
ocv_cmake_hook_append(INIT_MODULE_SOURCES_opencv_dnn "${CMAKE_CURRENT_LIST_DIR}/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake")
|
ocv_cmake_hook_append(INIT_MODULE_SOURCES_opencv_dnn "${CMAKE_CURRENT_LIST_DIR}/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake")
|
||||||
|
|
||||||
|
if(HAVE_TENGINE)
|
||||||
|
add_definitions(-DHAVE_TENGINE=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions( -D_CRT_SECURE_NO_WARNINGS=1 )
|
add_definitions( -D_CRT_SECURE_NO_WARNINGS=1 )
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include <google/protobuf/message.h>
|
#include <google/protobuf/message.h>
|
||||||
#include <google/protobuf/text_format.h>
|
#include <google/protobuf/text_format.h>
|
||||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||||
|
#include <google/protobuf/reflection.h>
|
||||||
#include "caffe_io.hpp"
|
#include "caffe_io.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -57,8 +58,7 @@ namespace dnn {
|
|||||||
CV__DNN_INLINE_NS_BEGIN
|
CV__DNN_INLINE_NS_BEGIN
|
||||||
|
|
||||||
#ifdef HAVE_PROTOBUF
|
#ifdef HAVE_PROTOBUF
|
||||||
using ::google::protobuf::RepeatedField;
|
using ::google::protobuf::RepeatedFieldRef;
|
||||||
using ::google::protobuf::RepeatedPtrField;
|
|
||||||
using ::google::protobuf::Message;
|
using ::google::protobuf::Message;
|
||||||
using ::google::protobuf::Descriptor;
|
using ::google::protobuf::Descriptor;
|
||||||
using ::google::protobuf::FieldDescriptor;
|
using ::google::protobuf::FieldDescriptor;
|
||||||
@ -136,7 +136,7 @@ public:
|
|||||||
|
|
||||||
#define SET_UP_FILED(getter, arrayConstr, gtype) \
|
#define SET_UP_FILED(getter, arrayConstr, gtype) \
|
||||||
if (isRepeated) { \
|
if (isRepeated) { \
|
||||||
const RepeatedField<gtype> &v = refl->GetRepeatedField<gtype>(msg, field); \
|
const RepeatedFieldRef<gtype> v = refl->GetRepeatedFieldRef<gtype>(msg, field); \
|
||||||
params.set(name, DictValue::arrayConstr(v.begin(), (int)v.size())); \
|
params.set(name, DictValue::arrayConstr(v.begin(), (int)v.size())); \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
@ -168,7 +168,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
case FieldDescriptor::CPPTYPE_STRING:
|
case FieldDescriptor::CPPTYPE_STRING:
|
||||||
if (isRepeated) {
|
if (isRepeated) {
|
||||||
const RepeatedPtrField<std::string> &v = refl->GetRepeatedPtrField<std::string>(msg, field);
|
const RepeatedFieldRef<std::string> v = refl->GetRepeatedFieldRef<std::string>(msg, field);
|
||||||
params.set(name, DictValue::arrayString(v.begin(), (int)v.size()));
|
params.set(name, DictValue::arrayString(v.begin(), (int)v.size()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2888,14 +2888,21 @@ DataLayout TFImporter::predictOutputDataLayout(const tensorflow::NodeDef& layer)
|
|||||||
|
|
||||||
void TFImporter::populateNet()
|
void TFImporter::populateNet()
|
||||||
{
|
{
|
||||||
CV_Assert(netBin.ByteSize() || netTxt.ByteSize());
|
#if GOOGLE_PROTOBUF_VERSION < 3005000
|
||||||
|
size_t netBinSize = saturate_cast<size_t>(netBin.ByteSize());
|
||||||
|
size_t netTxtSize = saturate_cast<size_t>(netTxt.ByteSize());
|
||||||
|
#else
|
||||||
|
size_t netBinSize = netBin.ByteSizeLong();
|
||||||
|
size_t netTxtSize = netTxt.ByteSizeLong();
|
||||||
|
#endif
|
||||||
|
CV_Assert(netBinSize || netTxtSize);
|
||||||
|
|
||||||
CV_LOG_INFO(NULL, "DNN/TF: parsing model"
|
CV_LOG_INFO(NULL, "DNN/TF: parsing model"
|
||||||
<< (netBin.has_versions() ? cv::format(" produced by TF v%d (min_consumer=%d)", (int)netBin.versions().producer(), (int)netBin.versions().min_consumer()) : cv::String(" (N/A version info)"))
|
<< (netBin.has_versions() ? cv::format(" produced by TF v%d (min_consumer=%d)", (int)netBin.versions().producer(), (int)netBin.versions().min_consumer()) : cv::String(" (N/A version info)"))
|
||||||
<< ". Number of nodes = " << netBin.node_size()
|
<< ". Number of nodes = " << netBin.node_size()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (netTxt.ByteSize())
|
if (netTxtSize)
|
||||||
{
|
{
|
||||||
CV_LOG_INFO(NULL, "DNN/TF: parsing config"
|
CV_LOG_INFO(NULL, "DNN/TF: parsing config"
|
||||||
<< (netTxt.has_versions() ? cv::format(" produced by TF v%d (min_consumer=%d)", (int)netTxt.versions().producer(), (int)netTxt.versions().min_consumer()) : cv::String(" (N/A version info)"))
|
<< (netTxt.has_versions() ? cv::format(" produced by TF v%d (min_consumer=%d)", (int)netTxt.versions().producer(), (int)netTxt.versions().min_consumer()) : cv::String(" (N/A version info)"))
|
||||||
@ -2924,7 +2931,7 @@ void TFImporter::populateNet()
|
|||||||
CV_LOG_DEBUG(NULL, "DNN/TF: sortByExecutionOrder(model) => " << netBin.node_size() << " nodes");
|
CV_LOG_DEBUG(NULL, "DNN/TF: sortByExecutionOrder(model) => " << netBin.node_size() << " nodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
tensorflow::GraphDef& net = netTxt.ByteSize() != 0 ? netTxt : netBin;
|
tensorflow::GraphDef& net = netTxtSize != 0 ? netTxt : netBin;
|
||||||
|
|
||||||
int layersSize = net.node_size();
|
int layersSize = net.node_size();
|
||||||
|
|
||||||
@ -3027,7 +3034,12 @@ void TFImporter::addPermuteLayer(const int* order, const std::string& permName,
|
|||||||
|
|
||||||
void TFImporter::parseNode(const tensorflow::NodeDef& layer)
|
void TFImporter::parseNode(const tensorflow::NodeDef& layer)
|
||||||
{
|
{
|
||||||
tensorflow::GraphDef& net = netTxt.ByteSize() != 0 ? netTxt : netBin;
|
#if GOOGLE_PROTOBUF_VERSION < 3005000
|
||||||
|
size_t netTxtSize = saturate_cast<size_t>(netTxt.ByteSize());
|
||||||
|
#else
|
||||||
|
size_t netTxtSize = netTxt.ByteSizeLong();
|
||||||
|
#endif
|
||||||
|
tensorflow::GraphDef& net = netTxtSize != 0 ? netTxt : netBin;
|
||||||
|
|
||||||
const std::string& name = layer.name();
|
const std::string& name = layer.name();
|
||||||
const std::string& type = layer.op();
|
const std::string& type = layer.op();
|
||||||
|
@ -151,16 +151,23 @@ sources on the web, primarily from the Charles Poynton site <http://www.poynton.
|
|||||||
Bayer \f$\rightarrow\f$ RGB
|
Bayer \f$\rightarrow\f$ RGB
|
||||||
---------------------------
|
---------------------------
|
||||||
The Bayer pattern is widely used in CCD and CMOS cameras. It enables you to get color pictures
|
The Bayer pattern is widely used in CCD and CMOS cameras. It enables you to get color pictures
|
||||||
from a single plane where R,G, and B pixels (sensors of a particular component) are interleaved
|
from a single plane where R, G, and B pixels (sensors of a particular component) are interleaved
|
||||||
as follows:
|
as follows:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The output RGB components of a pixel are interpolated from 1, 2, or 4 neighbors of the pixel
|
||||||
|
having the same color.
|
||||||
|
|
||||||
|
@note See the following for information about correspondences between OpenCV Bayer pattern naming and classical Bayer pattern naming.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
The output RGB components of a pixel are interpolated from 1, 2, or 4 neighbors of the pixel
|
There are several modifications of the above pattern that can be achieved
|
||||||
having the same color. There are several modifications of the above pattern that can be achieved
|
|
||||||
by shifting the pattern one pixel left and/or one pixel up. The two letters \f$C_1\f$ and \f$C_2\f$ in
|
by shifting the pattern one pixel left and/or one pixel up. The two letters \f$C_1\f$ and \f$C_2\f$ in
|
||||||
the conversion constants CV_Bayer \f$C_1 C_2\f$ 2BGR and CV_Bayer \f$C_1 C_2\f$ 2RGB indicate the
|
the conversion constants CV_Bayer \f$C_1 C_2\f$ 2BGR and CV_Bayer \f$C_1 C_2\f$ 2RGB indicate the
|
||||||
particular pattern type. These are components from the second row, second and third columns,
|
particular pattern type. These are components from the second row, second and third columns,
|
||||||
respectively. For example, the above pattern has a very popular "BG" type.
|
respectively. For example, the above pattern has a very popular "BG" type.
|
||||||
|
|
||||||
@see cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR, cv::COLOR_BayerBG2RGB, cv::COLOR_BayerGB2RGB, cv::COLOR_BayerRG2RGB, cv::COLOR_BayerGR2RGB
|
@see cv::COLOR_BayerRGGB2BGR, cv::COLOR_BayerGRBG2BGR, cv::COLOR_BayerBGGR2BGR, cv::COLOR_BayerGBRG2BGR, cv::COLOR_BayerRGGB2RGB, cv::COLOR_BayerGRBG2RGB, cv::COLOR_BayerBGGR2RGB, cv::COLOR_BayerGBRG2RGB
|
||||||
|
cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR, cv::COLOR_BayerBG2RGB, cv::COLOR_BayerGB2RGB, cv::COLOR_BayerRG2RGB, cv::COLOR_BayerGR2RGB
|
||||||
|
BIN
modules/imgproc/doc/pics/Bayer_patterns.png
Executable file
BIN
modules/imgproc/doc/pics/Bayer_patterns.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -744,54 +744,99 @@ enum ColorConversionCodes {
|
|||||||
COLOR_RGBA2YUV_YV12 = 133,
|
COLOR_RGBA2YUV_YV12 = 133,
|
||||||
COLOR_BGRA2YUV_YV12 = 134,
|
COLOR_BGRA2YUV_YV12 = 134,
|
||||||
|
|
||||||
//! Demosaicing
|
//! Demosaicing, see @ref color_convert_bayer "color conversions" for additional information
|
||||||
COLOR_BayerBG2BGR = 46,
|
COLOR_BayerBG2BGR = 46, //!< equivalent to RGGB Bayer pattern
|
||||||
COLOR_BayerGB2BGR = 47,
|
COLOR_BayerGB2BGR = 47, //!< equivalent to GRBG Bayer pattern
|
||||||
COLOR_BayerRG2BGR = 48,
|
COLOR_BayerRG2BGR = 48, //!< equivalent to BGGR Bayer pattern
|
||||||
COLOR_BayerGR2BGR = 49,
|
COLOR_BayerGR2BGR = 49, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
COLOR_BayerBG2RGB = COLOR_BayerRG2BGR,
|
COLOR_BayerRGGB2BGR = COLOR_BayerBG2BGR,
|
||||||
COLOR_BayerGB2RGB = COLOR_BayerGR2BGR,
|
COLOR_BayerGRBG2BGR = COLOR_BayerGB2BGR,
|
||||||
COLOR_BayerRG2RGB = COLOR_BayerBG2BGR,
|
COLOR_BayerBGGR2BGR = COLOR_BayerRG2BGR,
|
||||||
COLOR_BayerGR2RGB = COLOR_BayerGB2BGR,
|
COLOR_BayerGBRG2BGR = COLOR_BayerGR2BGR,
|
||||||
|
|
||||||
COLOR_BayerBG2GRAY = 86,
|
COLOR_BayerRGGB2RGB = COLOR_BayerBGGR2BGR,
|
||||||
COLOR_BayerGB2GRAY = 87,
|
COLOR_BayerGRBG2RGB = COLOR_BayerGBRG2BGR,
|
||||||
COLOR_BayerRG2GRAY = 88,
|
COLOR_BayerBGGR2RGB = COLOR_BayerRGGB2BGR,
|
||||||
COLOR_BayerGR2GRAY = 89,
|
COLOR_BayerGBRG2RGB = COLOR_BayerGRBG2BGR,
|
||||||
|
|
||||||
|
COLOR_BayerBG2RGB = COLOR_BayerRG2BGR, //!< equivalent to RGGB Bayer pattern
|
||||||
|
COLOR_BayerGB2RGB = COLOR_BayerGR2BGR, //!< equivalent to GRBG Bayer pattern
|
||||||
|
COLOR_BayerRG2RGB = COLOR_BayerBG2BGR, //!< equivalent to BGGR Bayer pattern
|
||||||
|
COLOR_BayerGR2RGB = COLOR_BayerGB2BGR, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
|
COLOR_BayerBG2GRAY = 86, //!< equivalent to RGGB Bayer pattern
|
||||||
|
COLOR_BayerGB2GRAY = 87, //!< equivalent to GRBG Bayer pattern
|
||||||
|
COLOR_BayerRG2GRAY = 88, //!< equivalent to BGGR Bayer pattern
|
||||||
|
COLOR_BayerGR2GRAY = 89, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
|
COLOR_BayerRGGB2GRAY = COLOR_BayerBG2GRAY,
|
||||||
|
COLOR_BayerGRBG2GRAY = COLOR_BayerGB2GRAY,
|
||||||
|
COLOR_BayerBGGR2GRAY = COLOR_BayerRG2GRAY,
|
||||||
|
COLOR_BayerGBRG2GRAY = COLOR_BayerGR2GRAY,
|
||||||
|
|
||||||
//! Demosaicing using Variable Number of Gradients
|
//! Demosaicing using Variable Number of Gradients
|
||||||
COLOR_BayerBG2BGR_VNG = 62,
|
COLOR_BayerBG2BGR_VNG = 62, //!< equivalent to RGGB Bayer pattern
|
||||||
COLOR_BayerGB2BGR_VNG = 63,
|
COLOR_BayerGB2BGR_VNG = 63, //!< equivalent to GRBG Bayer pattern
|
||||||
COLOR_BayerRG2BGR_VNG = 64,
|
COLOR_BayerRG2BGR_VNG = 64, //!< equivalent to BGGR Bayer pattern
|
||||||
COLOR_BayerGR2BGR_VNG = 65,
|
COLOR_BayerGR2BGR_VNG = 65, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG,
|
COLOR_BayerRGGB2BGR_VNG = COLOR_BayerBG2BGR_VNG,
|
||||||
COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG,
|
COLOR_BayerGRBG2BGR_VNG = COLOR_BayerGB2BGR_VNG,
|
||||||
COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG,
|
COLOR_BayerBGGR2BGR_VNG = COLOR_BayerRG2BGR_VNG,
|
||||||
COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG,
|
COLOR_BayerGBRG2BGR_VNG = COLOR_BayerGR2BGR_VNG,
|
||||||
|
|
||||||
|
COLOR_BayerRGGB2RGB_VNG = COLOR_BayerBGGR2BGR_VNG,
|
||||||
|
COLOR_BayerGRBG2RGB_VNG = COLOR_BayerGBRG2BGR_VNG,
|
||||||
|
COLOR_BayerBGGR2RGB_VNG = COLOR_BayerRGGB2BGR_VNG,
|
||||||
|
COLOR_BayerGBRG2RGB_VNG = COLOR_BayerGRBG2BGR_VNG,
|
||||||
|
|
||||||
|
COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG, //!< equivalent to RGGB Bayer pattern
|
||||||
|
COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG, //!< equivalent to GRBG Bayer pattern
|
||||||
|
COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG, //!< equivalent to BGGR Bayer pattern
|
||||||
|
COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
//! Edge-Aware Demosaicing
|
//! Edge-Aware Demosaicing
|
||||||
COLOR_BayerBG2BGR_EA = 135,
|
COLOR_BayerBG2BGR_EA = 135, //!< equivalent to RGGB Bayer pattern
|
||||||
COLOR_BayerGB2BGR_EA = 136,
|
COLOR_BayerGB2BGR_EA = 136, //!< equivalent to GRBG Bayer pattern
|
||||||
COLOR_BayerRG2BGR_EA = 137,
|
COLOR_BayerRG2BGR_EA = 137, //!< equivalent to BGGR Bayer pattern
|
||||||
COLOR_BayerGR2BGR_EA = 138,
|
COLOR_BayerGR2BGR_EA = 138, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA,
|
COLOR_BayerRGGB2BGR_EA = COLOR_BayerBG2BGR_EA,
|
||||||
COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA,
|
COLOR_BayerGRBG2BGR_EA = COLOR_BayerGB2BGR_EA,
|
||||||
COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA,
|
COLOR_BayerBGGR2BGR_EA = COLOR_BayerRG2BGR_EA,
|
||||||
COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA,
|
COLOR_BayerGBRG2BGR_EA = COLOR_BayerGR2BGR_EA,
|
||||||
|
|
||||||
|
COLOR_BayerRGGB2RGB_EA = COLOR_BayerBGGR2BGR_EA,
|
||||||
|
COLOR_BayerGRBG2RGB_EA = COLOR_BayerGBRG2BGR_EA,
|
||||||
|
COLOR_BayerBGGR2RGB_EA = COLOR_BayerRGGB2BGR_EA,
|
||||||
|
COLOR_BayerGBRG2RGB_EA = COLOR_BayerGRBG2BGR_EA,
|
||||||
|
|
||||||
|
COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA, //!< equivalent to RGGB Bayer pattern
|
||||||
|
COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA, //!< equivalent to GRBG Bayer pattern
|
||||||
|
COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA, //!< equivalent to BGGR Bayer pattern
|
||||||
|
COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
//! Demosaicing with alpha channel
|
//! Demosaicing with alpha channel
|
||||||
COLOR_BayerBG2BGRA = 139,
|
COLOR_BayerBG2BGRA = 139, //!< equivalent to RGGB Bayer pattern
|
||||||
COLOR_BayerGB2BGRA = 140,
|
COLOR_BayerGB2BGRA = 140, //!< equivalent to GRBG Bayer pattern
|
||||||
COLOR_BayerRG2BGRA = 141,
|
COLOR_BayerRG2BGRA = 141, //!< equivalent to BGGR Bayer pattern
|
||||||
COLOR_BayerGR2BGRA = 142,
|
COLOR_BayerGR2BGRA = 142, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA,
|
COLOR_BayerRGGB2BGRA = COLOR_BayerBG2BGRA,
|
||||||
COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA,
|
COLOR_BayerGRBG2BGRA = COLOR_BayerGB2BGRA,
|
||||||
COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA,
|
COLOR_BayerBGGR2BGRA = COLOR_BayerRG2BGRA,
|
||||||
COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA,
|
COLOR_BayerGBRG2BGRA = COLOR_BayerGR2BGRA,
|
||||||
|
|
||||||
|
COLOR_BayerRGGB2RGBA = COLOR_BayerBGGR2BGRA,
|
||||||
|
COLOR_BayerGRBG2RGBA = COLOR_BayerGBRG2BGRA,
|
||||||
|
COLOR_BayerBGGR2RGBA = COLOR_BayerRGGB2BGRA,
|
||||||
|
COLOR_BayerGBRG2RGBA = COLOR_BayerGRBG2BGRA,
|
||||||
|
|
||||||
|
COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA, //!< equivalent to RGGB Bayer pattern
|
||||||
|
COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA, //!< equivalent to GRBG Bayer pattern
|
||||||
|
COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA, //!< equivalent to BGGR Bayer pattern
|
||||||
|
COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA, //!< equivalent to GBRG Bayer pattern
|
||||||
|
|
||||||
COLOR_COLORCVT_MAX = 143
|
COLOR_COLORCVT_MAX = 143
|
||||||
};
|
};
|
||||||
|
@ -200,7 +200,7 @@ vector<Vec3d> QRDetect::searchHorizontalLines()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pixels_position.push_back(width_bin_barcode - 1);
|
pixels_position.push_back(width_bin_barcode - 1);
|
||||||
for (size_t i = 2; i < pixels_position.size() - 4; i+=2)
|
for (size_t i = 2; i < pixels_position.size() - 3; i+=2)
|
||||||
{
|
{
|
||||||
test_lines[0] = static_cast<double>(pixels_position[i - 1] - pixels_position[i - 2]);
|
test_lines[0] = static_cast<double>(pixels_position[i - 1] - pixels_position[i - 2]);
|
||||||
test_lines[1] = static_cast<double>(pixels_position[i ] - pixels_position[i - 1]);
|
test_lines[1] = static_cast<double>(pixels_position[i ] - pixels_position[i - 1]);
|
||||||
|
@ -649,6 +649,26 @@ TEST(Objdetect_QRCode_decodeMulti, check_output_parameters_type_19363)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Objdetect_QRCode_detect, detect_regression_20882)
|
||||||
|
{
|
||||||
|
const std::string name_current_image = "qrcode_near_the_end.jpg";
|
||||||
|
const std::string root = "qrcode/";
|
||||||
|
|
||||||
|
std::string image_path = findDataFile(root + name_current_image);
|
||||||
|
Mat src = imread(image_path);
|
||||||
|
ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path;
|
||||||
|
|
||||||
|
QRCodeDetector qrcode;
|
||||||
|
std::vector<Point> corners;
|
||||||
|
Mat straight_barcode;
|
||||||
|
cv::String decoded_info;
|
||||||
|
EXPECT_TRUE(qrcode.detect(src, corners));
|
||||||
|
EXPECT_TRUE(!corners.empty());
|
||||||
|
#ifdef HAVE_QUIRC
|
||||||
|
EXPECT_NO_THROW(qrcode.decode(src, corners, straight_barcode));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Objdetect_QRCode_basic, not_found_qrcode)
|
TEST(Objdetect_QRCode_basic, not_found_qrcode)
|
||||||
{
|
{
|
||||||
std::vector<Point> corners;
|
std::vector<Point> corners;
|
||||||
|
@ -93,8 +93,9 @@ Thanks to:
|
|||||||
#pragma warning(disable: 4995)
|
#pragma warning(disable: 4995)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#if defined(__clang__) // clang or MSVC clang
|
||||||
// MinGW does not understand COM interfaces
|
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
|
#elif defined(__GNUC__) // MinGW
|
||||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
#define STRSAFE_NO_DEPRECATE
|
#define STRSAFE_NO_DEPRECATE
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user