minor fixes

This commit is contained in:
Scott Pruett 2022-06-08 22:35:10 -04:00
parent 9e4015c53c
commit 3f51e731b1
7 changed files with 54 additions and 9 deletions

View File

@ -91,6 +91,10 @@
"track_recognition_threshold": 10,
"dump_frame_fraction": null,
"light_mode": false,
"font_scale": 1.2,
"tts": {}
"font_scale": 1.3,
"tts": {
"pre_race": true,
"first_lap_summary": true,
"every_lap_summary": false
}
}

View File

@ -179,3 +179,36 @@
2022-06-03-00:30 (Magdalena Club),Magdalena Club,60s GP,12,20.942,20.296,100,39,61,
2022-06-03-00:30 (Magdalena Club),Magdalena Club,60s GP,13,20.576,20.296,100,30,52,
2022-06-04-02:10,,,3,25.000,25.000,75,75,75,
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,1,40.652,39.191,100,84,86,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,2,40.818,39.191,100,68,72,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,3,40.994,39.191,100,53,57,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,4,41.794,39.191,100,38,41,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,5,41.051,39.191,100,23,24,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,6,45.019,39.191,92,8,7,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,7,51.638,39.191,100,85,87,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,8,39.737,39.191,100,69,73,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,9,40.078,39.191,100,54,57,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,10,41.059,39.191,100,39,42,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,11,40.371,39.191,100,24,25,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,12,44.996,39.191,100,10,6,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,13,50.701,39.191,100,85,87,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,14,40.009,39.191,100,70,74,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,15,39.801,39.191,100,54,59,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,16,39.700,39.191,100,39,43,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,17,40.301,39.191,100,24,26,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,18,41.423,39.191,100,8,8,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,19,67.145,39.191,100,85,88,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,20,39.191,39.191,100,70,74,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,21,39.892,39.191,100,55,59,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,22,40.615,39.191,100,39,43,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,23,40.599,39.191,100,24,26,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,24,44.018,39.191,100,10,7,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,25,50.979,39.191,100,84,87,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,26,39.414,39.191,100,69,73,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,27,40.233,39.191,100,39,42,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,28,44.599,39.191,92,25,26,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,29,49.873,39.191,100,84,87,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,30,39.518,39.191,100,68,73,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,31,40.392,39.191,100,53,57,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,32,40.085,39.191,100,37,40,lemons
2022-06-08-21:54 (Thunder Point),Thunder Point,GT,33,40.355,39.191,100,22,23,lemons

1 2022-05-22-20:39,whistle valley,gp,1,22.349,22.349,100,,
179 2022-06-03-00:30 (Magdalena Club),Magdalena Club,60s GP,12,20.942,20.296,100,39,61,
180 2022-06-03-00:30 (Magdalena Club),Magdalena Club,60s GP,13,20.576,20.296,100,30,52,
181 2022-06-04-02:10,,,3,25.000,25.000,75,75,75,
182 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,1,40.652,39.191,100,84,86,lemons
183 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,2,40.818,39.191,100,68,72,lemons
184 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,3,40.994,39.191,100,53,57,lemons
185 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,4,41.794,39.191,100,38,41,lemons
186 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,5,41.051,39.191,100,23,24,lemons
187 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,6,45.019,39.191,92,8,7,lemons
188 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,7,51.638,39.191,100,85,87,lemons
189 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,8,39.737,39.191,100,69,73,lemons
190 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,9,40.078,39.191,100,54,57,lemons
191 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,10,41.059,39.191,100,39,42,lemons
192 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,11,40.371,39.191,100,24,25,lemons
193 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,12,44.996,39.191,100,10,6,lemons
194 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,13,50.701,39.191,100,85,87,lemons
195 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,14,40.009,39.191,100,70,74,lemons
196 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,15,39.801,39.191,100,54,59,lemons
197 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,16,39.700,39.191,100,39,43,lemons
198 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,17,40.301,39.191,100,24,26,lemons
199 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,18,41.423,39.191,100,8,8,lemons
200 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,19,67.145,39.191,100,85,88,lemons
201 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,20,39.191,39.191,100,70,74,lemons
202 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,21,39.892,39.191,100,55,59,lemons
203 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,22,40.615,39.191,100,39,43,lemons
204 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,23,40.599,39.191,100,24,26,lemons
205 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,24,44.018,39.191,100,10,7,lemons
206 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,25,50.979,39.191,100,84,87,lemons
207 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,26,39.414,39.191,100,69,73,lemons
208 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,27,40.233,39.191,100,39,42,lemons
209 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,28,44.599,39.191,92,25,26,lemons
210 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,29,49.873,39.191,100,84,87,lemons
211 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,30,39.518,39.191,100,68,73,lemons
212 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,31,40.392,39.191,100,53,57,lemons
213 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,32,40.085,39.191,100,37,40,lemons
214 2022-06-08-21:54 (Thunder Point),Thunder Point,GT,33,40.355,39.191,100,22,23,lemons

View File

@ -55,7 +55,7 @@ fn is_finished_lap(state: &AppState, frame: &LapState) -> bool {
}
}
if let Some(prev_frame) = state.buffered_frames.back() {
prev_frame.lap_time.is_some() && (prev_frame.lap_time == frame.lap_time || prev_frame.lap.unwrap_or(usize::MAX - 1) + 1 == frame.lap.unwrap_or_default())
prev_frame.lap_time.is_some() && prev_frame.lap_time == frame.lap_time
} else {
false
}

View File

@ -16,8 +16,8 @@ fn is_dark_pixel(image: &RgbImage, x: u32, y: u32) -> bool {
r < 100 && g < 100 && b < 100
}
fn column_has_any_dark(image: &RgbImage, x: u32) -> bool {
for y in 0..image.height() {
fn column_has_any_dark(image: &RgbImage, x: u32, start_y: u32) -> bool {
for y in start_y..image.height() {
if is_dark_pixel(image, x, y) {
return true;
}
@ -60,10 +60,11 @@ fn get_character_bounding_boxes(image: &RgbImage) -> Vec<BoundingBox> {
let mut boxes = Vec::new();
let (cutoff_x, cutoff_y) = find_vertical_cutoff_from_right(image).unwrap_or_default();
while x < image.width() {
take_while(&mut x, image.width(), |x| !column_has_any_dark(image, x));
let start_y = if x > cutoff_x { cutoff_y } else { 0 };
take_while(&mut x, image.width(), |x| !column_has_any_dark(image, x, start_y));
let start_x = x;
take_while(&mut x, image.width(), |x| column_has_any_dark(image, x));
take_while(&mut x, image.width(), |x| column_has_any_dark(image, x, start_y));
let width = x - start_x;
if width >= 1 {

View File

@ -99,7 +99,7 @@ impl OcrDatabase {
.filter_map(|hash| self.ocr_char(hash))
.collect();
buffer
.trim_end_matches(|c: char| !c.is_alphanumeric())
.trim_matches(|c: char| !c.is_alphanumeric())
.to_owned()
}
@ -143,5 +143,10 @@ mod test {
.unwrap()
.to_rgb8();
assert_eq!(db.ocr_image(&image), "10/12");
let image = image::load_from_memory(include_bytes!("test_data/test-pos-2.png"))
.unwrap()
.to_rgb8();
assert_eq!(db.ocr_image(&image), "1/2");
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

View File

@ -1,10 +1,12 @@
- Recognize
- Pit stops
- Pit stops (show line in table)
- Best time from other racers
- Editable lap stats
- Autocomplete for car/track
- Detect car name from load screen
- Post race metric charts
- Show during race instead of table (?)
- Fix 0 tyres parsing as ".0"
- [PARTIAL] TTS for pit strategies
- [DONE] Show delta positions
- [DONE] Track penalties