Closed gdauby closed 1 year ago
Hi,
In this case, can use the argument reference
and reference_smaller
to correct the units from pixels to cm. Provided that you have an object that is smaller than all the other in the image, you can use it as a reference (it could be even a leaf square that is smaller than the leaves). See an example
library(pliman)
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#> (status 2 uses the sf package in place of rgdal)
#> |==========================================================|
#> | Tools for Plant Image Analysis (pliman 2.0.0) |
#> | Author: Tiago Olivoto |
#> | Type 'citation('pliman')' to know how to cite pliman |
#> | Type 'vignette('pliman_start')' for a short tutorial |
#> | Visit 'http://bit.ly/pkg_pliman' for a complete tutorial |
#> |==========================================================|
setwd("E:/Downloads/test")
df <- image_import("leaves.jpeg")
area <-
analyze_objects(df,
fill_hull = FALSE, # default
marker = "id",
filter = 5, # remove noises
index = "R", # segment leaves and reference
watershed = FALSE, # dont use watershed segmentation
reference = TRUE, # declare that there is a reference
reference_smaller = TRUE, # the reference is the smaller object in the image
reference_area = 6) # the reference area has 6 cm2
area2 <-
analyze_objects(df,
fill_hull = TRUE,
marker = "id",
filter = 5, # remove noises
index = "R", # segment leaves and reference
watershed = FALSE, # dont use watershed segmentation
reference = TRUE, # declare that there is a reference
reference_smaller = TRUE, # the reference is the smaller object in the image
reference_area = 6) # the reference area has 6 cm2
cbind(area$results[, c(1, 4)], fill_hue_true = area2$results[, 4])
#> id area fill_hue_true
#> 4 4 44.03474 44.31654
#> 10 10 55.17822 55.18503
#> 12 12 41.48115 41.48075
Created on 2023-07-13 with reprex v2.0.2
Since this is not a bug, I'm closing this now. Please, feel free to email me if you have any questions
Hello,
I am trying to figure it out how to estimates the areas of the three leaves in the attached files, without taking into account the small holes in the upper leaf.
I use the developement version 2.0.0.
The script I use is basically the following:
I first crop the image to get rid of the borders
After screening for index, I choose the R index. It does not discriminate the reference area from leaves, but my idea is to use afterward the function
get_measures
and select the reference id and its area.I have tried several set of parameters but the closest output to what I want is the following, trying to play with extension and tolerance parameters. However, this is not totally satisfying as one of the hole is not identified, and two of the leaves are over-segmented. What would be the best strategy to overcome this ? Thanks