dnn: handle 4-channel images in blobFromImage (#9944)
parent
e5766513a4
commit
5bf39ceb5d
3 changed files with 34 additions and 4 deletions
@ -0,0 +1,30 @@ |
|||||||
|
// This file is part of OpenCV project.
|
||||||
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||||
|
// of this distribution and at http://opencv.org/license.html.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017, Intel Corporation, all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
|
||||||
|
#include "test_precomp.hpp" |
||||||
|
|
||||||
|
namespace cvtest |
||||||
|
{ |
||||||
|
|
||||||
|
TEST(blobFromImage_4ch, Regression) |
||||||
|
{ |
||||||
|
Mat ch[4]; |
||||||
|
for(int i = 0; i < 4; i++) |
||||||
|
ch[i] = Mat::ones(10, 10, CV_8U)*i; |
||||||
|
|
||||||
|
Mat img; |
||||||
|
merge(ch, 4, img); |
||||||
|
Mat blob = dnn::blobFromImage(img, 1., Size(), Scalar(), false, false); |
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++) |
||||||
|
{ |
||||||
|
ch[i] = Mat(img.rows, img.cols, CV_32F, blob.ptr(0, i)); |
||||||
|
ASSERT_DOUBLE_EQ(cvtest::norm(ch[i], cv::NORM_INF), i); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue