Skip to content

[ximgproc::rl::createRLEImage] make 'runs' parameter as const #2920

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 1 commit into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CV_EXPORTS bool isRLMorphologyPossible(InputArray rlStructuringElement);
* @param size image size (to be used if an "on" boundary should be used in erosion, using the default
* means that the size is computed from the extension of the input)
*/
CV_EXPORTS void createRLEImage(std::vector<cv::Point3i>& runs, OutputArray res, Size size = Size(0, 0));
CV_EXPORTS void createRLEImage(const std::vector<cv::Point3i>& runs, OutputArray res, Size size = Size(0, 0));

/**
* @brief Applies a morphological operation to a run-length encoded binary image.
Expand Down
4 changes: 2 additions & 2 deletions modules/ximgproc/src/run_length_morphology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,13 @@ CV_EXPORTS bool isRLMorphologyPossible(InputArray rlStructuringElement)
return true;
}

CV_EXPORTS void createRLEImage(std::vector<cv::Point3i>& runs, OutputArray res, Size size)
CV_EXPORTS void createRLEImage(const std::vector<cv::Point3i>& runs, OutputArray res, Size size)
{
size_t nRuns = runs.size();
rlVec runsConverted(nRuns);
for (size_t i = 0u; i < nRuns; ++i)
{
Point3i &curIn = runs[i];
const Point3i &curIn = runs[i];
runsConverted[i] = rlType(curIn.x, curIn.y, curIn.z);
}
sortChords(runsConverted);
Expand Down