-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
run length morphology #1672
run length morphology #1672
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// | ||
// | ||
// License Agreement | ||
// For Open Source Computer Vision Library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenCV samples should not have license header.
* | ||
* License Agreement | ||
* For Open Source Computer Vision Library | ||
* (3 - clause BSD License) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use short 3-line OpenCV license header (similar to perf_run_length_morphology.cpp file):
// 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_RUN_LENGTH_MORPHOLOGY_HPP__ | ||
#define __OPENCV_RUN_LENGTH_MORPHOLOGY_HPP__ | ||
#ifdef __cplusplus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove #ifdef __cplusplus
- it is not necessary.
|
||
typedef tuple<int, Size, int> RLParams; | ||
|
||
typedef TestBaseWithParam<RLParams> RLMorphologyPerfTest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, indentation in namespaces are not required.
PERF_TEST_P(RLMorphologyPerfTest, perf, Combine(Values(1,7, 21), Values(sz720p, sz2160p), | ||
Values(MORPH_ERODE, MORPH_DILATE, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT,MORPH_TOPHAT, MORPH_BLACKHAT))) | ||
{ | ||
RNG rng(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rng
is not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contribution!
This pullrequest changes
The pull request adds support for binary morphology on run-length encoded images. Run-length encoding is a well known data structure for fast binary image operations. A more recent reference is "Binary Morphology and Related Operations on Run-Length Representations." (Breuel, 2008).
The patch adds functions which operate similar to the morphology operations in imgproc. Conversion to binary run-length encoded images can be done by a thresholding operation.
With the supplied example application speedups of over 10x in comparison to the implementation in imgproc were measured on a Intel i7-5820 system with Nvidia Geforce 970 graphics card. The measurements were taken with circular structuring elements of large size (e.g. 70). On the other hand imgproc routines are often a lot faster with smaller structuring elements than the supplied functions. Running times also depend on the image content.
The code was developed from scratch (some years ago). A short introduction of the functionality can be found in the doxygen documentation in ximgproc/include/opencv2/ximgproc.hpp.