TiagoOlivoto / pliman

Tools for Plant Image Analysis
https://tiagoolivoto.github.io/pliman/
GNU General Public License v3.0
50 stars 9 forks source link

Analyze nearinfrared pictures #13

Closed FlorianRocher closed 6 months ago

FlorianRocher commented 6 months ago

Hi !

Thanks for this nice package. Do you know how I should proceed to use it to measure symptom area from pictures obtained from a Bio-Rad ChemiDoc MP Imager with nearinfrared settings that are black and white? I have troubles using the measure_disease function on those. po-pi-b4-l2

Thanks for your help !

Florian Rocher

TiagoOlivoto commented 6 months ago
library(pliman)
#> |==========================================================|
#> | Tools for Plant Image Analysis (pliman 2.1.0)            |
#> | Author: Tiago Olivoto                                    |
#> | Type `citation('pliman')` to know how to cite pliman     |
#> | Visit 'http://bit.ly/pkg_pliman' for a complete tutorial |
#> |==========================================================|
set_wd_here()
img <- image_import("nir.jpg")

# index to segment
ind <- image_index(img, index = "R")

image plot(ind, type = "density")

# Segment the leaf
seg <- 
  image_segment(img, 
                index = "R",
                # threshold = 0.1, # optionally set the threshold
                invert = TRUE,
                filter = 20) # remove noise

image

# Make another segmentation to isolate the diseased tissue
# Now, segment the disease
image_segment(seg, 
              index = "R",
              # threshold = 0.1, # optionally set the threshold
              invert = TRUE)

image

# Combine the approaches by declaring one index to segment the background
# and another index to segment the diseased tissue

sev <- 
measure_disease(img,
                index_lb = "B",
                index_dh = "B",
                invert = c(TRUE, TRUE),
                col_lesions = "red",
                show_original = FALSE,
                filter = 20)

image

healthy symptomatic
1 96.35847    3.641526

Hope it helps!

Created on 2024-03-07 with reprex v2.1.0

FlorianRocher commented 6 months ago

Hi,

Thanks for your help. It has been helpful! When I run the image_index(img, index="R") line I obtain the following picture. Capture Do you know why I don't have the yellow background as you ? And another question: All the steps of index and segment the pictures are done to check if we will be able to correctly assess the disease area with the chosen index right ?

Thanks and have a nice day !

Florian Rocher

TiagoOlivoto commented 6 months ago

Hi, Try install pliman from github.. you probably have an older version than me. Yes, all steps before measure_disease() are just to find appropriate indexes I'm closing this now Best