Skip to content

Commit 2d4764e

Browse files
authored
Merge pull request #48 from SystemsGenetics/yaml-starch-scales
Yaml starch scales
2 parents 34d4873 + b15b5bc commit 2d4764e

3 files changed

Lines changed: 88 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dist/
1111
06-Package
1212
*logs/
1313
_build/
14+
results/
1415

1516
# Files
1617
*.pyc

Granny/Analyses/Segmentation.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,36 @@ def __init__(self):
211211
self.text_thickness.setValue(3)
212212
self.text_thickness.setIsRequired(False)
213213

214+
self.text_color_r = IntValue(
215+
"text_color_r",
216+
"text_color_r",
217+
"Red channel value for text color (0-255). Default is 0 (black).",
218+
)
219+
self.text_color_r.setMin(0)
220+
self.text_color_r.setMax(255)
221+
self.text_color_r.setValue(0)
222+
self.text_color_r.setIsRequired(False)
223+
224+
self.text_color_g = IntValue(
225+
"text_color_g",
226+
"text_color_g",
227+
"Green channel value for text color (0-255). Default is 0 (black).",
228+
)
229+
self.text_color_g.setMin(0)
230+
self.text_color_g.setMax(255)
231+
self.text_color_g.setValue(0)
232+
self.text_color_g.setIsRequired(False)
233+
234+
self.text_color_b = IntValue(
235+
"text_color_b",
236+
"text_color_b",
237+
"Blue channel value for text color (0-255). Default is 0 (black).",
238+
)
239+
self.text_color_b.setMin(0)
240+
self.text_color_b.setMax(255)
241+
self.text_color_b.setValue(0)
242+
self.text_color_b.setIsRequired(False)
243+
214244
# Sorting/grouping parameter
215245
self.row_tolerance = IntValue(
216246
"row_tolerance",
@@ -277,6 +307,9 @@ def __init__(self):
277307
self.bbox_thickness,
278308
self.font_scale,
279309
self.text_thickness,
310+
self.text_color_r,
311+
self.text_color_g,
312+
self.text_color_b,
280313
self.row_tolerance,
281314
)
282315

@@ -388,7 +421,7 @@ def _extractMaskedImage(self, tray_image: Image) -> Image:
388421
(x1, y1),
389422
fontFace=cv2.FONT_HERSHEY_SIMPLEX,
390423
fontScale=self.font_scale.getValue(),
391-
color=(255, 255, 255),
424+
color=(self.text_color_b.getValue(), self.text_color_g.getValue(), self.text_color_r.getValue()),
392425
thickness=self.text_thickness.getValue(),
393426
)
394427
image_instance: Image = RGBImage(

Granny/assets/starch_scales.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,61 @@ GRANNY_SMITH:
3636
rating: [0.920742836, 0.890332499, 0.808227909, 0.721813109, 0.595806394, 0.278299256, 0.104111379]
3737

3838
JONAGOLD:
39+
# Updated with transparent background images (2026-01-22)
40+
# Note: Minor non-monotonic at indices 7.0 and 9.0
3941
index: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
40-
rating: [0.898336414, 0.859494456, 0.806417832, 0.742177914, 0.653981582, 0.483778570, 0.387202327, 0.284663986, 0.175593498]
42+
rating: [0.904449699, 0.874103352, 0.836673554, 0.838637605, 0.784962049, 0.594890812, 0.701861145, 0.443807162, 0.596292231]
4143

4244
CORNELL:
4345
index: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
4446
rating: [0.990554095, 0.915430492, 0.822470328, 0.726896529, 0.610745795, 0.338955981, 0.150869695, 0.041547982]
47+
48+
PURDUE:
49+
index: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
50+
rating: [0.942025840, 0.858846162, 0.767229201, 0.564366621, 0.484868413, 0.266928900, 0.074313346]
51+
# Threshold 150 alternative (for comparison):
52+
# index: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
53+
# rating: [0.904324121, 0.755849937, 0.675973804, 0.411188084, 0.330359199, 0.160435085, 0.058093191]
54+
55+
DANJOU:
56+
# Updated with transparent background images (2026-01-22)
57+
# Note: Minor non-monotonic at index 3.5
58+
index: [1.2, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0]
59+
rating: [0.936809998, 0.922681876, 0.872891694, 0.751986331, 0.632509641, 0.675894367, 0.385525954, 0.269095698]
60+
61+
AMBROSIA:
62+
# Updated with transparent background images (2026-01-22)
63+
# Ratings averaged across A/B/C variants for each index
64+
index: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
65+
rating: [0.938836999, 0.918713937, 0.899148039, 0.800415449, 0.743251611, 0.546193038, 0.434137897, 0.190703881]
66+
67+
MINNEISKA:
68+
# Updated with transparent background images (2026-01-22)
69+
# WARNING: Still non-monotonic - source images have quality issues
70+
# Index 6.0 missing (reference card says "apple clear of starch")
71+
index: [1.0, 2.0, 3.0, 4.0, 5.0]
72+
rating: [0.941631104, 0.906756575, 0.579645190, 0.643510650, 0.441163061]
73+
74+
PINKLADY:
75+
# Updated with transparent background images (2026-01-22)
76+
# Excellent monotonic decrease
77+
index: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
78+
rating: [0.959550159, 0.699509917, 0.614671054, 0.502103609, 0.491582825, 0.311998962, 0.147608409]
79+
80+
REDDELICIOUS1980:
81+
# Updated with transparent background images (2026-01-22)
82+
# Excellent monotonic decrease
83+
index: [1.2, 1.5, 1.8, 2.0, 2.2, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0]
84+
rating: [0.930329713, 0.915044820, 0.856309558, 0.853819411, 0.792795414, 0.761423428, 0.711408319, 0.619893048, 0.495924193, 0.480951636, 0.431083558, 0.203781176]
85+
86+
REDDELICIOUS1990:
87+
# Updated with transparent background images (2026-01-22)
88+
# Excellent monotonic decrease
89+
index: [0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
90+
rating: [0.969424567, 0.945761350, 0.935346949, 0.880456871, 0.816953597, 0.736772334, 0.669650642, 0.579715970, 0.442378759, 0.320778000, 0.203632175, 0.181581181]
91+
92+
ROYAL_GALA:
93+
# Updated with transparent background images (2026-01-22)
94+
# Note: Minor non-monotonic at index 3.0
95+
index: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
96+
rating: [0.910532554, 0.839360955, 0.928483858, 0.863534479, 0.774230735, 0.737439732, 0.568495148, 0.480588864, 0.325108538]

0 commit comments

Comments
 (0)