Skip to content

Conversation

HaleySchuhl
Copy link
Contributor

@HaleySchuhl HaleySchuhl commented Jul 15, 2025

Describe your changes
Add optional kwargs to allow users to modify the solidity and aspect_ratio filters, implemented in pcv.transform.detect_color_card and within pcv.transform.auto_correct_color, which keeps the detected edges that are square-like. Loosening this parameters from their previously hard-coded defaults might help with color card detection in cases where the image is skewed.

Also, adds verbose debug images of detected edges in the case where detection fails to find a color card under default settings. This aims to help debug the keyword argument settings.

Type of update
Is this a:

  • feature enhancement

Associated issues

Additional context

  • helpful for 'nano' and other color cards that are macbeth (4x6 array of color chips) but the color card chips are more rectangular than perfectly square.

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

@HaleySchuhl HaleySchuhl added this to the PlantCV v4.9 milestone Jul 15, 2025
@HaleySchuhl HaleySchuhl added enhancement Enhancements to existing features work in progress Mark work in progress labels Jul 15, 2025
@github-project-automation github-project-automation bot moved this to Pull Requests in PlantCV4 Jul 15, 2025
Copy link

deepsource-io bot commented Jul 15, 2025

Here's the code health analysis summary for commits a3cf52a..56da299. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython✅ SuccessView Check ↗
DeepSource Test coverage LogoTest coverage✅ SuccessView Check ↗

Code Coverage Report

MetricAggregatePython
Branch Coverage100%100%
Composite Coverage100%100%
Line Coverage100%100%
New Branch Coverage100%100%
New Composite Coverage100%100%
New Line Coverage100%, ✅ Above Threshold100%, ✅ Above Threshold

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@HaleySchuhl HaleySchuhl marked this pull request as draft July 25, 2025 17:39
@HaleySchuhl HaleySchuhl marked this pull request as ready for review August 5, 2025 16:15
@HaleySchuhl HaleySchuhl added ready to review update Updates an existing feature/method and removed work in progress Mark work in progress labels Aug 5, 2025
@joshqsumner joshqsumner self-requested a review August 5, 2025 18:28
Copy link
Contributor

@joshqsumner joshqsumner left a comment

Choose a reason for hiding this comment

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

My only concern would be whether we should define aspect ratio/solidity for this context someplace in the docs. Change could be as simple as this on lines 19 and 20 of docs/transform_detect_color_card.md or we could do something prettier. Code wise I'd approve the change as is but could see this being helpful particularly with aspect ratio conventionally defined as width/height when what we're doing has a lower bound of 1 since we take max axis / min axis.

Edit: We could also have an if statement that takes the reciprocal of aspect_ratio if it is <1 which would help some too I think.

        - aspect_ratio   - Optional aspect ratio (longest side / shortest side) below which objects will get removed (default = 1.27)
        - solidity - Optional solidity (area / convex hull area) filter (default = 0.8) 

also define calculation of new parameters in doc page
@nfahlgren nfahlgren merged commit 5e723b4 into main Aug 8, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Pull Requests to Done in PlantCV4 Aug 8, 2025
@nfahlgren nfahlgren deleted the add_color_card_detection_squareness_parameters branch August 8, 2025 02:17
@HaleySchuhl HaleySchuhl linked an issue Aug 21, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancements to existing features ready to review update Updates an existing feature/method
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add help for challenging color card detection
3 participants