Closed gdauby closed 1 year ago
Hi @gdauby , I couldn't reproduce the error on my side. Please, verify if you are using the dev version of pliman (make sure to install pliman from github to have access to the last news and bug corrections (I'm planning a major release on CRAN in a few weeks). To install from github, use remotes::install_github("TiagoOlivoto/pliman")
Here're some tips to analyze such image.
library(pliman)
#> |==========================================================|
#> | Tools for Plant Image Analysis (pliman 1.2.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")
# set_wd_here() # set the working directory to the path of file
img <- image_import("img.jpg")
# first of all, you need to choose an index to segment
# 1. leaves and reference from the background (keep as foreground)
# 2. leaves from reference (keep leaves)
# the following, will perform the segmentation with all available indexes
# image_segment_iter(img, nseg = 2)
# after some tests, the two indexes are B and R-G
image_segment_iter(img, index = c("B", "R-G"))
#> image pixels percent
#> 1 original 22943448 100.00000
#> 2 seg1 8181438 35.65915
#> 3 seg2 8101020 99.01707
# note that fill_hull = TRUE may help you to fill holes
# you can also test the 'filter' argument.. this will remove possible noises
# Now, you can use analyze_objects, with the the following arguments
# the reference object will be colored in red (this will help you to see if the segmentation was performed correctly)
res <- analyze_objects(img,
reference = TRUE, # indicates that there is a reference in the image
back_fore_index = "B", # index to segment reference + leaves from background
fore_ref_index = "R-G", # index to segment reference and leaves
watershed = FALSE, # set to TRUE if leaves are touching each other
# object_size = "large", # this will control how watershed works.. try changing to small
marker = "area",
filter = 3, # remove noise
fill_hull = TRUE, # if FALSE, will result in several 'holes' in the leaves
reference_area = 4) # I assumed that the reference has 4 cm2, change according
res$results
#> id x y area area_ch perimeter radius_mean radius_min
#> 3 3 381.7126 1348.023 109.80755 111.68415 44.81007 6.119369 4.124521
#> 4 4 1539.8681 1469.431 119.17742 121.80397 48.61357 6.424274 4.312093
#> 7 7 1593.0025 3085.195 111.60273 112.41278 45.41554 6.188672 4.312488
#> 8 8 372.5171 3127.172 67.94885 68.79991 37.53980 4.978166 2.893091
#> radius_max radius_sd diam_mean diam_min diam_max major_axis minor_axis
#> 3 9.126145 1.495792 12.238738 8.249043 18.25229 16.67364 8.418830
#> 4 9.912393 1.527892 12.848548 8.624187 19.82479 17.26657 8.825506
#> 7 9.493167 1.583863 12.377345 8.624976 18.98633 17.20527 8.303927
#> 8 8.104797 1.575048 9.956331 5.786181 16.20959 14.85112 5.850375
#> length width radius_ratio eccentricity theta solidity convexity
#> 3 17.98685 8.626488 2.212656 0.3471054 1.561144 0.9831973 0.8981382
#> 4 18.61489 9.100198 2.298743 0.3307280 1.445139 0.9784362 0.8417816
#> 7 18.87298 8.751091 2.201320 0.3266697 -1.538252 0.9927940 0.9189865
#> 8 15.98549 5.975648 2.801432 0.2299912 1.416736 0.9876299 0.9147805
#> elongation circularity circularity_haralick circularity_norm coverage
#> 3 0.5204003 18.28601 4.091057 1.458265 0.09628134
#> 4 0.5111334 19.82992 4.204665 1.581383 0.10449702
#> 7 0.5363163 18.48137 3.907329 1.473814 0.09785539
#> 8 0.6261830 20.73967 3.160644 1.655233 0.05957884
#> asm con cor var idm sav sva
#> 3 0.04002358 2.705853 0.7732885 6.967612 0.6046174 8.175257 70.01186
#> 4 0.02118343 2.881822 0.9005808 15.493289 0.5958295 16.751592 289.50067
#> 7 0.03846488 1.495121 0.9385237 13.160129 0.6938088 16.850686 287.62320
#> 8 0.03103248 1.506769 0.9401819 13.594603 0.7055227 16.120046 265.57900
#> sen ent dva den f12 f13
#> 3 1.186175 1.631566 2.705853 0.5830037 0.2156136 0.5714213
#> 4 1.441160 1.917670 2.881822 0.5930027 0.3361421 0.7345269
#> 7 1.343339 1.678359 1.495121 0.4842656 0.4114297 0.7621291
#> 8 1.399063 1.724419 1.506769 0.4773082 0.4498587 0.7953645
Created on 2023-02-14 with reprex v2.0.2
Please, let me know if it worked!
Thanks for the tips. It helped a lot.
Hello
I am testing this very promising package.
I have an error with one photo attached, using the function
analyze_objects
Anything I am doing wrong ?
Thanks