mirror of
https://github.com/opencv/opencv.git
synced 2025-06-10 02:53:07 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
39d5e14c1f
@ -2607,7 +2607,7 @@ final fundamental matrix. It can be set to something like 1-3, depending on the
|
|||||||
point localization, image resolution, and the image noise.
|
point localization, image resolution, and the image noise.
|
||||||
@param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level
|
@param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level
|
||||||
of confidence (probability) that the estimated matrix is correct.
|
of confidence (probability) that the estimated matrix is correct.
|
||||||
@param mask
|
@param[out] mask optional output mask
|
||||||
@param maxIters The maximum number of robust method iterations.
|
@param maxIters The maximum number of robust method iterations.
|
||||||
|
|
||||||
The epipolar geometry is described by the following equation:
|
The epipolar geometry is described by the following equation:
|
||||||
|
@ -58,11 +58,13 @@
|
|||||||
#pragma warning( disable: 4244 ) //conversion from '__int64' to 'int', possible loss of data
|
#pragma warning( disable: 4244 ) //conversion from '__int64' to 'int', possible loss of data
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OPENCV_DISABLE_EIGEN_TENSOR_SUPPORT)
|
||||||
#if EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3 \
|
#if EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3 \
|
||||||
&& defined(CV_CXX11) && defined(CV_CXX_STD_ARRAY)
|
&& defined(CV_CXX11) && defined(CV_CXX_STD_ARRAY)
|
||||||
#include <unsupported/Eigen/CXX11/Tensor>
|
#include <unsupported/Eigen/CXX11/Tensor>
|
||||||
#define OPENCV_EIGEN_TENSOR_SUPPORT
|
#define OPENCV_EIGEN_TENSOR_SUPPORT 1
|
||||||
#endif // EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3
|
#endif // EIGEN_WORLD_VERSION == 3 && EIGEN_MAJOR_VERSION >= 3
|
||||||
|
#endif // !defined(OPENCV_DISABLE_EIGEN_TENSOR_SUPPORT)
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
@ -236,13 +236,20 @@ void setSize( Mat& m, int _dims, const int* _sz, const size_t* _steps, bool auto
|
|||||||
m.size.p[i] = s;
|
m.size.p[i] = s;
|
||||||
|
|
||||||
if( _steps )
|
if( _steps )
|
||||||
|
{
|
||||||
|
if (i < _dims-1)
|
||||||
{
|
{
|
||||||
if (_steps[i] % esz1 != 0)
|
if (_steps[i] % esz1 != 0)
|
||||||
{
|
{
|
||||||
CV_Error(Error::BadStep, "Step must be a multiple of esz1");
|
CV_Error_(Error::BadStep, ("Step %zu for dimension %d must be a multiple of esz1 %zu", _steps[i], i, esz1));
|
||||||
}
|
}
|
||||||
|
|
||||||
m.step.p[i] = i < _dims-1 ? _steps[i] : esz;
|
m.step.p[i] = _steps[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m.step.p[i] = esz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( autoSteps )
|
else if( autoSteps )
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __linux__ || defined __APPLE__ || defined __GLIBC__ \
|
#if defined __linux__ || defined __APPLE__ || defined __GLIBC__ \
|
||||||
|| defined __HAIKU__ || defined __EMSCRIPTEN__ || defined __FreeBSD__
|
|| defined __HAIKU__ || defined __EMSCRIPTEN__ || defined __FreeBSD__ \
|
||||||
|
|| defined __OpenBSD__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -2175,4 +2175,32 @@ TEST(Mat, empty_iterator_16855)
|
|||||||
EXPECT_TRUE(m.begin<uchar>() == m.end<uchar>());
|
EXPECT_TRUE(m.begin<uchar>() == m.end<uchar>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(Mat, regression_18473)
|
||||||
|
{
|
||||||
|
std::vector<int> sizes(3);
|
||||||
|
sizes[0] = 20;
|
||||||
|
sizes[1] = 50;
|
||||||
|
sizes[2] = 100;
|
||||||
|
#if 1 // with the fix
|
||||||
|
std::vector<size_t> steps(2);
|
||||||
|
steps[0] = 50*100*2;
|
||||||
|
steps[1] = 100*2;
|
||||||
|
#else // without the fix
|
||||||
|
std::vector<size_t> steps(3);
|
||||||
|
steps[0] = 50*100*2;
|
||||||
|
steps[1] = 100*2;
|
||||||
|
steps[2] = 2;
|
||||||
|
#endif
|
||||||
|
std::vector<short> data(20*50*100, 0); // 1Mb
|
||||||
|
data[data.size() - 1] = 5;
|
||||||
|
|
||||||
|
// param steps Array of ndims-1 steps
|
||||||
|
Mat m(sizes, CV_16SC1, (void*)data.data(), (const size_t*)steps.data());
|
||||||
|
|
||||||
|
ASSERT_FALSE(m.empty());
|
||||||
|
EXPECT_EQ((int)5, (int)m.at<short>(19, 49, 99));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
@ -3934,11 +3934,16 @@ void Net::connect(String _outPin, String _inPin)
|
|||||||
Mat Net::forward(const String& outputName)
|
Mat Net::forward(const String& outputName)
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
|
CV_Assert(!empty());
|
||||||
|
|
||||||
String layerName = outputName;
|
String layerName = outputName;
|
||||||
|
|
||||||
if (layerName.empty())
|
if (layerName.empty())
|
||||||
layerName = getLayerNames().back();
|
{
|
||||||
|
std::vector<String> layerNames = getLayerNames();
|
||||||
|
CV_Assert(!layerNames.empty());
|
||||||
|
layerName = layerNames.back();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<LayerPin> pins(1, impl->getPinByAlias(layerName));
|
std::vector<LayerPin> pins(1, impl->getPinByAlias(layerName));
|
||||||
impl->setUpNet(pins);
|
impl->setUpNet(pins);
|
||||||
@ -3950,11 +3955,17 @@ Mat Net::forward(const String& outputName)
|
|||||||
AsyncArray Net::forwardAsync(const String& outputName)
|
AsyncArray Net::forwardAsync(const String& outputName)
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
|
CV_Assert(!empty());
|
||||||
|
|
||||||
#ifdef CV_CXX11
|
#ifdef CV_CXX11
|
||||||
String layerName = outputName;
|
String layerName = outputName;
|
||||||
|
|
||||||
if (layerName.empty())
|
if (layerName.empty())
|
||||||
layerName = getLayerNames().back();
|
{
|
||||||
|
std::vector<String> layerNames = getLayerNames();
|
||||||
|
CV_Assert(!layerNames.empty());
|
||||||
|
layerName = layerNames.back();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<LayerPin> pins(1, impl->getPinByAlias(layerName));
|
std::vector<LayerPin> pins(1, impl->getPinByAlias(layerName));
|
||||||
impl->setUpNet(pins);
|
impl->setUpNet(pins);
|
||||||
@ -3975,11 +3986,16 @@ AsyncArray Net::forwardAsync(const String& outputName)
|
|||||||
void Net::forward(OutputArrayOfArrays outputBlobs, const String& outputName)
|
void Net::forward(OutputArrayOfArrays outputBlobs, const String& outputName)
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
|
CV_Assert(!empty());
|
||||||
|
|
||||||
String layerName = outputName;
|
String layerName = outputName;
|
||||||
|
|
||||||
if (layerName.empty())
|
if (layerName.empty())
|
||||||
layerName = getLayerNames().back();
|
{
|
||||||
|
std::vector<String> layerNames = getLayerNames();
|
||||||
|
CV_Assert(!layerNames.empty());
|
||||||
|
layerName = layerNames.back();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<LayerPin> pins(1, impl->getPinByAlias(layerName));
|
std::vector<LayerPin> pins(1, impl->getPinByAlias(layerName));
|
||||||
impl->setUpNet(pins);
|
impl->setUpNet(pins);
|
||||||
@ -4571,6 +4587,8 @@ std::vector<Ptr<Layer> > Net::getLayerInputs(LayerId layerId)
|
|||||||
|
|
||||||
std::vector<String> Net::getLayerNames() const
|
std::vector<String> Net::getLayerNames() const
|
||||||
{
|
{
|
||||||
|
CV_TRACE_FUNCTION();
|
||||||
|
|
||||||
std::vector<String> res;
|
std::vector<String> res;
|
||||||
res.reserve(impl->layers.size());
|
res.reserve(impl->layers.size());
|
||||||
|
|
||||||
|
@ -99,6 +99,15 @@ TEST(readNet, do_not_call_setInput) // https://github.com/opencv/opencv/issues/
|
|||||||
EXPECT_TRUE(res.empty()) << res.size;
|
EXPECT_TRUE(res.empty()) << res.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Net, empty_forward_18392)
|
||||||
|
{
|
||||||
|
cv::dnn::Net net;
|
||||||
|
Mat image(Size(512, 512), CV_8UC3, Scalar::all(0));
|
||||||
|
Mat inputBlob = cv::dnn::blobFromImage(image, 1.0, Size(512, 512), Scalar(0,0,0), true, false);
|
||||||
|
net.setInput(inputBlob);
|
||||||
|
EXPECT_ANY_THROW(Mat output = net.forward());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_INF_ENGINE
|
#ifdef HAVE_INF_ENGINE
|
||||||
static
|
static
|
||||||
void test_readNet_IE_do_not_call_setInput(Backend backendId)
|
void test_readNet_IE_do_not_call_setInput(Backend backendId)
|
||||||
|
@ -787,6 +787,7 @@ class JavaWrapperGenerator(object):
|
|||||||
inCode = True
|
inCode = True
|
||||||
if "</code>" in line:
|
if "</code>" in line:
|
||||||
inCode = False
|
inCode = False
|
||||||
|
line = line.replace('@result ', '@return ') # @result is valid in Doxygen, but invalid in Javadoc
|
||||||
if "@return " in line:
|
if "@return " in line:
|
||||||
returnTag = True
|
returnTag = True
|
||||||
|
|
||||||
|
@ -207,60 +207,57 @@ bool CvCaptureCAM_DC1394_v2_CPP::startCapture()
|
|||||||
DC1394_ISO_SPEED_3200);
|
DC1394_ISO_SPEED_3200);
|
||||||
}
|
}
|
||||||
|
|
||||||
// should a specific mode be used
|
|
||||||
if (userMode >= 0)
|
|
||||||
|
|
||||||
{
|
|
||||||
dc1394video_mode_t wantedMode;
|
|
||||||
dc1394video_modes_t videoModes;
|
dc1394video_modes_t videoModes;
|
||||||
dc1394_video_get_supported_modes(dcCam, &videoModes);
|
dc1394_video_get_supported_modes(dcCam, &videoModes);
|
||||||
|
|
||||||
//set mode from number, for example the second supported mode, i.e userMode = 1
|
// should a specific mode be used
|
||||||
|
while (userMode >= 0) // 'if' semantic, no real loop here
|
||||||
|
{
|
||||||
|
dc1394video_mode_t wantedMode;
|
||||||
|
|
||||||
if (userMode < (int)videoModes.num)
|
if (userMode < (int)videoModes.num)
|
||||||
{
|
{
|
||||||
|
// set mode from number, for example the second supported mode, i.e userMode = 1
|
||||||
wantedMode = videoModes.modes[userMode];
|
wantedMode = videoModes.modes[userMode];
|
||||||
}
|
}
|
||||||
|
|
||||||
//set modes directly from DC134 constants (from dc1394video_mode_t)
|
|
||||||
else if ((userMode >= DC1394_VIDEO_MODE_MIN) && (userMode <= DC1394_VIDEO_MODE_MAX))
|
else if ((userMode >= DC1394_VIDEO_MODE_MIN) && (userMode <= DC1394_VIDEO_MODE_MAX))
|
||||||
{
|
{
|
||||||
|
// set modes directly from DC134 constants (from dc1394video_mode_t)
|
||||||
|
|
||||||
//search for wanted mode, to check if camera supports it
|
//search for wanted mode, to check if camera supports it
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while ((j < (int)videoModes.num) && videoModes.modes[j] != userMode)
|
while ((j < (int)videoModes.num) && videoModes.modes[j] != userMode)
|
||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
if (!(j < (int)videoModes.num))
|
||||||
if ((int)videoModes.modes[j]==userMode)
|
|
||||||
{
|
{
|
||||||
|
userMode = -1; // wanted mode not supported, search for best mode
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
wantedMode = videoModes.modes[j];
|
wantedMode = videoModes.modes[j];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
userMode = -1; // wanted mode not supported, search for best mode
|
userMode = -1; // wanted mode not supported, search for best mode
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
userMode = -1; // wanted mode not supported, search for best mode
|
|
||||||
}
|
|
||||||
//if userMode is available: set it and update size
|
//if userMode is available: set it and update size
|
||||||
if (userMode != -1)
|
|
||||||
{
|
{
|
||||||
code = dc1394_video_set_mode(dcCam, wantedMode);
|
code = dc1394_video_set_mode(dcCam, wantedMode);
|
||||||
uint32_t width, height;
|
uint32_t width = 0, height = 0;
|
||||||
dc1394_get_image_size_from_video_mode(dcCam, wantedMode, &width, &height);
|
dc1394_get_image_size_from_video_mode(dcCam, wantedMode, &width, &height);
|
||||||
frameWidth = (int)width;
|
frameWidth = (int)width;
|
||||||
frameHeight = (int)height;
|
frameHeight = (int)height;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userMode == -1 && (frameWidth > 0 || frameHeight > 0))
|
if (userMode == -1 && (frameWidth > 0 || frameHeight > 0))
|
||||||
{
|
{
|
||||||
dc1394video_mode_t bestMode = (dc1394video_mode_t) - 1;
|
dc1394video_mode_t bestMode = (dc1394video_mode_t)(-1);
|
||||||
dc1394video_modes_t videoModes;
|
|
||||||
dc1394_video_get_supported_modes(dcCam, &videoModes);
|
|
||||||
for (i = 0; i < (int)videoModes.num; i++)
|
for (i = 0; i < (int)videoModes.num; i++)
|
||||||
{
|
{
|
||||||
dc1394video_mode_t mode = videoModes.modes[i];
|
dc1394video_mode_t mode = videoModes.modes[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user