mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2025-01-13 13:40:54 +00:00
remove multiple RGB to grey conversion while OCR
This commit is contained in:
parent
b8a15f6f9d
commit
d22ab6f9a1
@ -1,5 +1,6 @@
|
||||
0.88(2018-10-24) (unreleased)
|
||||
-----------------
|
||||
- Optimize: Remove multiple RGB to grey conversion in OCR.
|
||||
- Fix: Update UTF8Proc to 2.2.0
|
||||
- Fix: Warn instead of fatal when a 0xFF marker is missing
|
||||
|
||||
|
@ -244,20 +244,21 @@ char* ocr_bitmap(void* arg, png_color *palette,png_byte *alpha, unsigned char* i
|
||||
ppixel++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOX *crop_points = ignore_alpha_at_edge(copy->alpha, copy->data, w, h, color_pix, &color_pix_out);
|
||||
//Converting image to grayscale for OCR to avoid issues with transparency
|
||||
cpix_gs = pixConvertRGBToGray(cpix, 0.0, 0.0, 0.0);
|
||||
#ifdef OCR_DEBUG
|
||||
{
|
||||
char str[128] = "";
|
||||
static int i = 0;
|
||||
sprintf(str,"temp/file_c_%d.jpg",i);
|
||||
printf("Writing file_c_%d.jpg\n", i);
|
||||
pixWrite(str, pixConvertRGBToGray(cpix, 0.0, 0.0, 0.0), IFF_JFIF_JPEG);
|
||||
pixWrite(str, cpix_gs, IFF_JFIF_JPEG);
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
|
||||
cpix_gs = pixConvertRGBToGray(cpix, 0.0, 0.0, 0.0); // Abhinav95: Converting image to grayscale for OCR to avoid issues with transparency
|
||||
if (cpix_gs==NULL)
|
||||
tess_ret=-1;
|
||||
else
|
||||
@ -273,7 +274,7 @@ char* ocr_bitmap(void* arg, png_color *palette,png_byte *alpha, unsigned char* i
|
||||
pixDestroy(&cpix_gs);
|
||||
pixDestroy(&color_pix);
|
||||
pixDestroy(&color_pix_out);
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user