mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-25 04:11:38 +00:00
Use TessDeleteText to delete strings received from Tesseract
This commit is contained in:
parent
560a88b0b9
commit
71dffd6eb3
@ -434,7 +434,7 @@ char* ocr_bitmap(void* arg, png_color *palette,png_byte *alpha, unsigned char* i
|
||||
if(strstr(text_out,word))
|
||||
{
|
||||
char *text_out_copy = strdup(text_out);
|
||||
free(text_out);
|
||||
TessDeleteText(text_out);
|
||||
text_out = malloc(strlen(text_out_copy)+strlen(substr)+1);
|
||||
memset(text_out,0,strlen(text_out_copy)+strlen(substr)+1);
|
||||
int pos = (int)(strstr(text_out_copy,word)-text_out_copy);
|
||||
@ -448,7 +448,7 @@ char* ocr_bitmap(void* arg, png_color *palette,png_byte *alpha, unsigned char* i
|
||||
else if(!written_tag)
|
||||
{
|
||||
char *text_out_copy = strdup(text_out);
|
||||
free(text_out);
|
||||
TessDeleteText(text_out);
|
||||
text_out = malloc(strlen(text_out_copy)+strlen(substr)+1);
|
||||
memset(text_out,0,strlen(text_out_copy)+strlen(substr)+1);
|
||||
strcpy(text_out,substr);
|
||||
@ -464,7 +464,7 @@ char* ocr_bitmap(void* arg, png_color *palette,png_byte *alpha, unsigned char* i
|
||||
freep(&histogram);
|
||||
freep(&mcit);
|
||||
freep(&iot);
|
||||
|
||||
TessDeleteText(word);
|
||||
} while (TessPageIteratorNext((TessPageIterator *)ri,level));
|
||||
|
||||
//Write closing </font> at the end of the line
|
||||
@ -473,7 +473,7 @@ char* ocr_bitmap(void* arg, png_color *palette,png_byte *alpha, unsigned char* i
|
||||
{
|
||||
char *substr = "</font>";
|
||||
char *text_out_copy = strdup(text_out);
|
||||
free(text_out);
|
||||
TessDeleteText(text_out);
|
||||
text_out = malloc(strlen(text_out_copy)+strlen(substr)+1);
|
||||
memset(text_out,0,strlen(text_out_copy)+strlen(substr)+1);
|
||||
char *str = strtok(text_out_copy,"\n");
|
||||
|
Loading…
Reference in New Issue
Block a user