Permalink
Browse files

Fixed problem with color sorting routine

  • Loading branch information...
1 parent f4ab2ca commit dd18369d8e5d72da6c97d461dad3b56c962e374c @stg committed Mar 10, 2013
Showing with 3 additions and 1 deletion.
  1. BIN bin-win/gui.exe
  2. +3 −1 gui/picture.c
View
Binary file not shown.
View
@@ -96,7 +96,8 @@ static hsv_color rgb_to_hsv(rgb_color rgb) {
static uint8_t weight(color_list* color) {
hsv_color hsv = rgb_to_hsv(color->color);
uint16_t h_weight = ((uint16_t)(0xFF-hsv.h) * (uint16_t)( hsv.s)) >> 4;
- uint16_t v_weight = ((uint16_t)hsv.v) << 7;
+ //uint16_t v_weight = ((uint16_t)hsv.v) << 7;
+ uint16_t v_weight = ((color->color.r + color->color.g + color->color.b) / 3) << 7;
return (h_weight + v_weight) >> 8;
}
@@ -173,6 +174,7 @@ static uint8_t analyze() {
pri = sample_rgb(x, y);
if(match(&pri, c)) {
row_colors++;
+ //if(row_colors > 2) printf("Row %i found %i\n", y, c);
break;
}
}

0 comments on commit dd18369

Please sign in to comment.