Quick Start: complete cranberry analysis running in minutes.¶
Created by: María A. Torres-Meraz; March, 2026
Requirements: Traitly installed (Installation Guide).
Sample images
You can download sample cranberry images here to follow along. For fruits with a more complex internal structure (e.g., tomato, orange, or cucumber), explore the Locule Segmentation tutorial.
Internal analysis¶
Use FruitInternalAnalyzer when your images contain visible locules (internal structure).
from traitly.fruit_phenotyping import FruitInternalAnalyzer
analyzer = FruitInternalAnalyzer("my_image.jpg")
analyzer.load_image()
analyzer.setup_measurements()
analyzer.generate_fruit_mask()
analyzer.detect_fruits()
# Morphological and color analysis
analyzer.analyze_morphology()
analyzer.analyze_color()
# Save results → returns a CSV and an annotated image
analyzer.results.save_all()
# Optionally, save the parameters used in the session
analyzer.save_parameters()
External analysis¶
Use FruitExternalAnalyzer for whole-fruit analysis (without locule or other internal structure segmentation).
from traitly.fruit_phenotyping import FruitExternalAnalyzer
analyzer = FruitExternalAnalyzer("my_image.jpg")
analyzer.load_image()
analyzer.setup_measurements()
analyzer.generate_fruit_mask()
analyzer.detect_fruits()
# Morphological and color analysis
analyzer.analyze_morphology()
analyzer.analyze_color()
# Save results → returns a CSV and an annotated image
analyzer.results.save_all()
# Optionally, save the parameters used in the session
analyzer.save_parameters()
Batch processing¶
Process an entire folder of images automatically.
# Internal analysis
from traitly.fruit_phenotyping import FruitInternalAnalyzer
analyzer = FruitInternalAnalyzer("PATH_FOLDER/")
analyzer.analyze_folder(
folder_path="my_images/",
output_path="results/",
analyze_morphology=True,
analyze_color=True,
json_path="path/file.json" # Optional, useful for defining parameters
)
# External analysis
from traitly.fruit_phenotyping import FruitExternalAnalyzer
analyzer = FruitExternalAnalyzer("PATH_FOLDER/")
analyzer.analyze_folder(
folder_path="my_images/",
output_path="results/",
analyze_morphology=True,
analyze_color=True,
json_path="path/file.json" # Optional, useful for defining parameters
)
This generates a folder called results/ with:
morphology_results.csv(ifanalyze_morphology=True)color_results.csv(ifanalyze_color=True)*_processed.jpgfor each successfully analyzed imagesession_report.txterror_report.txt(only if any image failed)
What's next?¶
- Internal Analysis Guide — detailed guide with all available parameters and methods for
FruitInternalAnalyzer. - External Analysis Guide — detailed guide with all available parameters and methods for
FruitExternalAnalyzer. - External Analysis Tutorial — analyzing an image step by step.
- Traits Table — what each column in the CSV means.