-
Notifications
You must be signed in to change notification settings - Fork 267
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 optional pixel to mm conversion in plantcv.analyze.size and others #1649
Comments
Thank you @rayn-alex for the suggestion, I do think it would be convenient to report the scaled measurements. This is a change that @nfahlgren and Katie have discussed a couple months ago, but decided that this conversion would make most sense happening outside the We revisited the topic this morning and they agreed that we could put it into a new function, maybe something like |
Hey @HaleySchuhl, sound reasonable! |
Found the old issue, so tagging here for ease #926 |
Rather than a new function, I was thinking we could add new global parameters that are used by analyze functions (in the Something like this:
If the analyze functions scaled the recorded observations with these then the outputs would be in pixels and the values would be unchanged. But if we set these (manually or automatically) by replacing the scaling factors and the units to cm, mm, etc. then the outputs would reflect that new scale and units. |
Hm! This would be a neat solution, and probably better than a new function. However, this would require to update all analyze functions, right? What do you all prefer? I think I'd vote for adding a new global parameter. |
Hi! I am using PlantCV for multiple trays, and in the output file, I obtain the delimited and calculated area in pixel units. Since I am not using a color card as a reference, how should I convert the output data to cm² or mm²? Or is there a function that simplifies this process? Thanks! |
Hey @Li-Alvarez you don't need a color card for this. You have to assess your mm-to-pixel conversion factor at a certain distance. From this, you can calculate the mm-to-pixel conversion factor at any distance because the distance-to-surface ration is constant. Multiply your pixel values with this factor. We are currently working on implementing functionality in plantCV that does this for you (hence this issue). E.g.: Take an image of a ruler at 1m distance and calculate how many pixels are one mm (average). Let's say it's 1px = 1mm |
Agreed @rayn-alex , the analyze functions including This part I am not suggesting you tackle unless you want to: We can also include the calculation of the Excited to collaborate further with you on this enhancement. |
Hey @HaleySchuhl, please excuse my silence on this. I could dedicate some time to this in the next days and provide a first suggestion. It would be great to include the calculation of the Do you have an idea how we can avoid a breaking change here? Only scale if the factor is set? I'm also available for a quick call if that helps to coordinate work on this. |
Is your feature request related to a problem? Please describe.
I want to convert the pixel size values to mm so it's written in the outputs with the unit mm
Describe the solution you'd like
Add an option to the function that leads to a conversion of the px values to mm or mm². This could simply be a conversion factor. E.g.:
plantcv.analyze.size(img, labeled_mask, n_labels=1, label=None, px_conversion_factor=None)
Describe alternatives you've considered
It's always possible to do the conversion outside plantCV. However, I think it'd be convenient and it might be useful for more users.
If you all think an option like this makes sense, I could implement this in
plantcv.analyze.size
as well as all the other functions where this might be relevant (please help me to list all).The text was updated successfully, but these errors were encountered: