danforthcenter / plantcv

Plant phenotyping with image analysis
Mozilla Public License 2.0
661 stars 264 forks source link

Problems detecting color card. #1452

Closed mariameraz closed 8 months ago

mariameraz commented 8 months ago

Hi!! I am not able to detect the color card using the function detect_color_card in PlantCV 4.2.1 (Ubuntu 20.04). It gives my a strange output. Any suggestions about how to deal with it please? Thanks!

Here is my code and output: pcv.plot_image(crop_img)

output

card_mask = pcv.transform.detect_color_card(rgb_img=crop_img) headers, card_matrix = pcv.transform.get_color_matrix(rgb_img=crop_img, mask=card_mask)

detect_color_card

std_color_matrix = pcv.transform.std_color_matrix (pos=1) img_cc = pcv.transform.affine_color_correction(crop_img, card_matrix, std_color_matrix)

output

HaleySchuhl commented 8 months ago

Hi @mariameraz thanks for opening this issue. The new detect_color_card is recognizing which corner the white chip is in and numbering colors in the same order as is pos=3 regardless of the card's actual apparent orientation, so I think you will get expected color correction when you change this step: std_color_matrix = pcv.transform.std_color_matrix (pos=3) and please let us know if this resolves it!

mariameraz commented 8 months ago

Hi Haley,

Thank you very much for your help.It solved the problem!!

std_color_matrix = pcv.transform.std_color_matrix (pos=3) img_cc = pcv.transform.affine_color_correction(crop_img, card_matrix, std_color_matrix) output

Have a nice day, Alejandra