-
Notifications
You must be signed in to change notification settings - Fork 5.9k
barcode perf tests #3482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
barcode perf tests #3482
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a568233
add barcode perf tests
be3c980
fixup! add barcode perf tests
mshabunin 930f894
Merge branch '4.x' into pr3482
mshabunin 018f019
fixup! add barcode perf tests
mshabunin 9bb9e19
fixup! add barcode perf tests
mshabunin 7cf3d10
fixup! add barcode perf tests
mshabunin 7202193
fixup! add barcode perf tests
mshabunin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| // 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. | ||
|
|
||
| #include "perf_precomp.hpp" | ||
|
|
||
| namespace opencv_test{namespace{ | ||
|
|
||
| typedef ::perf::TestBaseWithParam< tuple<string, cv::Size> > Perf_Barcode_multi; | ||
| typedef ::perf::TestBaseWithParam< tuple<string, cv::Size> > Perf_Barcode_single; | ||
|
|
||
| PERF_TEST_P_(Perf_Barcode_multi, detect) | ||
| { | ||
| const string root = "cv/barcode/multiple/"; | ||
| const string name_current_image = get<0>(GetParam()); | ||
| const cv::Size sz = get<1>(GetParam()); | ||
| const string image_path = findDataFile(root + name_current_image); | ||
|
|
||
| Mat src = imread(image_path); | ||
| ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path; | ||
| cv::resize(src, src, sz); | ||
|
|
||
| vector< Point > corners; | ||
| auto bardet = barcode::BarcodeDetector(); | ||
| bool res = false; | ||
| TEST_CYCLE() | ||
| { | ||
| res = bardet.detect(src, corners); | ||
| } | ||
| SANITY_CHECK_NOTHING(); | ||
| ASSERT_TRUE(res); | ||
| } | ||
|
|
||
| PERF_TEST_P_(Perf_Barcode_multi, detect_decode) | ||
| { | ||
| const string root = "cv/barcode/multiple/"; | ||
| const string name_current_image = get<0>(GetParam()); | ||
| const cv::Size sz = get<1>(GetParam()); | ||
| const string image_path = findDataFile(root + name_current_image); | ||
|
|
||
| Mat src = imread(image_path); | ||
| ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path; | ||
| cv::resize(src, src, sz); | ||
|
|
||
| vector<cv::String> decoded_info; | ||
| vector<barcode::BarcodeType> decoded_type; | ||
| vector< Point > corners; | ||
| auto bardet = barcode::BarcodeDetector(); | ||
| bool res = false; | ||
| TEST_CYCLE() | ||
| { | ||
| res = bardet.detectAndDecode(src, decoded_info, decoded_type, corners); | ||
| } | ||
| SANITY_CHECK_NOTHING(); | ||
| ASSERT_TRUE(res); | ||
| } | ||
|
|
||
| PERF_TEST_P_(Perf_Barcode_single, detect) | ||
| { | ||
| const string root = "cv/barcode/single/"; | ||
| const string name_current_image = get<0>(GetParam()); | ||
| const cv::Size sz = get<1>(GetParam()); | ||
| const string image_path = findDataFile(root + name_current_image); | ||
|
|
||
| Mat src = imread(image_path); | ||
| ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path; | ||
| cv::resize(src, src, sz); | ||
|
|
||
| vector< Point > corners; | ||
| auto bardet = barcode::BarcodeDetector(); | ||
| bool res = false; | ||
| TEST_CYCLE() | ||
| { | ||
| res = bardet.detect(src, corners); | ||
| } | ||
| SANITY_CHECK_NOTHING(); | ||
| ASSERT_TRUE(res); | ||
| } | ||
|
|
||
| PERF_TEST_P_(Perf_Barcode_single, detect_decode) | ||
| { | ||
| const string root = "cv/barcode/single/"; | ||
| const string name_current_image = get<0>(GetParam()); | ||
| const cv::Size sz = get<1>(GetParam()); | ||
| const string image_path = findDataFile(root + name_current_image); | ||
|
|
||
| Mat src = imread(image_path); | ||
| ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path; | ||
| cv::resize(src, src, sz); | ||
|
|
||
| vector<cv::String> decoded_info; | ||
| vector<barcode::BarcodeType> decoded_type; | ||
| vector< Point > corners; | ||
| auto bardet = barcode::BarcodeDetector(); | ||
| bool res = false; | ||
| TEST_CYCLE() | ||
| { | ||
| res = bardet.detectAndDecode(src, decoded_info, decoded_type, corners); | ||
| } | ||
| SANITY_CHECK_NOTHING(); | ||
| ASSERT_TRUE(res); | ||
| } | ||
|
|
||
| INSTANTIATE_TEST_CASE_P(/*nothing*/, Perf_Barcode_multi, | ||
| testing::Combine( | ||
| testing::Values("4_barcodes.jpg"), | ||
| testing::Values(cv::Size(2041, 2722), cv::Size(1361, 1815), cv::Size(680, 907)))); | ||
| INSTANTIATE_TEST_CASE_P(/*nothing*/, Perf_Barcode_single, | ||
| testing::Combine( | ||
| testing::Values("book.jpg", "bottle_1.jpg", "bottle_2.jpg"), | ||
| testing::Values(cv::Size(480, 360), cv::Size(640, 480), cv::Size(800, 600)))); | ||
|
|
||
| }} //namespace | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // 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. | ||
|
|
||
| #include "perf_precomp.hpp" | ||
|
|
||
| using namespace perf; | ||
|
|
||
| CV_PERF_TEST_MAIN(barcode) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // 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. | ||
|
|
||
| #ifndef __OPENCV_PERF_PRECOMP_HPP__ | ||
| #define __OPENCV_PERF_PRECOMP_HPP__ | ||
mshabunin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #include "opencv2/ts.hpp" | ||
| #include "opencv2/barcode.hpp" | ||
|
|
||
| #endif | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.