mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
dnn : Added an imagesFromBlob method to the dnn module (#10607)
* Added the imagesFromBlob method to the dnn module. * Rewritten imagesFromBlob based on first dkurt comments * Updated code with getPlane() * Modify comment of imagesFromBlob() in dnn module * modified comments, removed useless assertions & added OutputArrayOfArray * replaced tabs with whitespaces & put vectorOfChannels instantiation outside the loop * Changed pre-commit.sample to pre-commit in .git/hooks/ * Added a test for imagesFromBlob in test_misc.cpp (dnn) * Changed nbOfImages, robustified test with cv::randu, modified assertion
This commit is contained in:
committed by
Vadim Pisarevsky
parent
5a791e6e06
commit
b67523550f
@@ -36,4 +36,25 @@ TEST(blobFromImage, allocated)
|
||||
ASSERT_EQ(blobData, blob.data);
|
||||
}
|
||||
|
||||
TEST(imagesFromBlob, Regression)
|
||||
{
|
||||
int nbOfImages = 8;
|
||||
|
||||
std::vector<cv::Mat> inputImgs(nbOfImages);
|
||||
for (int i = 0; i < nbOfImages; i++)
|
||||
{
|
||||
inputImgs[i] = cv::Mat::ones(100, 100, CV_32FC3);
|
||||
cv::randu(inputImgs[i], cv::Scalar::all(0), cv::Scalar::all(1));
|
||||
}
|
||||
|
||||
cv::Mat blob = cv::dnn::blobFromImages(inputImgs, 1., cv::Size(), cv::Scalar(), false, false);
|
||||
std::vector<cv::Mat> outputImgs;
|
||||
cv::dnn::imagesFromBlob(blob, outputImgs);
|
||||
|
||||
for (int i = 0; i < nbOfImages; i++)
|
||||
{
|
||||
ASSERT_EQ(cv::countNonZero(inputImgs[i] != outputImgs[i]), 0);
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user