-
Notifications
You must be signed in to change notification settings - Fork 263
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 circular crop? #1561
Labels
new feature
New feature ideas and solutions
Comments
Hi Keely, would this approach work for you? from plantcv import plantcv as pcv
# Read image
img, _, _ = pcv.readimage(filename="2017-01-18_1510_ch129-pos01.jpg")
# Create circle ROI
roi = pcv.roi.circle(img=img, x=1300, y=1200, r=200)
# Convert ROI to a mask
roimask = pcv.roi.roi2mask(img=img, roi=roi)
# Mask the input image
masked = pcv.apply_mask(img=img, mask=roimask, mask_color="black") |
Yes, thank you! That's what Pavan ended up doing, and it works great. Maybe for the sake of redundancy (and since it's only 3 steps), it doesn't make sense to have a separate function. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
A few times recently it has seemed like cropping to a circle would be useful, but I'm not sure how hard it would be. One specific example involves X-ray images of seeds inside of a Petri dish. The dish is very bright, so being able to crop to everything inside, even if it means just zero-ing out some padding around the outside to keep displaying a rectangle, would I think help some downstream analysis.
Describe the solution you'd like
A separate function like the current crop, but that takes a center point and radius as input for cropping.
The text was updated successfully, but these errors were encountered: