mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
added some pics, used by python tests, to samples/cpp. fixed python tests. fixed overflow on Core_Mul test
This commit is contained in:
@@ -988,9 +988,14 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
c = src1.channels();
|
||||
}
|
||||
|
||||
Size sz = getContinuousSize(src1, src2, dst, c);
|
||||
func(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, 0);
|
||||
return;
|
||||
Size sz = getContinuousSize(src1, src2, dst);
|
||||
size_t len = sz.width*(size_t)c;
|
||||
if( len == (size_t)(int)len )
|
||||
{
|
||||
sz.width = (int)len;
|
||||
func(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( (kind1 == _InputArray::MATX) + (kind2 == _InputArray::MATX) == 1 ||
|
||||
@@ -1045,6 +1050,9 @@ void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
NAryMatIterator it(arrays, ptrs);
|
||||
size_t total = it.size, blocksize = total;
|
||||
|
||||
if( blocksize*c > INT_MAX )
|
||||
blocksize = INT_MAX/c;
|
||||
|
||||
if( haveMask )
|
||||
{
|
||||
blocksize = std::min(blocksize, blocksize0);
|
||||
|
||||
@@ -195,6 +195,13 @@ struct AddWeightedOp : public BaseAddOp
|
||||
struct MulOp : public BaseElemWiseOp
|
||||
{
|
||||
MulOp() : BaseElemWiseOp(2, FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {};
|
||||
void getValueRange(int depth, double& minval, double& maxval)
|
||||
{
|
||||
minval = depth < CV_32S ? cvtest::getMinVal(depth) : depth == CV_32S ? -1000000 : -1000.;
|
||||
maxval = depth < CV_32S ? cvtest::getMaxVal(depth) : depth == CV_32S ? 1000000 : 1000.;
|
||||
minval = std::max(minval, -30000.);
|
||||
maxval = std::min(maxval, 30000.);
|
||||
}
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat&)
|
||||
{
|
||||
cv::multiply(src[0], src[1], dst, alpha);
|
||||
|
||||
@@ -659,7 +659,7 @@ class FunctionTests(OpenCVTests):
|
||||
self.assert_(li[0] != None)
|
||||
|
||||
def test_InPaint(self):
|
||||
src = self.get_sample("doc/pics/building.jpg")
|
||||
src = self.get_sample("samples/cpp/building.jpg")
|
||||
msk = cv.CreateImage(cv.GetSize(src), cv.IPL_DEPTH_8U, 1)
|
||||
damaged = cv.CloneMat(src)
|
||||
repaired = cv.CreateImage(cv.GetSize(src), cv.IPL_DEPTH_8U, 3)
|
||||
@@ -866,7 +866,7 @@ class FunctionTests(OpenCVTests):
|
||||
|
||||
def yield_line_image(self):
|
||||
""" Needed by HoughLines tests """
|
||||
src = self.get_sample("doc/pics/building.jpg", 0)
|
||||
src = self.get_sample("samples/cpp/building.jpg", 0)
|
||||
dst = cv.CreateImage(cv.GetSize(src), 8, 1)
|
||||
cv.Canny(src, dst, 50, 200, 3)
|
||||
return dst
|
||||
@@ -2104,7 +2104,7 @@ class DocumentFragmentTests(OpenCVTests):
|
||||
""" Test the fragments of code that are included in the documentation """
|
||||
def setUp(self):
|
||||
OpenCVTests.setUp(self)
|
||||
sys.path.append("../doc/python_fragments")
|
||||
sys.path.append(".")
|
||||
|
||||
def test_precornerdetect(self):
|
||||
from precornerdetect import precornerdetect
|
||||
@@ -2118,7 +2118,7 @@ class DocumentFragmentTests(OpenCVTests):
|
||||
|
||||
def test_findstereocorrespondence(self):
|
||||
from findstereocorrespondence import findstereocorrespondence
|
||||
(l,r) = [self.get_sample("doc/pics/tsukuba_%s.png" % c, cv.CV_LOAD_IMAGE_GRAYSCALE) for c in "lr"]
|
||||
(l,r) = [self.get_sample("samples/cpp/tsukuba_%s.png" % c, cv.CV_LOAD_IMAGE_GRAYSCALE) for c in "lr"]
|
||||
|
||||
(disparity_left, disparity_right) = findstereocorrespondence(l, r)
|
||||
|
||||
@@ -2129,7 +2129,7 @@ class DocumentFragmentTests(OpenCVTests):
|
||||
def test_calchist(self):
|
||||
from calchist import hs_histogram
|
||||
i1 = self.get_sample("samples/c/lena.jpg")
|
||||
i2 = self.get_sample("doc/pics/building.jpg")
|
||||
i2 = self.get_sample("samples/cpp/building.jpg")
|
||||
i3 = cv.CloneMat(i1)
|
||||
cv.Flip(i3, i3, 1)
|
||||
h1 = hs_histogram(i1)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Reference in New Issue
Block a user