Skip to content
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

Merged
merged 4 commits into from
Jul 6, 2018
Merged

run length morphology #1672

merged 4 commits into from
Jul 6, 2018

Conversation

dbuesching
Copy link
Contributor

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.

Copy link
Member

@alalek alalek left a 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
Copy link
Member

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)
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rng is not used

Copy link
Member

@alalek alalek left a 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!

@alalek alalek merged commit 0f5d6ae into opencv:master Jul 6, 2018
@dbuesching dbuesching deleted the rl_morphology branch July 9, 2018 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants