Skip to content

Commit

Permalink
Fixed problem with color sorting routine
Browse files Browse the repository at this point in the history
  • Loading branch information
stg committed Mar 10, 2013
1 parent f4ab2ca commit dd18369
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Binary file modified bin-win/gui.exe
Binary file not shown.
4 changes: 3 additions & 1 deletion gui/picture.c
Expand Up @@ -96,7 +96,8 @@ static hsv_color rgb_to_hsv(rgb_color rgb) {
static uint8_t weight(color_list* color) { static uint8_t weight(color_list* color) {
hsv_color hsv = rgb_to_hsv(color->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 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; return (h_weight + v_weight) >> 8;
} }


Expand Down Expand Up @@ -173,6 +174,7 @@ static uint8_t analyze() {
pri = sample_rgb(x, y); pri = sample_rgb(x, y);
if(match(&pri, c)) { if(match(&pri, c)) {
row_colors++; row_colors++;
//if(row_colors > 2) printf("Row %i found %i\n", y, c);
break; break;
} }
} }
Expand Down

0 comments on commit dd18369

Please sign in to comment.