question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update how functions use contours and hierarchies

See original GitHub issue

Update how functions use contours and hierarchies

Description

  • Many functions in PlantCV output and require the user to input contours and hierarchies. Often the functions that need contours and hierarchies as input also take a mask. It might be easier to hide contours and hierarchies from users all together since these can be found from the masks that get input. It is more or less repetitive info.
  • Functions that deal with multiple plants, i.e. pcv.roi.multi() and pcv.cluster_contours(), could instead return a list of masks and we could handle multiple objects within the pcv.analyze_* functions.
  • Under this restructuring we could change the way we think of entities (in regards to data stored to the Outputs class and printed out when a workflow is run in parallel over a set of images). Right now, individual images are usually an entity but in the case where images contain more than one plant it might make more sense to treat individual plants as separate entities. We can differentiate between these by naming the entities with information about it’s position in addition to the image filename. pcv.roi.multi() allows for irregular plant layout so the entity can be named after the filename of the original image plus the center of the ROI used to identify the plant.

Details

  • If these updates seem beneficial they will impact all functions outputting contours, all functions requiring a contour input, enhancing all analyze_* functions to allow for multiple entities per image, and the Outputs data storage/json data output/json2csv function.

Completion Criteria

For a discussion:

  • Discuss and develop requirements docs
  • Create issues for next steps

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
dschneiderchcommented, Jun 28, 2019

I don’t really understand how a contour class vs contour list would differ so I can’t comment on that, but avoiding user-triggered for loops for multiple roi would really help readability and intuitiveness.

1reaction
HaleySchuhlcommented, Nov 1, 2019

This is kind of in progress now. Once plantcv-workflow.py is updated we plan to start transitioning each PlantCV function over to accept data object class instances to simplify parameters for many functions. This is in progress since the new functions getting added to the hyperspectral sub-package (since it’s relatively separate from other pcv functions) have been written to utilize a class system to attach all sorts of metadata to a hyperspectral datacube or spectral index.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contours Hierarchy - OpenCV
What is Hierarchy? Normally we use the cv.findContours() function to detect objects in an image, right ? Sometimes objects are in different locations....
Read more >
Python OpenCV Contour Tree Hierarchy Structure
Moving down the hierarchy, each new level of contours represents the next innermost contour for each object.
Read more >
Contour Detection using OpenCV (Python/C++) - LearnOpenCV
You've seen that the findContours() function returns two outputs: The contours list, and the hierarchy. Let's now understand the contour hierarchy output in ......
Read more >
Contours - 5 : Hierarchy - OpenCV-Python
But when we found the contours in image using cv2.findContours() function, we have passed two arguments additional to source image. They are ...
Read more >
Contours in OpenCV
Learn about the hierarchy of contours, i.e. the parent-child relationship in contours. Learn to find and draw contours using the functions cv.findContours and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found