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

Add helper function to centralize usage of OpenCV findContours #939

Merged
merged 24 commits into from
Sep 6, 2022

Conversation

nfahlgren
Copy link
Member

@nfahlgren nfahlgren commented Sep 2, 2022

Describe your changes
We utilize cv2.findContours throughout PlantCV and use a mixture of directly using the OpenCV function or use the PlantCV wrapper find_objects. In most cases it's simpler to use the OpenCV function rather than using the PlantCV wrapper within the code. Additionally, if OpenCV ever changes the function signature then PlantCV has to be changed in many places. This PR adds a helper function that calls cv2.findContours and replaces direct usage throughout PlantCV to use the helper function.

Type of update
Is this a: Code refactoring

For the reviewer
See this page for instructions on how to review the pull request.

  • PR functionality reviewed in a Jupyter Notebook
  • All tests pass
  • Test coverage remains 100%
  • Documentation tested
  • New documentation pages added to plantcv/mkdocs.yml
  • Changes to function input/output signatures added to updating.md
  • Code reviewed
  • PR approved

@nfahlgren nfahlgren added the update Updates an existing feature/method label Sep 2, 2022
@nfahlgren nfahlgren added this to the PlantCV v4.x milestone Sep 2, 2022
@nfahlgren nfahlgren added this to Pull Requests in PlantCV4 via automation Sep 2, 2022
@codecov
Copy link

codecov bot commented Sep 2, 2022

Codecov Report

Merging #939 (92f29cb) into 4.x (e836702) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 92f29cb differs from pull request most recent head 50e22f0. Consider uploading reports for the commit 50e22f0 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##               4.x      #939   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          160       161    +1     
  Lines         6827      6840   +13     
=========================================
+ Hits          6827      6840   +13     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
plantcv/plantcv/_helpers.py 100.00% <100.00%> (ø)
plantcv/plantcv/analyze_bound_horizontal.py 100.00% <100.00%> (ø)
plantcv/plantcv/analyze_bound_vertical.py 100.00% <100.00%> (ø)
plantcv/plantcv/analyze_object.py 100.00% <100.00%> (ø)
plantcv/plantcv/crop_position_mask.py 100.00% <100.00%> (ø)
plantcv/plantcv/find_objects.py 100.00% <100.00%> (ø)
plantcv/plantcv/morphology/_iterative_prune.py 100.00% <100.00%> (ø)
plantcv/plantcv/morphology/check_cycles.py 100.00% <100.00%> (ø)
plantcv/plantcv/morphology/find_branch_pts.py 100.00% <100.00%> (ø)
plantcv/plantcv/morphology/find_tips.py 100.00% <100.00%> (ø)
... and 11 more

@nfahlgren nfahlgren merged commit 4390066 into 4.x Sep 6, 2022
PlantCV4 automation moved this from Pull Requests to Done Sep 6, 2022
@nfahlgren nfahlgren deleted the encapsulate-findcontours branch September 6, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to review update Updates an existing feature/method
Projects
PlantCV4
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants