Compare commits

...

8 Commits

35 changed files with 1787 additions and 462 deletions

Binary file not shown.

View File

@ -496,7 +496,7 @@ Continue to clear?</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.ui" line="100"/>
<location filename="dialog_export.ui" line="102"/>
<source>
Input is not valid.
Page range will be &quot;Chosen Pages&quot;.
@ -505,50 +505,80 @@ Page range will be &quot;Chosen Pages&quot;.
</translation>
</message>
<message>
<location filename="dialog_export.ui" line="155"/>
<location filename="dialog_export.ui" line="144"/>
<source>Ocr type:</source>
<translation>OCR类型</translation>
</message>
<message>
<location filename="dialog_export.ui" line="174"/>
<source>Compression Option</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.ui" line="25"/>
<location filename="dialog_export.ui" line="27"/>
<source>Page Range</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.ui" line="53"/>
<location filename="dialog_export.ui" line="55"/>
<source>Chosen Pages</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.ui" line="73"/>
<location filename="dialog_export.ui" line="75"/>
<source>All Pages</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.ui" line="33"/>
<location filename="dialog_export.ui" line="35"/>
<source>Nominate Pages(example:1,3,6 or 3-6)</source>
<translation>1,3,6 3-6</translation>
</message>
<message>
<location filename="dialog_export.ui" line="84"/>
<location filename="dialog_export.ui" line="86"/>
<source>Page:</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.ui" line="135"/>
<location filename="dialog_export.ui" line="137"/>
<source>Save as multipages (TIFF/PDF/OFD/GIF)</source>
<oldsource>Save as multipages (TIFF/PDF/OFD)</oldsource>
<translation>(TIFF/PDF/OFD/GIF)</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="145"/>
<location filename="dialog_export.cpp" line="316"/>
<location filename="dialog_export.cpp" line="327"/>
<location filename="dialog_export.cpp" line="337"/>
<location filename="dialog_export.cpp" line="348"/>
<source>Input is not valid.
Page range will be &apos;Chosen Pages&apos;.</source>
<translation>
</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>English</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Simplified Chinese</source>
<translation>()</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Traditional Chinese</source>
<translation>()</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Japanese</source>
<translation></translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Korean</source>
<translation></translation>
</message>
</context>
<context>
<name>Dialog_ExportImageFile</name>
@ -563,17 +593,17 @@ Page range will be &apos;Chosen Pages&apos;.</source>
<translation></translation>
</message>
<message>
<location filename="dialog_exportimagefile.cpp" line="346"/>
<location filename="dialog_exportimagefile.cpp" line="347"/>
<source>export failed: </source>
<translation> </translation>
</message>
<message>
<location filename="dialog_exportimagefile.cpp" line="347"/>
<location filename="dialog_exportimagefile.cpp" line="348"/>
<source>tip</source>
<translation></translation>
</message>
<message>
<location filename="dialog_exportimagefile.cpp" line="346"/>
<location filename="dialog_exportimagefile.cpp" line="347"/>
<source>export succeed</source>
<translation></translation>
</message>
@ -1556,6 +1586,36 @@ Please make sure the two passwords are the same.</source>
<source>Use subfolder based on current date</source>
<translation>使</translation>
</message>
<message>
<location filename="dialog_saveas.ui" line="39"/>
<source>Ocr type:</source>
<translation>OCR类型</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>English</source>
<translation></translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Simplified Chinese</source>
<translation>()</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Traditional Chinese</source>
<translation>()</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Japanese</source>
<translation></translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Korean</source>
<translation></translation>
</message>
</context>
<context>
<name>Dialog_SaveMessageBox</name>
@ -2262,8 +2322,8 @@ bug description:
<location filename="mainwindow.cpp" line="693"/>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1745"/>
<location filename="mainwindow.cpp" line="2525"/>
<location filename="mainwindow.cpp" line="2971"/>
<location filename="mainwindow.cpp" line="2535"/>
<location filename="mainwindow.cpp" line="2986"/>
<source>Question</source>
<translation></translation>
</message>
@ -2325,12 +2385,12 @@ Do you want to clear?</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1941"/>
<location filename="mainwindow.cpp" line="1951"/>
<source>Open images</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1952"/>
<location filename="mainwindow.cpp" line="1962"/>
<source>Insert images</source>
<translation></translation>
</message>
@ -2360,14 +2420,14 @@ Do you want to clear?</source>
<message>
<location filename="mainwindow.cpp" line="1359"/>
<location filename="mainwindow.cpp" line="1360"/>
<location filename="mainwindow.cpp" line="3287"/>
<location filename="mainwindow.cpp" line="3288"/>
<location filename="mainwindow.cpp" line="3365"/>
<location filename="mainwindow.cpp" line="3366"/>
<location filename="mainwindow.cpp" line="3459"/>
<location filename="mainwindow.cpp" line="3460"/>
<location filename="mainwindow.cpp" line="3552"/>
<location filename="mainwindow.cpp" line="3553"/>
<location filename="mainwindow.cpp" line="3302"/>
<location filename="mainwindow.cpp" line="3303"/>
<location filename="mainwindow.cpp" line="3380"/>
<location filename="mainwindow.cpp" line="3381"/>
<location filename="mainwindow.cpp" line="3474"/>
<location filename="mainwindow.cpp" line="3475"/>
<location filename="mainwindow.cpp" line="3567"/>
<location filename="mainwindow.cpp" line="3568"/>
<source>Please wake up the device manually</source>
<translation></translation>
</message>
@ -2387,216 +2447,216 @@ Do you want to clear?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2163"/>
<location filename="mainwindow.cpp" line="2228"/>
<location filename="mainwindow.cpp" line="2310"/>
<location filename="mainwindow.cpp" line="2173"/>
<location filename="mainwindow.cpp" line="2238"/>
<location filename="mainwindow.cpp" line="2320"/>
<source>save succeed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2175"/>
<location filename="mainwindow.cpp" line="2322"/>
<location filename="mainwindow.cpp" line="2185"/>
<location filename="mainwindow.cpp" line="2332"/>
<source>find savePath in thumbnail</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2346"/>
<location filename="mainwindow.cpp" line="2356"/>
<source>Please select at least one picture before export</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>File name</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>File path</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>File size</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>Creation date/time</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>Modified date/time</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>Accessed date/time</source>
<translation>访</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Format</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Width</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Height</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>depth</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Color model</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>DPI</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Print size</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Frame</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>None</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>Mono</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>Gray</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>Color</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2474"/>
<location filename="mainwindow.cpp" line="2484"/>
<source>Not supported</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2502"/>
<location filename="mainwindow.cpp" line="2512"/>
<source>Warning</source>
<translation>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2502"/>
<location filename="mainwindow.cpp" line="2512"/>
<source>Device is Running!
Please finish scanning first.</source>
<translation>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3929"/>
<location filename="mainwindow.cpp" line="3944"/>
<source>cache path folder limit:%1</source>
<translation>访%1
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3933"/>
<location filename="mainwindow.cpp" line="3948"/>
<source>aquireinto folder limit:%1</source>
<translation>访%1
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4085"/>
<location filename="mainwindow.cpp" line="4100"/>
<source>Image processing failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4089"/>
<location filename="mainwindow.cpp" line="4104"/>
<source>Ocr init failed</source>
<translation>OCR初始化错误</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4093"/>
<location filename="mainwindow.cpp" line="4108"/>
<source>Ocr failed</source>
<translation>OCR错误</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4097"/>
<location filename="mainwindow.cpp" line="4112"/>
<source>File does not exist</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4101"/>
<location filename="mainwindow.cpp" line="4116"/>
<source>Failed to load dynamic library</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4105"/>
<location filename="mainwindow.cpp" line="4120"/>
<source>File data error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4109"/>
<location filename="mainwindow.cpp" line="4124"/>
<source>Image format processing error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4113"/>
<location filename="mainwindow.cpp" line="4128"/>
<source>Out of memory</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4117"/>
<location filename="mainwindow.cpp" line="4132"/>
<source>Failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4401"/>
<location filename="mainwindow.cpp" line="4420"/>
<location filename="mainwindow.cpp" line="4416"/>
<location filename="mainwindow.cpp" line="4435"/>
<source>The language switch is successful and takes effect the next time the software is started!</source>
<translation>!</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4458"/>
<location filename="mainwindow.cpp" line="4473"/>
<source>Are you sure to delete selected file?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1370"/>
<location filename="mainwindow.cpp" line="1371"/>
<location filename="mainwindow.cpp" line="3298"/>
<location filename="mainwindow.cpp" line="3299"/>
<location filename="mainwindow.cpp" line="3376"/>
<location filename="mainwindow.cpp" line="3377"/>
<location filename="mainwindow.cpp" line="3470"/>
<location filename="mainwindow.cpp" line="3471"/>
<location filename="mainwindow.cpp" line="3563"/>
<location filename="mainwindow.cpp" line="3564"/>
<location filename="mainwindow.cpp" line="3313"/>
<location filename="mainwindow.cpp" line="3314"/>
<location filename="mainwindow.cpp" line="3391"/>
<location filename="mainwindow.cpp" line="3392"/>
<location filename="mainwindow.cpp" line="3485"/>
<location filename="mainwindow.cpp" line="3486"/>
<location filename="mainwindow.cpp" line="3578"/>
<location filename="mainwindow.cpp" line="3579"/>
<source>already waked up device</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3705"/>
<location filename="mainwindow.cpp" line="3720"/>
<source>be ready</source>
<translation></translation>
</message>
@ -2606,7 +2666,7 @@ Please finish scanning first.</source>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4081"/>
<location filename="mainwindow.cpp" line="4096"/>
<source>Insufficient access rights</source>
<translation>访</translation>
</message>
@ -2619,46 +2679,46 @@ Please finish scanning first.</source>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4235"/>
<location filename="mainwindow.cpp" line="4250"/>
<source>Are you sure to close </source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4235"/>
<location filename="mainwindow.cpp" line="4250"/>
<source> ?</source>
<translation>?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4243"/>
<location filename="mainwindow.cpp" line="4244"/>
<location filename="mainwindow.cpp" line="4258"/>
<location filename="mainwindow.cpp" line="4259"/>
<source>close </source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4339"/>
<location filename="mainwindow.cpp" line="4354"/>
<source>tip</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4339"/>
<location filename="mainwindow.cpp" line="4354"/>
<source>Other versions not available</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4362"/>
<location filename="mainwindow.cpp" line="4380"/>
<location filename="mainwindow.cpp" line="4377"/>
<location filename="mainwindow.cpp" line="4395"/>
<source>The device does not support this operation</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4364"/>
<location filename="mainwindow.cpp" line="4382"/>
<location filename="mainwindow.cpp" line="4379"/>
<location filename="mainwindow.cpp" line="4397"/>
<source>IO error</source>
<translation>IO错误</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3898"/>
<location filename="mainwindow.cpp" line="3936"/>
<location filename="mainwindow.cpp" line="3913"/>
<location filename="mainwindow.cpp" line="3951"/>
<source>error</source>
<translation></translation>
</message>
@ -2673,17 +2733,17 @@ Continue to close?</source>
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2972"/>
<location filename="mainwindow.cpp" line="2987"/>
<source>Sure to sign out administrator account?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3109"/>
<location filename="mainwindow.cpp" line="3124"/>
<source>confirm the operation</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3110"/>
<location filename="mainwindow.cpp" line="3125"/>
<source>Are you sure to clear the rollor acount?</source>
<translation></translation>
</message>
@ -2692,36 +2752,36 @@ Continue to close?</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3154"/>
<location filename="mainwindow.cpp" line="3206"/>
<location filename="mainwindow.cpp" line="3169"/>
<location filename="mainwindow.cpp" line="3221"/>
<source>&lt;p&gt;%1: &lt;a href=&apos;%2&apos;&gt;%3&lt;/a&gt;</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3156"/>
<location filename="mainwindow.cpp" line="3208"/>
<location filename="mainwindow.cpp" line="3171"/>
<location filename="mainwindow.cpp" line="3223"/>
<source>&lt;p&gt;%1: %2</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3210"/>
<location filename="mainwindow.cpp" line="3225"/>
<source>roller number</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3669"/>
<location filename="mainwindow.cpp" line="3684"/>
<source>open scanner </source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3670"/>
<location filename="mainwindow.cpp" line="4201"/>
<location filename="mainwindow.cpp" line="3685"/>
<location filename="mainwindow.cpp" line="4216"/>
<source>app name</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3700"/>
<location filename="mainwindow.cpp" line="4219"/>
<location filename="mainwindow.cpp" line="3715"/>
<location filename="mainwindow.cpp" line="4234"/>
<source>success</source>
<translation></translation>
</message>
@ -2738,22 +2798,22 @@ Continue to close?</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3709"/>
<location filename="mainwindow.cpp" line="4224"/>
<location filename="mainwindow.cpp" line="3724"/>
<location filename="mainwindow.cpp" line="4239"/>
<source>failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="975"/>
<location filename="mainwindow.cpp" line="1039"/>
<location filename="mainwindow.cpp" line="3738"/>
<location filename="mainwindow.cpp" line="3753"/>
<source>warning</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="971"/>
<location filename="mainwindow.cpp" line="1035"/>
<location filename="mainwindow.cpp" line="3734"/>
<location filename="mainwindow.cpp" line="3749"/>
<source>the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.</source>
<translation>,
</translation>
@ -2763,7 +2823,7 @@ Continue to close?</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4216"/>
<location filename="mainwindow.cpp" line="4231"/>
<source>apply setting</source>
<translation></translation>
</message>
@ -2771,18 +2831,18 @@ Continue to close?</source>
<location filename="mainwindow.cpp" line="1345"/>
<location filename="mainwindow.cpp" line="1346"/>
<location filename="mainwindow.cpp" line="1347"/>
<location filename="mainwindow.cpp" line="3273"/>
<location filename="mainwindow.cpp" line="3274"/>
<location filename="mainwindow.cpp" line="3275"/>
<location filename="mainwindow.cpp" line="3351"/>
<location filename="mainwindow.cpp" line="3352"/>
<location filename="mainwindow.cpp" line="3353"/>
<location filename="mainwindow.cpp" line="3445"/>
<location filename="mainwindow.cpp" line="3446"/>
<location filename="mainwindow.cpp" line="3447"/>
<location filename="mainwindow.cpp" line="3538"/>
<location filename="mainwindow.cpp" line="3539"/>
<location filename="mainwindow.cpp" line="3540"/>
<location filename="mainwindow.cpp" line="3288"/>
<location filename="mainwindow.cpp" line="3289"/>
<location filename="mainwindow.cpp" line="3290"/>
<location filename="mainwindow.cpp" line="3366"/>
<location filename="mainwindow.cpp" line="3367"/>
<location filename="mainwindow.cpp" line="3368"/>
<location filename="mainwindow.cpp" line="3460"/>
<location filename="mainwindow.cpp" line="3461"/>
<location filename="mainwindow.cpp" line="3462"/>
<location filename="mainwindow.cpp" line="3553"/>
<location filename="mainwindow.cpp" line="3554"/>
<location filename="mainwindow.cpp" line="3555"/>
<source>start failed</source>
<translation></translation>
</message>
@ -2931,25 +2991,25 @@ Continue to close?</source>
<location filename="mainwindow.cpp" line="1135"/>
<location filename="mainwindow.cpp" line="1241"/>
<location filename="mainwindow.cpp" line="1242"/>
<location filename="mainwindow.cpp" line="2168"/>
<location filename="mainwindow.cpp" line="2169"/>
<location filename="mainwindow.cpp" line="2170"/>
<location filename="mainwindow.cpp" line="2233"/>
<location filename="mainwindow.cpp" line="2234"/>
<location filename="mainwindow.cpp" line="2235"/>
<location filename="mainwindow.cpp" line="2315"/>
<location filename="mainwindow.cpp" line="2316"/>
<location filename="mainwindow.cpp" line="2317"/>
<location filename="mainwindow.cpp" line="2178"/>
<location filename="mainwindow.cpp" line="2179"/>
<location filename="mainwindow.cpp" line="2180"/>
<location filename="mainwindow.cpp" line="2243"/>
<location filename="mainwindow.cpp" line="2244"/>
<location filename="mainwindow.cpp" line="2245"/>
<location filename="mainwindow.cpp" line="2325"/>
<location filename="mainwindow.cpp" line="2326"/>
<location filename="mainwindow.cpp" line="2327"/>
<source>save image doc failed: </source>
<translation> </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3899"/>
<location filename="mainwindow.cpp" line="3914"/>
<source>start failed!</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2526"/>
<location filename="mainwindow.cpp" line="2536"/>
<source>There are pictures that have not been saved.
Are you sure to close?</source>
<translation></translation>
@ -2960,63 +3020,63 @@ Are you sure to close?</source>
<translation> : %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2163"/>
<location filename="mainwindow.cpp" line="2168"/>
<location filename="mainwindow.cpp" line="2175"/>
<location filename="mainwindow.cpp" line="2228"/>
<location filename="mainwindow.cpp" line="2233"/>
<location filename="mainwindow.cpp" line="2310"/>
<location filename="mainwindow.cpp" line="2315"/>
<location filename="mainwindow.cpp" line="2322"/>
<location filename="mainwindow.cpp" line="2346"/>
<location filename="mainwindow.cpp" line="2537"/>
<location filename="mainwindow.cpp" line="4400"/>
<location filename="mainwindow.cpp" line="4419"/>
<location filename="mainwindow.cpp" line="4458"/>
<location filename="mainwindow.cpp" line="2173"/>
<location filename="mainwindow.cpp" line="2178"/>
<location filename="mainwindow.cpp" line="2185"/>
<location filename="mainwindow.cpp" line="2238"/>
<location filename="mainwindow.cpp" line="2243"/>
<location filename="mainwindow.cpp" line="2320"/>
<location filename="mainwindow.cpp" line="2325"/>
<location filename="mainwindow.cpp" line="2332"/>
<location filename="mainwindow.cpp" line="2356"/>
<location filename="mainwindow.cpp" line="2547"/>
<location filename="mainwindow.cpp" line="4415"/>
<location filename="mainwindow.cpp" line="4434"/>
<location filename="mainwindow.cpp" line="4473"/>
<source>tips</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2538"/>
<location filename="mainwindow.cpp" line="2548"/>
<source>Are you sure to close?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3023"/>
<location filename="mainwindow.cpp" line="3038"/>
<source>confirm operation</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3024"/>
<location filename="mainwindow.cpp" line="3039"/>
<source>are you sure to clear the roller count?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3035"/>
<location filename="mainwindow.cpp" line="3039"/>
<location filename="mainwindow.cpp" line="3128"/>
<location filename="mainwindow.cpp" line="3050"/>
<location filename="mainwindow.cpp" line="3054"/>
<location filename="mainwindow.cpp" line="3143"/>
<source>hint</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3035"/>
<location filename="mainwindow.cpp" line="3121"/>
<location filename="mainwindow.cpp" line="3050"/>
<location filename="mainwindow.cpp" line="3136"/>
<source>Roller scanned count has been set to 0.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3039"/>
<location filename="mainwindow.cpp" line="3126"/>
<location filename="mainwindow.cpp" line="3054"/>
<location filename="mainwindow.cpp" line="3141"/>
<source>Roller scanned count reset failed.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3098"/>
<location filename="mainwindow.cpp" line="3113"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3098"/>
<location filename="mainwindow.cpp" line="3113"/>
<source>Document missing! It would be deleted or renamed.</source>
<translation></translation>
</message>
@ -3057,21 +3117,21 @@ Are you sure to close?</source>
<translation type="vanished">&lt;p&gt;%1&lt;/p&gt;&lt;p&gt;: %2&lt;br&gt;: &amp;#169; %3&lt;/p&gt;&lt;p&gt;%4%5%6%7%8%9&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3149"/>
<location filename="mainwindow.cpp" line="3200"/>
<location filename="mainwindow.cpp" line="3164"/>
<location filename="mainwindow.cpp" line="3215"/>
<source>about %1</source>
<translation> %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3150"/>
<location filename="mainwindow.cpp" line="3201"/>
<location filename="mainwindow.cpp" line="3165"/>
<location filename="mainwindow.cpp" line="3216"/>
<source>&lt;p&gt;Version: %1&lt;/p&gt;</source>
<oldsource>&lt;p&gt;: %1&lt;/p&gt;</oldsource>
<translation>&lt;p&gt; %1&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3158"/>
<location filename="mainwindow.cpp" line="3202"/>
<location filename="mainwindow.cpp" line="3173"/>
<location filename="mainwindow.cpp" line="3217"/>
<source>&lt;p&gt;CopyRight: &amp;#169; %1&lt;/p&gt;</source>
<oldsource>&lt;p&gt;: &amp;#169; %1&lt;/p&gt;</oldsource>
<translation>&lt;p&gt; &amp;#169; %1&lt;/p&gt;</translation>

Binary file not shown.

View File

@ -470,32 +470,32 @@ Continue clearing?</translation>
<translation>Export</translation>
</message>
<message>
<location filename="dialog_export.ui" line="25"/>
<location filename="dialog_export.ui" line="27"/>
<source>Page Range</source>
<translation>Page range</translation>
</message>
<message>
<location filename="dialog_export.ui" line="33"/>
<location filename="dialog_export.ui" line="35"/>
<source>Nominate Pages(example:1,3,6 or 3-6)</source>
<translation>Specific page number (For example:1,3,6 or 3-6)</translation>
</message>
<message>
<location filename="dialog_export.ui" line="53"/>
<location filename="dialog_export.ui" line="55"/>
<source>Chosen Pages</source>
<translation>Selected pages</translation>
</message>
<message>
<location filename="dialog_export.ui" line="73"/>
<location filename="dialog_export.ui" line="75"/>
<source>All Pages</source>
<translation>All pages</translation>
</message>
<message>
<location filename="dialog_export.ui" line="84"/>
<location filename="dialog_export.ui" line="86"/>
<source>Page:</source>
<translation>Page number:</translation>
</message>
<message>
<location filename="dialog_export.ui" line="100"/>
<location filename="dialog_export.ui" line="102"/>
<source>
Input is not valid.
Page range will be &quot;Chosen Pages&quot;.
@ -504,12 +504,17 @@ Page range will be &quot;Chosen Pages&quot;.
The page range will be selected pages</translation>
</message>
<message>
<location filename="dialog_export.ui" line="135"/>
<location filename="dialog_export.ui" line="137"/>
<source>Save as multipages (TIFF/PDF/OFD/GIF)</source>
<translation>Save multiple pages(TIFF/PDF/OFD/GIF)</translation>
</message>
<message>
<location filename="dialog_export.ui" line="155"/>
<location filename="dialog_export.ui" line="144"/>
<source>Ocr type:</source>
<translation>OCR type:</translation>
</message>
<message>
<location filename="dialog_export.ui" line="174"/>
<source>Compression Option</source>
<translation>Compression options</translation>
</message>
@ -523,13 +528,38 @@ The page range will be “selected pages”</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="145"/>
<location filename="dialog_export.cpp" line="316"/>
<location filename="dialog_export.cpp" line="327"/>
<location filename="dialog_export.cpp" line="337"/>
<location filename="dialog_export.cpp" line="348"/>
<source>Input is not valid.
Page range will be &apos;Chosen Pages&apos;.</source>
<translation>Input invalid.
The page range will be selected pages</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>English</source>
<translation>English</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Simplified Chinese</source>
<translation>Simplified Chinese</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Traditional Chinese</source>
<translation>Traditional Chinese</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Japanese</source>
<translation>Japanese</translation>
</message>
<message>
<location filename="dialog_export.cpp" line="153"/>
<source>Korean</source>
<translation>Korean</translation>
</message>
</context>
<context>
<name>Dialog_ExportImageFile</name>
@ -544,17 +574,17 @@ The page range will be “selected pages”</translation>
<translation>Stop exporting</translation>
</message>
<message>
<location filename="dialog_exportimagefile.cpp" line="346"/>
<location filename="dialog_exportimagefile.cpp" line="347"/>
<source>export succeed</source>
<translation>Export completed</translation>
</message>
<message>
<location filename="dialog_exportimagefile.cpp" line="346"/>
<location filename="dialog_exportimagefile.cpp" line="347"/>
<source>export failed: </source>
<translation>Export failed: </translation>
</message>
<message>
<location filename="dialog_exportimagefile.cpp" line="347"/>
<location filename="dialog_exportimagefile.cpp" line="348"/>
<source>tip</source>
<translation>Prompt</translation>
</message>
@ -1476,6 +1506,36 @@ Please make sure the two passwords are the same.</source>
<source>Use subfolder based on current date</source>
<translation>Create a subfolder using the current date</translation>
</message>
<message>
<location filename="dialog_saveas.ui" line="39"/>
<source>Ocr type:</source>
<translation>OCR type:</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>English</source>
<translation>English</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Simplified Chinese</source>
<translation>Simplified Chinese</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Traditional Chinese</source>
<translation>Traditional Chinese</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Japanese</source>
<translation>Japanese</translation>
</message>
<message>
<location filename="dialog_saveas.cpp" line="117"/>
<source>Korean</source>
<translation>Korean</translation>
</message>
</context>
<context>
<name>Dialog_SaveMessageBox</name>
@ -2195,8 +2255,8 @@ Please make sure the two passwords are the same.</source>
<location filename="mainwindow.cpp" line="693"/>
<location filename="mainwindow.cpp" line="1722"/>
<location filename="mainwindow.cpp" line="1745"/>
<location filename="mainwindow.cpp" line="2525"/>
<location filename="mainwindow.cpp" line="2971"/>
<location filename="mainwindow.cpp" line="2535"/>
<location filename="mainwindow.cpp" line="2986"/>
<source>Question</source>
<translation>Ask</translation>
</message>
@ -2249,7 +2309,7 @@ Please make sure the two passwords are the same.</source>
<message>
<location filename="mainwindow.cpp" line="971"/>
<location filename="mainwindow.cpp" line="1035"/>
<location filename="mainwindow.cpp" line="3734"/>
<location filename="mainwindow.cpp" line="3749"/>
<source>the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.</source>
<translation>Insufficient disk space for the current path.
Please reselect a path or clear disk space immediately.</translation>
@ -2257,7 +2317,7 @@ Please reselect a path or clear disk space immediately.</translation>
<message>
<location filename="mainwindow.cpp" line="975"/>
<location filename="mainwindow.cpp" line="1039"/>
<location filename="mainwindow.cpp" line="3738"/>
<location filename="mainwindow.cpp" line="3753"/>
<source>warning</source>
<translation>Warning</translation>
</message>
@ -2286,15 +2346,15 @@ Please reselect a path or clear disk space immediately.</translation>
<location filename="mainwindow.cpp" line="1135"/>
<location filename="mainwindow.cpp" line="1241"/>
<location filename="mainwindow.cpp" line="1242"/>
<location filename="mainwindow.cpp" line="2168"/>
<location filename="mainwindow.cpp" line="2169"/>
<location filename="mainwindow.cpp" line="2170"/>
<location filename="mainwindow.cpp" line="2233"/>
<location filename="mainwindow.cpp" line="2234"/>
<location filename="mainwindow.cpp" line="2235"/>
<location filename="mainwindow.cpp" line="2315"/>
<location filename="mainwindow.cpp" line="2316"/>
<location filename="mainwindow.cpp" line="2317"/>
<location filename="mainwindow.cpp" line="2178"/>
<location filename="mainwindow.cpp" line="2179"/>
<location filename="mainwindow.cpp" line="2180"/>
<location filename="mainwindow.cpp" line="2243"/>
<location filename="mainwindow.cpp" line="2244"/>
<location filename="mainwindow.cpp" line="2245"/>
<location filename="mainwindow.cpp" line="2325"/>
<location filename="mainwindow.cpp" line="2326"/>
<location filename="mainwindow.cpp" line="2327"/>
<source>save image doc failed: </source>
<translation>Failed to save image: </translation>
</message>
@ -2317,46 +2377,46 @@ Please reselect a path or clear disk space immediately.</translation>
<location filename="mainwindow.cpp" line="1345"/>
<location filename="mainwindow.cpp" line="1346"/>
<location filename="mainwindow.cpp" line="1347"/>
<location filename="mainwindow.cpp" line="3273"/>
<location filename="mainwindow.cpp" line="3274"/>
<location filename="mainwindow.cpp" line="3275"/>
<location filename="mainwindow.cpp" line="3351"/>
<location filename="mainwindow.cpp" line="3352"/>
<location filename="mainwindow.cpp" line="3353"/>
<location filename="mainwindow.cpp" line="3445"/>
<location filename="mainwindow.cpp" line="3446"/>
<location filename="mainwindow.cpp" line="3447"/>
<location filename="mainwindow.cpp" line="3538"/>
<location filename="mainwindow.cpp" line="3539"/>
<location filename="mainwindow.cpp" line="3540"/>
<location filename="mainwindow.cpp" line="3288"/>
<location filename="mainwindow.cpp" line="3289"/>
<location filename="mainwindow.cpp" line="3290"/>
<location filename="mainwindow.cpp" line="3366"/>
<location filename="mainwindow.cpp" line="3367"/>
<location filename="mainwindow.cpp" line="3368"/>
<location filename="mainwindow.cpp" line="3460"/>
<location filename="mainwindow.cpp" line="3461"/>
<location filename="mainwindow.cpp" line="3462"/>
<location filename="mainwindow.cpp" line="3553"/>
<location filename="mainwindow.cpp" line="3554"/>
<location filename="mainwindow.cpp" line="3555"/>
<source>start failed</source>
<translation>Failed to start</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1359"/>
<location filename="mainwindow.cpp" line="1360"/>
<location filename="mainwindow.cpp" line="3287"/>
<location filename="mainwindow.cpp" line="3288"/>
<location filename="mainwindow.cpp" line="3365"/>
<location filename="mainwindow.cpp" line="3366"/>
<location filename="mainwindow.cpp" line="3459"/>
<location filename="mainwindow.cpp" line="3460"/>
<location filename="mainwindow.cpp" line="3552"/>
<location filename="mainwindow.cpp" line="3553"/>
<location filename="mainwindow.cpp" line="3302"/>
<location filename="mainwindow.cpp" line="3303"/>
<location filename="mainwindow.cpp" line="3380"/>
<location filename="mainwindow.cpp" line="3381"/>
<location filename="mainwindow.cpp" line="3474"/>
<location filename="mainwindow.cpp" line="3475"/>
<location filename="mainwindow.cpp" line="3567"/>
<location filename="mainwindow.cpp" line="3568"/>
<source>Please wake up the device manually</source>
<translation>Please wake up the device manually</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1370"/>
<location filename="mainwindow.cpp" line="1371"/>
<location filename="mainwindow.cpp" line="3298"/>
<location filename="mainwindow.cpp" line="3299"/>
<location filename="mainwindow.cpp" line="3376"/>
<location filename="mainwindow.cpp" line="3377"/>
<location filename="mainwindow.cpp" line="3470"/>
<location filename="mainwindow.cpp" line="3471"/>
<location filename="mainwindow.cpp" line="3563"/>
<location filename="mainwindow.cpp" line="3564"/>
<location filename="mainwindow.cpp" line="3313"/>
<location filename="mainwindow.cpp" line="3314"/>
<location filename="mainwindow.cpp" line="3391"/>
<location filename="mainwindow.cpp" line="3392"/>
<location filename="mainwindow.cpp" line="3485"/>
<location filename="mainwindow.cpp" line="3486"/>
<location filename="mainwindow.cpp" line="3578"/>
<location filename="mainwindow.cpp" line="3579"/>
<source>already waked up device</source>
<translation>Device is awake</translation>
</message>
@ -2393,230 +2453,230 @@ Do you want to clear?</source>
Clear?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1941"/>
<location filename="mainwindow.cpp" line="1951"/>
<source>Open images</source>
<translation>Open image</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1952"/>
<location filename="mainwindow.cpp" line="1962"/>
<source>Insert images</source>
<translation>Insert image</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2163"/>
<location filename="mainwindow.cpp" line="2168"/>
<location filename="mainwindow.cpp" line="2175"/>
<location filename="mainwindow.cpp" line="2228"/>
<location filename="mainwindow.cpp" line="2233"/>
<location filename="mainwindow.cpp" line="2310"/>
<location filename="mainwindow.cpp" line="2315"/>
<location filename="mainwindow.cpp" line="2322"/>
<location filename="mainwindow.cpp" line="2346"/>
<location filename="mainwindow.cpp" line="2537"/>
<location filename="mainwindow.cpp" line="4400"/>
<location filename="mainwindow.cpp" line="4419"/>
<location filename="mainwindow.cpp" line="4458"/>
<location filename="mainwindow.cpp" line="2173"/>
<location filename="mainwindow.cpp" line="2178"/>
<location filename="mainwindow.cpp" line="2185"/>
<location filename="mainwindow.cpp" line="2238"/>
<location filename="mainwindow.cpp" line="2243"/>
<location filename="mainwindow.cpp" line="2320"/>
<location filename="mainwindow.cpp" line="2325"/>
<location filename="mainwindow.cpp" line="2332"/>
<location filename="mainwindow.cpp" line="2356"/>
<location filename="mainwindow.cpp" line="2547"/>
<location filename="mainwindow.cpp" line="4415"/>
<location filename="mainwindow.cpp" line="4434"/>
<location filename="mainwindow.cpp" line="4473"/>
<source>tips</source>
<translation>prompt</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2163"/>
<location filename="mainwindow.cpp" line="2228"/>
<location filename="mainwindow.cpp" line="2310"/>
<location filename="mainwindow.cpp" line="2173"/>
<location filename="mainwindow.cpp" line="2238"/>
<location filename="mainwindow.cpp" line="2320"/>
<source>save succeed</source>
<translation>Saved successfully</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2175"/>
<location filename="mainwindow.cpp" line="2322"/>
<location filename="mainwindow.cpp" line="2185"/>
<location filename="mainwindow.cpp" line="2332"/>
<source>find savePath in thumbnail</source>
<translation>Image name already exists in the list</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2346"/>
<location filename="mainwindow.cpp" line="2356"/>
<source>Please select at least one picture before export</source>
<translation>Please select at least one image and then export</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>File name</source>
<translation>File name</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>File path</source>
<translation>File path</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>File size</source>
<translation>File size</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>Creation date/time</source>
<translation>Creation time</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>Modified date/time</source>
<translation>Modification time</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2413"/>
<location filename="mainwindow.cpp" line="2423"/>
<source>Accessed date/time</source>
<translation>Access time</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Format</source>
<translation>Format</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Width</source>
<translation>Width</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Height</source>
<translation>Height</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>depth</source>
<translation>Depth</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Color model</source>
<translation>Color mode</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>DPI</source>
<translation>Pixels per inch</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Print size</source>
<translation>Print size</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2456"/>
<location filename="mainwindow.cpp" line="2466"/>
<source>Frame</source>
<translation>Frame</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>None</source>
<translation>None</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>Mono</source>
<translation>Black and white</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>Gray</source>
<translation>Gray scale</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2470"/>
<location filename="mainwindow.cpp" line="2480"/>
<source>Color</source>
<translation>Color</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2474"/>
<location filename="mainwindow.cpp" line="2484"/>
<source>Not supported</source>
<translation>Not supported</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2502"/>
<location filename="mainwindow.cpp" line="2512"/>
<source>Warning</source>
<translation>Warning</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2502"/>
<location filename="mainwindow.cpp" line="2512"/>
<source>Device is Running!
Please finish scanning first.</source>
<translation>Device is currently running!
Please stop scanning first.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2526"/>
<location filename="mainwindow.cpp" line="2536"/>
<source>There are pictures that have not been saved.
Are you sure to close?</source>
<translation>There are unsaved images; are you sure you want to close?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2538"/>
<location filename="mainwindow.cpp" line="2548"/>
<source>Are you sure to close?</source>
<translation>Are you sure you want to close?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="2972"/>
<location filename="mainwindow.cpp" line="2987"/>
<source>Sure to sign out administrator account?</source>
<translation>Are you sure you want to log out of the administrator account?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3023"/>
<location filename="mainwindow.cpp" line="3038"/>
<source>confirm operation</source>
<translation>Confirm operation</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3024"/>
<location filename="mainwindow.cpp" line="3039"/>
<source>are you sure to clear the roller count?</source>
<translation>Are you sure you want to clear the roller count?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3035"/>
<location filename="mainwindow.cpp" line="3039"/>
<location filename="mainwindow.cpp" line="3128"/>
<location filename="mainwindow.cpp" line="3050"/>
<location filename="mainwindow.cpp" line="3054"/>
<location filename="mainwindow.cpp" line="3143"/>
<source>hint</source>
<translation>Prompt</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3035"/>
<location filename="mainwindow.cpp" line="3121"/>
<location filename="mainwindow.cpp" line="3050"/>
<location filename="mainwindow.cpp" line="3136"/>
<source>Roller scanned count has been set to 0.</source>
<translation>Roller count reset to zero.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3039"/>
<location filename="mainwindow.cpp" line="3126"/>
<location filename="mainwindow.cpp" line="3054"/>
<location filename="mainwindow.cpp" line="3141"/>
<source>Roller scanned count reset failed.</source>
<translation>Failed to reset roller count.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3098"/>
<location filename="mainwindow.cpp" line="3113"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3098"/>
<location filename="mainwindow.cpp" line="3113"/>
<source>Document missing! It would be deleted or renamed.</source>
<translation>File lost! File may be deleted or renamed.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3109"/>
<location filename="mainwindow.cpp" line="3124"/>
<source>confirm the operation</source>
<translation>Confirm operation</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3110"/>
<location filename="mainwindow.cpp" line="3125"/>
<source>Are you sure to clear the rollor acount?</source>
<translation>Are you sure you want to clear the roller count?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3929"/>
<location filename="mainwindow.cpp" line="3944"/>
<source>cache path folder limit:%1</source>
<translation>Unable to access the current path:%1
Please try to log in to the administrator account in the [User] menu and go to the [Cache settings] to change the cache path.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3933"/>
<location filename="mainwindow.cpp" line="3948"/>
<source>aquireinto folder limit:%1</source>
<translation>Unable to access the current path:%1
Please try to change the cache path in [Scan to].</translation>
@ -2630,76 +2690,76 @@ Please try to change the cache path in [Scan to].</translation>
<translation type="vanished">&lt;p&gt;%1&lt;/p&gt;&lt;p&gt;Version: %2&lt;br&gt;Copyright: &amp;#169; %3&lt;/p&gt;&lt;p&gt;%4%5%6%7%8%9&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3149"/>
<location filename="mainwindow.cpp" line="3200"/>
<location filename="mainwindow.cpp" line="3164"/>
<location filename="mainwindow.cpp" line="3215"/>
<source>about %1</source>
<translation>About %1</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3150"/>
<location filename="mainwindow.cpp" line="3201"/>
<location filename="mainwindow.cpp" line="3165"/>
<location filename="mainwindow.cpp" line="3216"/>
<source>&lt;p&gt;Version: %1&lt;/p&gt;</source>
<translation>&lt;p&gt;Version: %1&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3158"/>
<location filename="mainwindow.cpp" line="3202"/>
<location filename="mainwindow.cpp" line="3173"/>
<location filename="mainwindow.cpp" line="3217"/>
<source>&lt;p&gt;CopyRight: &amp;#169; %1&lt;/p&gt;</source>
<translation>&lt;p&gt;Copyright: &amp;#169; %1&lt;/p&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3154"/>
<location filename="mainwindow.cpp" line="3206"/>
<location filename="mainwindow.cpp" line="3169"/>
<location filename="mainwindow.cpp" line="3221"/>
<source>&lt;p&gt;%1: &lt;a href=&apos;%2&apos;&gt;%3&lt;/a&gt;</source>
<translation>&lt;p&gt;%1: &lt;a href=&apos;%2&apos;&gt;%3&lt;/a&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3156"/>
<location filename="mainwindow.cpp" line="3208"/>
<location filename="mainwindow.cpp" line="3171"/>
<location filename="mainwindow.cpp" line="3223"/>
<source>&lt;p&gt;%1: %2</source>
<translation>&lt;p&gt;%1: %2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3210"/>
<location filename="mainwindow.cpp" line="3225"/>
<source>roller number</source>
<translation>Number of rollers</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3669"/>
<location filename="mainwindow.cpp" line="3684"/>
<source>open scanner </source>
<translation>Open scanner </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3670"/>
<location filename="mainwindow.cpp" line="4201"/>
<location filename="mainwindow.cpp" line="3685"/>
<location filename="mainwindow.cpp" line="4216"/>
<source>app name</source>
<translation>HUAGOSCAN scanning software</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3700"/>
<location filename="mainwindow.cpp" line="4219"/>
<location filename="mainwindow.cpp" line="3715"/>
<location filename="mainwindow.cpp" line="4234"/>
<source>success</source>
<translation>successfully</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3705"/>
<location filename="mainwindow.cpp" line="3720"/>
<source>be ready</source>
<translation>Ready</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3709"/>
<location filename="mainwindow.cpp" line="4224"/>
<location filename="mainwindow.cpp" line="3724"/>
<location filename="mainwindow.cpp" line="4239"/>
<source>failed</source>
<translation>failed</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3898"/>
<location filename="mainwindow.cpp" line="3936"/>
<location filename="mainwindow.cpp" line="3913"/>
<location filename="mainwindow.cpp" line="3951"/>
<source>error</source>
<translation>Error</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3899"/>
<location filename="mainwindow.cpp" line="3914"/>
<source>start failed!</source>
<translation>Failed to start!</translation>
</message>
@ -2709,106 +2769,106 @@ Please try to change the cache path in [Scan to].</translation>
Please go to Scan to and change the accessible scan folder and then perform the scan.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4081"/>
<location filename="mainwindow.cpp" line="4096"/>
<source>Insufficient access rights</source>
<translation>Insufficient file access permissions</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4085"/>
<location filename="mainwindow.cpp" line="4100"/>
<source>Image processing failed</source>
<translation>Image processing failed</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4089"/>
<location filename="mainwindow.cpp" line="4104"/>
<source>Ocr init failed</source>
<translation>OCR initialization error</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4093"/>
<location filename="mainwindow.cpp" line="4108"/>
<source>Ocr failed</source>
<translation>OCR failed</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4097"/>
<location filename="mainwindow.cpp" line="4112"/>
<source>File does not exist</source>
<translation>File does not exist</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4101"/>
<location filename="mainwindow.cpp" line="4116"/>
<source>Failed to load dynamic library</source>
<translation>Failed to load dynamic library</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4105"/>
<location filename="mainwindow.cpp" line="4120"/>
<source>File data error</source>
<translation>File data error</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4109"/>
<location filename="mainwindow.cpp" line="4124"/>
<source>Image format processing error</source>
<translation>Image format processing error</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4113"/>
<location filename="mainwindow.cpp" line="4128"/>
<source>Out of memory</source>
<translation>Insufficient memory</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4117"/>
<location filename="mainwindow.cpp" line="4132"/>
<source>Failed</source>
<translation>Failed</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4216"/>
<location filename="mainwindow.cpp" line="4231"/>
<source>apply setting</source>
<translation>Apply configuration</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4235"/>
<location filename="mainwindow.cpp" line="4250"/>
<source>Are you sure to close </source>
<translation>Are you sure you want to disconnect device:</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4235"/>
<location filename="mainwindow.cpp" line="4250"/>
<source> ?</source>
<translation>?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4243"/>
<location filename="mainwindow.cpp" line="4244"/>
<location filename="mainwindow.cpp" line="4258"/>
<location filename="mainwindow.cpp" line="4259"/>
<source>close </source>
<translation>Close </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4339"/>
<location filename="mainwindow.cpp" line="4354"/>
<source>tip</source>
<translation>Prompt</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4339"/>
<location filename="mainwindow.cpp" line="4354"/>
<source>Other versions not available</source>
<translation>No other versions obtained</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4362"/>
<location filename="mainwindow.cpp" line="4380"/>
<location filename="mainwindow.cpp" line="4377"/>
<location filename="mainwindow.cpp" line="4395"/>
<source>The device does not support this operation</source>
<translation>Device does not support this operation</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4364"/>
<location filename="mainwindow.cpp" line="4382"/>
<location filename="mainwindow.cpp" line="4379"/>
<location filename="mainwindow.cpp" line="4397"/>
<source>IO error</source>
<translation>IO error</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4401"/>
<location filename="mainwindow.cpp" line="4420"/>
<location filename="mainwindow.cpp" line="4416"/>
<location filename="mainwindow.cpp" line="4435"/>
<source>The language switch is successful and takes effect the next time the software is started!</source>
<translation>The language switch is successful and takes effect the next time the software is started!</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4458"/>
<location filename="mainwindow.cpp" line="4473"/>
<source>Are you sure to delete selected file?</source>
<translation>Are you sure to delete the selected file completely?</translation>
</message>

View File

@ -144,6 +144,21 @@ Dialog_Export::Dialog_Export(int total, const std::vector<int> &selectedIndexs,
ui->lab_warning->setVisible(true);
ui->lab_warning->setText(tr("Input is not valid.\nPage range will be 'Chosen Pages'."));
}
ui->label_ocrType->setVisible(false);
ui->comboBox_ocrType->setVisible(false);
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
if (!getOcrPath().empty())
{
ui->label_ocrType->setVisible(isOcr());
ui->comboBox_ocrType->setVisible(isOcr());
QStringList ocrType = { tr("English"), tr("Simplified Chinese"), tr("Traditional Chinese"), tr("Japanese"), tr("Korean") };
ui->comboBox_ocrType->addItems(ocrType);
ui->comboBox_ocrType->setCurrentIndex(getCfgValue("export", "ocrLanguage", 0));
}
#endif
}
Dialog_Export::~Dialog_Export()
@ -202,6 +217,11 @@ void Dialog_Export::getSaveIndexs(std::vector<int> &indexs)
indexs = m_saveIndexs;
}
int Dialog_Export::getOcrLanguageType()
{
return ui->comboBox_ocrType->currentIndex();// 0-english, 1-chinese_sim, 2-chinese_tra, 3-japanese, 4-korean...
}
void Dialog_Export::on_dialog_accepted()
{
QString extName(m_supportType[m_suffix].ext);
@ -273,6 +293,11 @@ void Dialog_Export::on_dialog_accepted()
saveCfgValue("export", "exportType", exportType);
saveCfgValue("export", "saveAsMulti", ui->check_saveAsMulti->isChecked());
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
int ocrLanguage = ui->comboBox_ocrType->currentIndex();
saveCfgValue("export", "ocrLanguage", ocrLanguage);
#endif
accept();
}
@ -281,6 +306,12 @@ void Dialog_Export::on_filterSelected(const QString& filterName)
bool enabled = false;
m_suffix = ui->fileDialog->nameFilters().indexOf(filterName);
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
ui->label_ocrType->setVisible(isOcr());
ui->comboBox_ocrType->setVisible(isOcr());
#endif
enabled = (m_supportType[m_suffix].attr & FILE_TYPE_ATTR_CONTAIN_MULTI_PAGES) == FILE_TYPE_ATTR_CONTAIN_MULTI_PAGES;
ui->check_saveAsMulti->setEnabled(enabled);
// ui->check_saveAsMulti->setEnabled(m_suffix > 2 && m_suffix < 6);

View File

@ -49,6 +49,7 @@ public:
bool isOcr();
bool isSaveAsMultiPage();
void getSaveIndexs(std::vector<int> &indexs);
int getOcrLanguageType();
private slots:
void on_dialog_accepted();

View File

@ -13,148 +13,169 @@
<property name="windowTitle">
<string>Export</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,0">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0">
<item>
<widget class="QFileDialog" name="fileDialog" native="true"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="gbox_pageRange">
<property name="title">
<string>Page Range</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QGroupBox" name="gbox_pageRange">
<property name="title">
<string>Page Range</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radio_nominatedPages">
<property name="text">
<string>Nominate Pages(example:1,3,6 or 3-6)</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QRadioButton" name="radio_nominatedPages">
<property name="text">
<string>Nominate Pages(example:1,3,6 or 3-6)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radio_chosenPages">
<property name="text">
<string>Chosen Pages</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radio_allPages">
<property name="text">
<string>All Pages</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radio_chosenPages">
<property name="text">
<string>Chosen Pages</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radio_allPages">
<property name="text">
<string>All Pages</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
<item>
<widget class="QLabel" name="lab_nominatePages">
<property name="text">
<string>Page:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_nominatePages"/>
</item>
<item>
<widget class="QLabel" name="lab_warning">
<property name="enabled">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(216, 0, 0);</string>
</property>
<property name="text">
<string>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
<item>
<widget class="QLabel" name="lab_nominatePages">
<property name="text">
<string>Page:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_nominatePages"/>
</item>
<item>
<widget class="QLabel" name="lab_warning">
<property name="enabled">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(216, 0, 0);</string>
</property>
<property name="text">
<string>
Input is not valid.
Page range will be &quot;Chosen Pages&quot;.
</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="check_saveAsMulti">
<property name="text">
<string>Save as multipages (TIFF/PDF/OFD/GIF)</string>
</property>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_option">
<property name="text">
<string>Compression Option</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="check_saveAsMulti">
<property name="text">
<string>Save as multipages (TIFF/PDF/OFD/GIF)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_ocrType">
<property name="text">
<string>Ocr type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_ocrType">
<property name="minimumSize">
<size>
<width>111</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_option">
<property name="text">
<string>Compression Option</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>

View File

@ -10,10 +10,11 @@
#include <QMessageBox>
#include <QFile>
#include "ocrPdf.h"
#include "app_cfg.h"
Dialog_ExportImageFile::Dialog_ExportImageFile(const QString &destPath, const QString &destName, const QString &destExt,
bool isSaveAsMulti, int jpegQuality, int tiffCompressionBW, int tiffCompression, int tiffQuality, bool isOcr,
const QStringList &srcFiles, QWidget *parent)
int ocrLanguageType, const QStringList &srcFiles, QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog_ExportImageFile)
, m_destPath(destPath)
@ -25,6 +26,7 @@ Dialog_ExportImageFile::Dialog_ExportImageFile(const QString &destPath, const QS
, m_tiffCompression(tiffCompression)
, m_tiffQuality(tiffQuality)
, m_isOcr(isOcr)
, m_ocrLanguageType(ocrLanguageType)
, m_srcFiles(srcFiles)
{
ui->setupUi(this);
@ -116,7 +118,7 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param)
HGImgFmt_CloseImageWriter(writer);
bool result = createOcrPdf(tmpFileName, getStdString(fileName).c_str());
bool result = createOcrPdf(tmpFileName, getStdString(fileName).c_str(), m_ocrLanguageType);
QFile::remove(tmpFileName);
if (!result)
{
@ -317,7 +319,7 @@ void HGAPI Dialog_ExportImageFile::ThreadFunc(HGThread thread, HGPointer param)
saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG;
}
ret = MainWindow::saveImage(img, &saveInfo, p->m_isOcr, getStdString(saveFileName).c_str());
ret = MainWindow::saveImage(img, &saveInfo, p->m_isOcr, p->m_ocrLanguageType, getStdString(saveFileName).c_str());
HGBase_DestroyImage(img);
}

View File

@ -15,7 +15,7 @@ class Dialog_ExportImageFile : public QDialog
public:
explicit Dialog_ExportImageFile(const QString &destPath, const QString &destName, const QString &destExt,
bool isSaveAsMulti, int jpegQuality, int tiffCompressionBW, int tiffCompression, int tiffQuality, bool isOcr,
const QStringList &srcFiles, QWidget *parent = nullptr);
int ocrLanguageType, const QStringList &srcFiles, QWidget *parent = nullptr);
~Dialog_ExportImageFile();
private:
@ -45,6 +45,7 @@ private:
int m_tiffCompression;
int m_tiffQuality;
bool m_isOcr;
int m_ocrLanguageType;
QStringList m_srcFiles;
bool m_stopThread;

View File

@ -107,6 +107,21 @@ Dialog_SaveAs::Dialog_SaveAs(QWidget *parent) :
ui->cbox_subFolder->setChecked(false);
ui->cbox_subFolder->setChecked(getCfgValue("saveAs", "subFolderByTime", false));
ui->label_ocrType->setVisible(false);
ui->comboBox_ocrType->setVisible(false);
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
if (!getOcrPath().empty())
{
ui->label_ocrType->setVisible(isOcr());
ui->comboBox_ocrType->setVisible(isOcr());
QStringList ocrType = { tr("English"), tr("Simplified Chinese"), tr("Traditional Chinese"), tr("Japanese"), tr("Korean") };
ui->comboBox_ocrType->addItems(ocrType);
ui->comboBox_ocrType->setCurrentIndex(getCfgValue("saveAs", "ocrLanguage", 0));
}
#endif
}
Dialog_SaveAs::~Dialog_SaveAs()
@ -149,6 +164,11 @@ bool Dialog_SaveAs::isOcr()
return (m_suffix >= 10);
}
int Dialog_SaveAs::getOcrLanguageType()
{
return ui->comboBox_ocrType->currentIndex();// 0-english, 1-chinese_sim, 2-chinese_tra, 3-japanese, 4-korean...
}
void Dialog_SaveAs::on_dialog_accepted()
{
QString extName;
@ -224,6 +244,11 @@ void Dialog_SaveAs::on_dialog_accepted()
m_savePath = getStdFileName(path + "/" + name + extName);
}
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
int ocrLanguage = ui->comboBox_ocrType->currentIndex();
saveCfgValue("saveAs", "ocrLanguage", ocrLanguage);
#endif
saveCfgValue("saveAs", "suffix", m_suffix);
saveCfgValue("saveAs", "subFolderByTime", ui->cbox_subFolder->isChecked());
accept();
@ -233,6 +258,11 @@ void Dialog_SaveAs::on_filterSelected(const QString& filterName)
{
m_suffix = ui->fileDialog->nameFilters().indexOf(filterName);
ui->btn_option->setEnabled(0 == m_suffix || 6 == m_suffix);
#if defined(OEM_ZHONGJING) && defined(HG_CMP_MSC)
ui->label_ocrType->setVisible(isOcr());
ui->comboBox_ocrType->setVisible(isOcr());
#endif
}
void Dialog_SaveAs::on_btn_option_clicked()

View File

@ -22,6 +22,7 @@ public:
int getTiffCompression();
int getTiffQuality();
bool isOcr();
int getOcrLanguageType();
private slots:
void on_dialog_accepted();

View File

@ -33,6 +33,23 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_ocrType">
<property name="text">
<string>Ocr type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_ocrType">
<property name="minimumSize">
<size>
<width>101</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -422,7 +422,7 @@ void MainWindow::exitFullScreen()
m_dlgFullScreen = nullptr;
}
HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, const HGChar *fileName)
HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, int ocrLanguageType, const HGChar *fileName)
{
if (!ocr)
{
@ -435,7 +435,7 @@ HGResult MainWindow::saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool
HGChar tmpFileName[256];
HGBase_GetTmpFileName("bmp", tmpFileName, 256);
ret = HGImgFmt_SaveImage(image, 0, info, tmpFileName);
bool result = createOcrPdf(tmpFileName, fileName);
bool result = createOcrPdf(tmpFileName, fileName, ocrLanguageType);
QFile::remove(tmpFileName);
return (result) ? HGBASE_ERR_OK : HGIMGPROC_ERR_OCR;
#else
@ -1230,7 +1230,7 @@ void MainWindow::on_new_image(void *img, int statu)
saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG;
}
ret = saveImage(image, &saveInfo, m_aquireIntoSaveParam.m_isOcr, getStdString(scanFileName).c_str());
ret = saveImage(image, &saveInfo, m_aquireIntoSaveParam.m_isOcr, 0, getStdString(scanFileName).c_str());
if(ret == HGBASE_ERR_OK)
{
m_thumb->addItem(scanFileName);
@ -2060,6 +2060,7 @@ void MainWindow::on_act_save_triggered()
int tiffCompression = auto_save_info_.tiffCompression;
int tiffQuality = auto_save_info_.tiffQuality;
bool isOcr = auto_save_info_.isOcr;
int ocrLanguageType = 0;
bool find = false;
int count = 0;
@ -2099,6 +2100,7 @@ void MainWindow::on_act_save_triggered()
tiffQuality = auto_save_info_.tiffQuality = dlg.getTiffQuality();
tiffCompression = auto_save_info_.tiffCompression = dlg.getTiffCompression();
tiffCompressionBW = auto_save_info_.tiffCompressionBW = dlg.getTiffCompressionBW();
ocrLanguageType = dlg.getOcrLanguageType();
}
if(auto_save_changes_ && save_from_changed_)
{
@ -2156,7 +2158,7 @@ void MainWindow::on_act_save_triggered()
saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG;
}
ret = saveImage(img, &saveInfo, isOcr, getStdString(savePath).c_str());
ret = saveImage(img, &saveInfo, isOcr, ocrLanguageType, getStdString(savePath).c_str());
if (HGBASE_ERR_OK == ret)
{
if (auto_save_changes_)
@ -2289,6 +2291,7 @@ void MainWindow::on_act_saveAs_triggered()
int tiffCompression = dlg.getTiffCompression();
int tiffQuality = dlg.getTiffQuality();
bool isOcr = dlg.isOcr();
int ocrLanguageType = dlg.getOcrLanguageType();
HGImgFmtSaveInfo saveInfo;
saveInfo.jpegQuality = (HGUInt)jpegQuality;
@ -2312,7 +2315,7 @@ void MainWindow::on_act_saveAs_triggered()
saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG;
}
HGResult ret = saveImage(img, &saveInfo, isOcr, getStdString(savePath).c_str());
HGResult ret = saveImage(img, &saveInfo, isOcr, ocrLanguageType, getStdString(savePath).c_str());
if (HGBASE_ERR_OK == ret)
{
if(!auto_save_changes_)
@ -2388,9 +2391,10 @@ void MainWindow::on_act_Export_triggered()
int tiffCompression = dlg.getTiffCompression();
int tiffQuality = dlg.getTiffQuality();
bool isOcr = dlg.isOcr();
int ocrLanguageType = dlg.getOcrLanguageType();
Dialog_ExportImageFile dlgExport(savePath, saveName, saveExt, isSaveAsMulti, jpegQuality,
tiffCompressionBW, tiffCompression, tiffQuality, isOcr, srcFiles, this);
tiffCompressionBW, tiffCompression, tiffQuality, isOcr, ocrLanguageType, srcFiles, this);
dlgExport.exec();
}
}

View File

@ -83,7 +83,7 @@ public:
virtual ~MainWindow() override;
void exitFullScreen();
static HGResult saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, const HGChar *fileName);
static HGResult saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, int ocrLanguageType, const HGChar *fileName);
static QString getLogInfo(HGResult ret);
private slots:

View File

@ -32,7 +32,7 @@ std::string getOcrPath()
return ocrPath;
}
bool createOcrPdf(const std::string &imgPath, const std::string &dstFile)
bool createOcrPdf(const std::string &imgPath, const std::string &dstFile, int languageType)
{
#ifdef HG_CMP_MSC
std::string ocrPath = getOcrPath();
@ -93,7 +93,28 @@ bool createOcrPdf(const std::string &imgPath, const std::string &dstFile)
bool ret = false;
char cmd[1024] = {0};
sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "eng", 3, 3, "pdf");
if (0 == languageType)
{
sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "eng", 3, 3, "pdf");
}
else if (1 == languageType)
{
sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "chi_sim", 3, 3, "pdf");
}
else if (2 == languageType)
{
sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "chi_tra", 3, 3, "pdf");
}
else if (3 == languageType)
{
sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "jpn", 3, 3, "pdf");
}
else if (4 == languageType)
{
sprintf(cmd, "tesseract.exe \"%s\" \"%s\" -l %s --psm %d --oem %d %s", imgPath.c_str(), prefix, "kor", 3, 3, "pdf");
}
BOOL b = CreateProcessA(NULL, cmd, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &StartupInfo, &ProcessInfo);
if (b)
{

View File

@ -4,6 +4,6 @@
#include <string>
std::string getOcrPath();
bool createOcrPdf(const std::string &imgPath, const std::string &dstFile);
bool createOcrPdf(const std::string &imgPath, const std::string &dstFile, int languageType);//languageType is the index of the comboBox on export and save_as ui.
#endif /* __OCRPDF_H__ */

View File

@ -56,6 +56,8 @@ HGBase_DisableInfo
HGBase_WriteInfo
HGBase_GetLocalTime
HGBase_GetTickCount
HGBase_GetIntervalSeconds
HGBase_GetTmpPath
HGBase_GetCurrentDir

View File

@ -104,6 +104,22 @@ BOOL CHGTestDlg::OnInitDialog()
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
HGImage image = NULL;
HGImgFmt_LoadImage("D:\\2.jpg", 0, NULL, 0, 0, &image);
if (NULL != image)
{
HGOCRMgr ocrMgr = NULL;
HGImgProc_CreateOCRMgr(HGIMGPROC_OCRALGO_TESSERACT, &ocrMgr);
if (NULL != ocrMgr)
{
HGUInt direct = 0;
HGImgProc_ImageTextDirectOCR(ocrMgr, image, &direct);
HGImgProc_DestroyOCRMgr(ocrMgr);
}
HGBase_DestroyImage(image);
}
HGTwain_LoadDSM(&m_dsm);
HGTwain_OpenDSM(m_dsm, m_hWnd, DSEventCallback, this);

View File

@ -34,4 +34,53 @@ HGResult HGAPI HGBase_GetLocalTime(HGTimeInfo* timeInfo)
timeInfo->milliseconds = time.tv_usec / 1000;
#endif
return HGBASE_ERR_OK;
}
HGResult HGAPI HGBase_GetTickCount(HGULonglong* tickCount)
{
if (NULL == tickCount)
{
return HGBASE_ERR_INVALIDARG;
}
#if defined(HG_CMP_MSC)
LARGE_INTEGER performanceCount;
if (!QueryPerformanceCounter(&performanceCount))
{
return HGBASE_ERR_FAIL;
}
*tickCount = performanceCount.QuadPart;
#else
struct timespec ts;
if (0 != clock_gettime(CLOCK_MONOTONIC, &ts))
{
return HGBASE_ERR_FAIL;
}
*tickCount = (HGULonglong)ts.tv_sec * (HGULonglong)1000000000 + (HGULonglong)ts.tv_nsec;
#endif
return HGBASE_ERR_OK;
}
HGResult HGAPI HGBase_GetIntervalSeconds(HGULonglong startTickCount, HGULonglong stopTickCount, HGDouble* seconds)
{
if (startTickCount > stopTickCount || NULL == seconds)
{
return HGBASE_ERR_INVALIDARG;
}
#if defined(HG_CMP_MSC)
LARGE_INTEGER frequency;
if (!QueryPerformanceFrequency(&frequency))
{
return HGBASE_ERR_FAIL;
}
*seconds = (HGDouble)(stopTickCount - startTickCount) / (HGDouble)frequency.QuadPart;
#else
* seconds = (HGDouble)(stopTickCount - startTickCount) / (HGDouble)1000000000.0;
#endif
return HGBASE_ERR_OK;
}

View File

@ -23,4 +23,10 @@ typedef struct
HGEXPORT HGResult HGAPI HGBase_GetLocalTime(HGTimeInfo *timeInfo);
/* get tick count */
HGEXPORT HGResult HGAPI HGBase_GetTickCount(HGULonglong* tickCount);
/* get interval seconds */
HGEXPORT HGResult HGAPI HGBase_GetIntervalSeconds(HGULonglong startTickCount, HGULonglong stopTickCount, HGDouble* seconds);
#endif /* __HGTIME_H__ */

View File

@ -2,6 +2,7 @@
#include "HGOCR.h"
#include "HGOCRRetImpl.hpp"
#include "HGOCRRetImpl.hpp"
#include "../base/HGTime.h"
#include "../base/HGUtility.h"
#include "../base/HGInfo.h"
#include "../imgfmt/HGBmp.h"
@ -40,7 +41,7 @@ HGResult HGOCRTesseract::Init()
HGBase_GetFilePath(moduleName, dataPath, 256);
strcat(dataPath, "tessdata");
int rc = TessBaseAPIInit3(m_baseApi, dataPath, "chi_sim");
int rc = TessBaseAPIInit3(m_baseApi, dataPath, "osd");
if (0 != rc)
{
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "HGOCRTesseract::Init: TessBaseAPIInit3 fail");
@ -171,7 +172,15 @@ HGResult HGOCRTesseract::ImageTextDirectOCR(HGImage image, HGUInt* direct)
HGBase_GetImageDpi(image2, &xDpi, &yDpi);
TessBaseAPISetSourceResolution(m_baseApi, (xDpi + yDpi) / 2);
HGULonglong tickStart = 0;
HGBase_GetTickCount(&tickStart);
int orientation = MyOSD(m_baseApi);
HGULonglong tickEnd = 0;
HGBase_GetTickCount(&tickEnd);
HGDouble seconds = 0.0;
HGBase_GetIntervalSeconds(tickStart, tickEnd, &seconds);
HGBase_WriteInfo(HGBASE_INFOTYPE_DEBUG, "HGOCRTesseract::ImageTextDirectOCR seconds:%fs", seconds);
if (TessOrientation::ORIENTATION_PAGE_UP == orientation)
*direct = HGIMGPROC_OCRTEXTDIRECT_ORI;
else if (TessOrientation::ORIENTATION_PAGE_RIGHT == orientation)

View File

@ -0,0 +1,579 @@
///////////////////////////////////////////////////////////////////////
// File: osdetect.cpp
// Description: Orientation and script detection.
// Author: Samuel Charron
// Ranjith Unnikrishnan
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <cmath> // for std::fabs
#include <memory>
#include "osdetect.h"
#include "blobbox.h"
#include "blread.h"
#include "colfind.h"
#include "fontinfo.h"
#include "imagefind.h"
#include "linefind.h"
#include "oldlist.h"
#include "qrsequence.h"
#include "ratngs.h"
#include "strngs.h"
#include "tabvector.h"
#include "tesseractclass.h"
#include "textord.h"
const float kSizeRatioToReject = 2.0;
const int kMinAcceptableBlobHeight = 10;
const float kScriptAcceptRatio = 1.3;
const float kHanRatioInKorean = 0.7;
const float kHanRatioInJapanese = 0.3;
const float kNonAmbiguousMargin = 1.0;
// General scripts
static const char* han_script = "Han";
static const char* latin_script = "Latin";
static const char* katakana_script = "Katakana";
static const char* hiragana_script = "Hiragana";
static const char* hangul_script = "Hangul";
// Pseudo-scripts Name
const char* ScriptDetector::korean_script_ = "Korean";
const char* ScriptDetector::japanese_script_ = "Japanese";
const char* ScriptDetector::fraktur_script_ = "Fraktur";
void OSResults::update_best_orientation() {
float first = orientations[0];
float second = orientations[1];
best_result.orientation_id = 0;
if (orientations[0] < orientations[1]) {
first = orientations[1];
second = orientations[0];
best_result.orientation_id = 1;
}
for (int i = 2; i < 4; ++i) {
if (orientations[i] > first) {
second = first;
first = orientations[i];
best_result.orientation_id = i;
} else if (orientations[i] > second) {
second = orientations[i];
}
}
// Store difference of top two orientation scores.
best_result.oconfidence = first - second;
}
void OSResults::set_best_orientation(int orientation_id) {
best_result.orientation_id = orientation_id;
best_result.oconfidence = 0;
}
void OSResults::update_best_script(int orientation) {
// We skip index 0 to ignore the "Common" script.
float first = scripts_na[orientation][1];
float second = scripts_na[orientation][2];
best_result.script_id = 1;
if (scripts_na[orientation][1] < scripts_na[orientation][2]) {
first = scripts_na[orientation][2];
second = scripts_na[orientation][1];
best_result.script_id = 2;
}
for (int i = 3; i < kMaxNumberOfScripts; ++i) {
if (scripts_na[orientation][i] > first) {
best_result.script_id = i;
second = first;
first = scripts_na[orientation][i];
} else if (scripts_na[orientation][i] > second) {
second = scripts_na[orientation][i];
}
}
best_result.sconfidence = (second == 0.0f) ? 2.0f :
(first / second - 1.0) / (kScriptAcceptRatio - 1.0);
}
int OSResults::get_best_script(int orientation_id) const {
int max_id = -1;
for (int j = 0; j < kMaxNumberOfScripts; ++j) {
const char *script = unicharset->get_script_from_script_id(j);
if (strcmp(script, "Common") && strcmp(script, "NULL")) {
if (max_id == -1 ||
scripts_na[orientation_id][j] > scripts_na[orientation_id][max_id])
max_id = j;
}
}
return max_id;
}
// Print the script scores for all possible orientations.
void OSResults::print_scores(void) const {
for (int i = 0; i < 4; ++i) {
tprintf("Orientation id #%d", i);
print_scores(i);
}
}
// Print the script scores for the given candidate orientation.
void OSResults::print_scores(int orientation_id) const {
for (int j = 0; j < kMaxNumberOfScripts; ++j) {
if (scripts_na[orientation_id][j]) {
tprintf("%12s\t: %f\n", unicharset->get_script_from_script_id(j),
scripts_na[orientation_id][j]);
}
}
}
// Accumulate scores with given OSResults instance and update the best script.
void OSResults::accumulate(const OSResults& osr) {
for (int i = 0; i < 4; ++i) {
orientations[i] += osr.orientations[i];
for (int j = 0; j < kMaxNumberOfScripts; ++j)
scripts_na[i][j] += osr.scripts_na[i][j];
}
unicharset = osr.unicharset;
update_best_orientation();
update_best_script(best_result.orientation_id);
}
// Detect and erase horizontal/vertical lines and picture regions from the
// image, so that non-text blobs are removed from consideration.
static void remove_nontext_regions(tesseract::Tesseract *tess,
BLOCK_LIST *blocks,
TO_BLOCK_LIST *to_blocks) {
Pix *pix = tess->pix_binary();
ASSERT_HOST(pix != nullptr);
int vertical_x = 0;
int vertical_y = 1;
tesseract::TabVector_LIST v_lines;
tesseract::TabVector_LIST h_lines;
int resolution;
if (kMinCredibleResolution > pixGetXRes(pix)) {
resolution = kMinCredibleResolution;
tprintf("Warning. Invalid resolution %d dpi. Using %d instead.\n",
pixGetXRes(pix), resolution);
} else {
resolution = pixGetXRes(pix);
}
tesseract::LineFinder::FindAndRemoveLines(resolution, false, pix,
&vertical_x, &vertical_y,
nullptr, &v_lines, &h_lines);
Pix* im_pix = tesseract::ImageFind::FindImages(pix, nullptr);
if (im_pix != nullptr) {
pixSubtract(pix, pix, im_pix);
pixDestroy(&im_pix);
}
tess->mutable_textord()->find_components(tess->pix_binary(),
blocks, to_blocks);
}
// Find connected components in the page and process a subset until finished or
// a stopping criterion is met.
// Returns the number of blobs used in making the estimate. 0 implies failure.
int orientation_and_script_detection(STRING& filename,
OSResults* osr,
tesseract::Tesseract* tess) {
STRING name = filename; //truncated name
const char *lastdot; //of name
TBOX page_box;
lastdot = strrchr (name.string (), '.');
if (lastdot != nullptr)
name[lastdot-name.string()] = '\0';
ASSERT_HOST(tess->pix_binary() != nullptr);
int width = pixGetWidth(tess->pix_binary());
int height = pixGetHeight(tess->pix_binary());
BLOCK_LIST blocks;
if (!read_unlv_file(name, width, height, &blocks))
FullPageBlock(width, height, &blocks);
// Try to remove non-text regions from consideration.
TO_BLOCK_LIST land_blocks, port_blocks;
remove_nontext_regions(tess, &blocks, &port_blocks);
if (port_blocks.empty()) {
// page segmentation did not succeed, so we need to find_components first.
tess->mutable_textord()->find_components(tess->pix_binary(),
&blocks, &port_blocks);
} else {
page_box.set_left(0);
page_box.set_bottom(0);
page_box.set_right(width);
page_box.set_top(height);
// Filter_blobs sets up the TO_BLOCKs the same as find_components does.
tess->mutable_textord()->filter_blobs(page_box.topright(),
&port_blocks, true);
}
return os_detect(&port_blocks, osr, tess);
}
// Filter and sample the blobs.
// Returns a non-zero number of blobs if the page was successfully processed, or
// zero if the page had too few characters to be reliable
int os_detect(TO_BLOCK_LIST* port_blocks, OSResults* osr,
tesseract::Tesseract* tess) {
int blobs_total = 0;
TO_BLOCK_IT block_it;
block_it.set_to_list(port_blocks);
BLOBNBOX_CLIST filtered_list;
BLOBNBOX_C_IT filtered_it(&filtered_list);
for (block_it.mark_cycle_pt(); !block_it.cycled_list();
block_it.forward ()) {
TO_BLOCK* to_block = block_it.data();
if (to_block->block->pdblk.poly_block() &&
!to_block->block->pdblk.poly_block()->IsText()) continue;
BLOBNBOX_IT bbox_it;
bbox_it.set_to_list(&to_block->blobs);
for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list ();
bbox_it.forward ()) {
BLOBNBOX* bbox = bbox_it.data();
C_BLOB* blob = bbox->cblob();
TBOX box = blob->bounding_box();
++blobs_total;
// Catch illegal value of box width and avoid division by zero.
if (box.width() == 0) continue;
// TODO: Can height and width be negative? If not, remove fabs.
float y_x = std::fabs((box.height() * 1.0f) / box.width());
float x_y = 1.0f / y_x;
// Select a >= 1.0 ratio
float ratio = x_y > y_x ? x_y : y_x;
// Blob is ambiguous
if (ratio > kSizeRatioToReject) continue;
if (box.height() < kMinAcceptableBlobHeight) continue;
filtered_it.add_to_end(bbox);
}
}
return os_detect_blobs(nullptr, &filtered_list, osr, tess);
}
// Detect orientation and script from a list of blobs.
// Returns a non-zero number of blobs if the list was successfully processed, or
// zero if the list had too few characters to be reliable.
// If allowed_scripts is non-null and non-empty, it is a list of scripts that
// constrains both orientation and script detection to consider only scripts
// from the list.
int os_detect_blobs(const GenericVector<int>* allowed_scripts,
BLOBNBOX_CLIST* blob_list, OSResults* osr,
tesseract::Tesseract* tess) {
OSResults osr_;
int minCharactersToTry = tess->min_characters_to_try;
int maxCharactersToTry = /*5 * minCharactersToTry*/ 150;
if (osr == nullptr)
osr = &osr_;
osr->unicharset = &tess->unicharset;
OrientationDetector o(allowed_scripts, osr);
ScriptDetector s(allowed_scripts, osr, tess);
BLOBNBOX_C_IT filtered_it(blob_list);
int real_max = std::min(filtered_it.length(), maxCharactersToTry);
// tprintf("Total blobs found = %d\n", blobs_total);
// tprintf("Number of blobs post-filtering = %d\n", filtered_it.length());
// tprintf("Number of blobs to try = %d\n", real_max);
// If there are too few characters, skip this page entirely.
if (real_max < minCharactersToTry / /*2*/ 3) {
tprintf("Too few characters. Skipping this page\n");
return 0;
}
auto** blobs = new BLOBNBOX*[filtered_it.length()];
int number_of_blobs = 0;
for (filtered_it.mark_cycle_pt (); !filtered_it.cycled_list ();
filtered_it.forward ()) {
blobs[number_of_blobs++] = filtered_it.data();
}
QRSequenceGenerator sequence(number_of_blobs);
int num_blobs_evaluated = 0;
for (int i = 0; i < real_max; ++i) {
if (os_detect_blob(blobs[sequence.GetVal()], &o, &s, osr, tess)
&& i > minCharactersToTry) {
break;
}
++num_blobs_evaluated;
}
delete [] blobs;
// Make sure the best_result is up-to-date
int orientation = o.get_orientation();
osr->update_best_script(orientation);
return num_blobs_evaluated;
}
// Processes a single blob to estimate script and orientation.
// Return true if estimate of orientation and script satisfies stopping
// criteria.
bool os_detect_blob(BLOBNBOX* bbox, OrientationDetector* o,
ScriptDetector* s, OSResults* osr,
tesseract::Tesseract* tess) {
tess->tess_cn_matching.set_value(true); // turn it on
tess->tess_bn_matching.set_value(false);
C_BLOB* blob = bbox->cblob();
TBLOB* tblob = TBLOB::PolygonalCopy(tess->poly_allow_detailed_fx, blob);
TBOX box = tblob->bounding_box();
FCOORD current_rotation(1.0f, 0.0f);
FCOORD rotation90(0.0f, 1.0f);
BLOB_CHOICE_LIST ratings[4];
// Test the 4 orientations
for (int i = 0; i < 4; ++i) {
// Normalize the blob. Set the origin to the place we want to be the
// bottom-middle after rotation.
// Scaling is to make the rotated height the x-height.
float scaling = static_cast<float>(kBlnXHeight) / box.height();
float x_origin = (box.left() + box.right()) / 2.0f;
float y_origin = (box.bottom() + box.top()) / 2.0f;
if (i == 0 || i == 2) {
// Rotation is 0 or 180.
y_origin = i == 0 ? box.bottom() : box.top();
} else {
// Rotation is 90 or 270.
scaling = static_cast<float>(kBlnXHeight) / box.width();
x_origin = i == 1 ? box.left() : box.right();
}
std::unique_ptr<TBLOB> rotated_blob(new TBLOB(*tblob));
rotated_blob->Normalize(nullptr, &current_rotation, nullptr,
x_origin, y_origin, scaling, scaling,
0.0f, static_cast<float>(kBlnBaselineOffset),
false, nullptr);
tess->AdaptiveClassifier(rotated_blob.get(), ratings + i);
current_rotation.rotate(rotation90);
}
delete tblob;
bool stop = o->detect_blob(ratings);
s->detect_blob(ratings);
int orientation = o->get_orientation();
stop = s->must_stop(orientation) && stop;
return stop;
}
OrientationDetector::OrientationDetector(
const GenericVector<int>* allowed_scripts, OSResults* osr) {
osr_ = osr;
allowed_scripts_ = allowed_scripts;
}
// Score the given blob and return true if it is now sure of the orientation
// after adding this block.
bool OrientationDetector::detect_blob(BLOB_CHOICE_LIST* scores) {
float blob_o_score[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float total_blob_o_score = 0.0f;
for (int i = 0; i < 4; ++i) {
BLOB_CHOICE_IT choice_it(scores + i);
if (!choice_it.empty()) {
BLOB_CHOICE* choice = nullptr;
if (allowed_scripts_ != nullptr && !allowed_scripts_->empty()) {
// Find the top choice in an allowed script.
for (choice_it.mark_cycle_pt(); !choice_it.cycled_list() &&
choice == nullptr; choice_it.forward()) {
int choice_script = choice_it.data()->script_id();
int s = 0;
for (s = 0; s < allowed_scripts_->size(); ++s) {
if ((*allowed_scripts_)[s] == choice_script) {
choice = choice_it.data();
break;
}
}
}
} else {
choice = choice_it.data();
}
if (choice != nullptr) {
// The certainty score ranges between [-20,0]. This is converted here to
// [0,1], with 1 indicating best match.
blob_o_score[i] = 1 + 0.05 * choice->certainty();
total_blob_o_score += blob_o_score[i];
}
}
}
if (total_blob_o_score == 0.0) return false;
// Fill in any blanks with the worst score of the others. This is better than
// picking an arbitrary probability for it and way better than -inf.
float worst_score = 0.0f;
int num_good_scores = 0;
for (float f : blob_o_score) {
if (f > 0.0f) {
++num_good_scores;
if (worst_score == 0.0f || f < worst_score)
worst_score = f;
}
}
if (num_good_scores == 1) {
// Lower worst if there is only one.
worst_score /= 2.0f;
}
for (float& f : blob_o_score) {
if (f == 0.0f) {
f = worst_score;
total_blob_o_score += worst_score;
}
}
// Normalize the orientation scores for the blob and use them to
// update the aggregated orientation score.
for (int i = 0; total_blob_o_score != 0 && i < 4; ++i) {
osr_->orientations[i] += log(blob_o_score[i] / total_blob_o_score);
}
// TODO(ranjith) Add an early exit test, based on min_orientation_margin,
// as used in pagesegmain.cpp.
return false;
}
int OrientationDetector::get_orientation() {
osr_->update_best_orientation();
return osr_->best_result.orientation_id;
}
ScriptDetector::ScriptDetector(const GenericVector<int>* allowed_scripts,
OSResults* osr, tesseract::Tesseract* tess) {
osr_ = osr;
tess_ = tess;
allowed_scripts_ = allowed_scripts;
katakana_id_ = tess_->unicharset.add_script(katakana_script);
hiragana_id_ = tess_->unicharset.add_script(hiragana_script);
han_id_ = tess_->unicharset.add_script(han_script);
hangul_id_ = tess_->unicharset.add_script(hangul_script);
japanese_id_ = tess_->unicharset.add_script(japanese_script_);
korean_id_ = tess_->unicharset.add_script(korean_script_);
latin_id_ = tess_->unicharset.add_script(latin_script);
fraktur_id_ = tess_->unicharset.add_script(fraktur_script_);
}
// Score the given blob and return true if it is now sure of the script after
// adding this blob.
void ScriptDetector::detect_blob(BLOB_CHOICE_LIST* scores) {
for (int i = 0; i < 4; ++i) {
bool done[kMaxNumberOfScripts] = { false };
BLOB_CHOICE_IT choice_it;
choice_it.set_to_list(scores + i);
float prev_score = -1;
int script_count = 0;
int prev_id = -1;
int prev_fontinfo_id = -1;
const char* prev_unichar = "";
const char* unichar = "";
for (choice_it.mark_cycle_pt(); !choice_it.cycled_list();
choice_it.forward()) {
BLOB_CHOICE* choice = choice_it.data();
int id = choice->script_id();
if (allowed_scripts_ != nullptr && !allowed_scripts_->empty()) {
// Check that the choice is in an allowed script.
int s = 0;
for (s = 0; s < allowed_scripts_->size(); ++s) {
if ((*allowed_scripts_)[s] == id) break;
}
if (s == allowed_scripts_->size()) continue; // Not found in list.
}
// Script already processed before.
if (done[id]) continue;
done[id] = true;
unichar = tess_->unicharset.id_to_unichar(choice->unichar_id());
// Save data from the first match
if (prev_score < 0) {
prev_score = -choice->certainty();
script_count = 1;
prev_id = id;
prev_unichar = unichar;
prev_fontinfo_id = choice->fontinfo_id();
} else if (-choice->certainty() < prev_score + kNonAmbiguousMargin) {
++script_count;
}
if (strlen(prev_unichar) == 1)
if (unichar[0] >= '0' && unichar[0] <= '9')
break;
// if script_count is >= 2, character is ambiguous, skip other matches
// since they are useless.
if (script_count >= 2)
break;
}
// Character is non ambiguous
if (script_count == 1) {
// Update the score of the winning script
osr_->scripts_na[i][prev_id] += 1.0;
// Workaround for Fraktur
if (prev_id == latin_id_) {
if (prev_fontinfo_id >= 0) {
const tesseract::FontInfo &fi =
tess_->get_fontinfo_table().get(prev_fontinfo_id);
//printf("Font: %s i:%i b:%i f:%i s:%i k:%i (%s)\n", fi.name,
// fi.is_italic(), fi.is_bold(), fi.is_fixed_pitch(),
// fi.is_serif(), fi.is_fraktur(),
// prev_unichar);
if (fi.is_fraktur()) {
osr_->scripts_na[i][prev_id] -= 1.0;
osr_->scripts_na[i][fraktur_id_] += 1.0;
}
}
}
// Update Japanese / Korean pseudo-scripts
if (prev_id == katakana_id_)
osr_->scripts_na[i][japanese_id_] += 1.0;
if (prev_id == hiragana_id_)
osr_->scripts_na[i][japanese_id_] += 1.0;
if (prev_id == hangul_id_)
osr_->scripts_na[i][korean_id_] += 1.0;
if (prev_id == han_id_) {
osr_->scripts_na[i][korean_id_] += kHanRatioInKorean;
osr_->scripts_na[i][japanese_id_] += kHanRatioInJapanese;
}
}
} // iterate over each orientation
}
bool ScriptDetector::must_stop(int orientation) {
osr_->update_best_script(orientation);
return osr_->best_result.sconfidence > 1;
}
// Helper method to convert an orientation index to its value in degrees.
// The value represents the amount of clockwise rotation in degrees that must be
// applied for the text to be upright (readable).
int OrientationIdToValue(const int& id) {
switch (id) {
case 0:
return 0;
case 1:
return 270;
case 2:
return 180;
case 3:
return 90;
default:
return -1;
}
}

View File

@ -0,0 +1,415 @@
/**********************************************************************
* File: pagesegmain.cpp
* Description: Top-level page segmenter for Tesseract.
* Author: Ray Smith
*
* (C) Copyright 2008, Google Inc.
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
** http://www.apache.org/licenses/LICENSE-2.0
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*
**********************************************************************/
#ifdef _WIN32
#ifndef unlink
#include <io.h>
#endif
#else
#include <unistd.h>
#endif // _WIN32
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "allheaders.h"
#include "blobbox.h"
#include "blread.h"
#include "colfind.h"
#include "debugpixa.h"
#include "equationdetect.h"
#include "imagefind.h"
#include "linefind.h"
#include "makerow.h"
#include "osdetect.h"
#include "tabvector.h"
#include "tesseractclass.h"
#include "tessvars.h"
#include "textord.h"
#include "tordmain.h"
#include "wordseg.h"
namespace tesseract {
// Max erosions to perform in removing an enclosing circle.
const int kMaxCircleErosions = 8;
// Helper to remove an enclosing circle from an image.
// If there isn't one, then the image will most likely get badly mangled.
// The returned pix must be pixDestroyed after use. nullptr may be returned
// if the image doesn't meet the trivial conditions that it uses to determine
// success.
static Pix* RemoveEnclosingCircle(Pix* pixs) {
Pix* pixsi = pixInvert(nullptr, pixs);
Pix* pixc = pixCreateTemplate(pixs);
pixSetOrClearBorder(pixc, 1, 1, 1, 1, PIX_SET);
pixSeedfillBinary(pixc, pixc, pixsi, 4);
pixInvert(pixc, pixc);
pixDestroy(&pixsi);
Pix* pixt = pixAnd(nullptr, pixs, pixc);
l_int32 max_count;
pixCountConnComp(pixt, 8, &max_count);
// The count has to go up before we start looking for the minimum.
l_int32 min_count = INT32_MAX;
Pix* pixout = nullptr;
for (int i = 1; i < kMaxCircleErosions; i++) {
pixDestroy(&pixt);
pixErodeBrick(pixc, pixc, 3, 3);
pixt = pixAnd(nullptr, pixs, pixc);
l_int32 count;
pixCountConnComp(pixt, 8, &count);
if (i == 1 || count > max_count) {
max_count = count;
min_count = count;
} else if (i > 1 && count < min_count) {
min_count = count;
pixDestroy(&pixout);
pixout = pixCopy(nullptr, pixt); // Save the best.
} else if (count >= min_count) {
break; // We have passed by the best.
}
}
pixDestroy(&pixt);
pixDestroy(&pixc);
return pixout;
}
/**
* Segment the page according to the current value of tessedit_pageseg_mode.
* pix_binary_ is used as the source image and should not be nullptr.
* On return the blocks list owns all the constructed page layout.
*/
int Tesseract::SegmentPage(const STRING* input_file, BLOCK_LIST* blocks,
Tesseract* osd_tess, OSResults* osr) {
ASSERT_HOST(pix_binary_ != nullptr);
int width = pixGetWidth(pix_binary_);
int height = pixGetHeight(pix_binary_);
// Get page segmentation mode.
auto pageseg_mode = static_cast<PageSegMode>(
static_cast<int>(tessedit_pageseg_mode));
// If a UNLV zone file can be found, use that instead of segmentation.
if (!PSM_COL_FIND_ENABLED(pageseg_mode) &&
input_file != nullptr && input_file->length() > 0) {
STRING name = *input_file;
const char* lastdot = strrchr(name.string(), '.');
if (lastdot != nullptr)
name[lastdot - name.string()] = '\0';
read_unlv_file(name, width, height, blocks);
}
if (blocks->empty()) {
// No UNLV file present. Work according to the PageSegMode.
// First make a single block covering the whole image.
BLOCK_IT block_it(blocks);
auto* block = new BLOCK("", true, 0, 0, 0, 0, width, height);
block->set_right_to_left(right_to_left());
block_it.add_to_end(block);
} else {
// UNLV file present. Use PSM_SINGLE_BLOCK.
pageseg_mode = PSM_SINGLE_BLOCK;
}
// The diacritic_blobs holds noise blobs that may be diacritics. They
// are separated out on areas of the image that seem noisy and short-circuit
// the layout process, going straight from the initial partition creation
// right through to after word segmentation, where they are added to the
// rej_cblobs list of the most appropriate word. From there classification
// will determine whether they are used.
BLOBNBOX_LIST diacritic_blobs;
int auto_page_seg_ret_val = 0;
TO_BLOCK_LIST to_blocks;
if (PSM_OSD_ENABLED(pageseg_mode) || PSM_BLOCK_FIND_ENABLED(pageseg_mode) ||
PSM_SPARSE(pageseg_mode)) {
auto_page_seg_ret_val = AutoPageSeg(
pageseg_mode, blocks, &to_blocks,
enable_noise_removal ? &diacritic_blobs : nullptr, osd_tess, osr);
if (pageseg_mode == PSM_OSD_ONLY)
return auto_page_seg_ret_val;
// To create blobs from the image region bounds uncomment this line:
// to_blocks.clear(); // Uncomment to go back to the old mode.
} else {
deskew_ = FCOORD(1.0f, 0.0f);
reskew_ = FCOORD(1.0f, 0.0f);
if (pageseg_mode == PSM_CIRCLE_WORD) {
Pix* pixcleaned = RemoveEnclosingCircle(pix_binary_);
if (pixcleaned != nullptr) {
pixDestroy(&pix_binary_);
pix_binary_ = pixcleaned;
}
}
}
if (auto_page_seg_ret_val < 0) {
return -1;
}
if (blocks->empty()) {
if (textord_debug_tabfind)
tprintf("Empty page\n");
return 0; // AutoPageSeg found an empty page.
}
bool splitting =
pageseg_devanagari_split_strategy != ShiroRekhaSplitter::NO_SPLIT;
bool cjk_mode = textord_use_cjk_fp_model;
textord_.TextordPage(pageseg_mode, reskew_, width, height, pix_binary_,
pix_thresholds_, pix_grey_, splitting || cjk_mode,
&diacritic_blobs, blocks, &to_blocks);
return auto_page_seg_ret_val;
}
/**
* Auto page segmentation. Divide the page image into blocks of uniform
* text linespacing and images.
*
* Resolution (in ppi) is derived from the input image.
*
* The output goes in the blocks list with corresponding TO_BLOCKs in the
* to_blocks list.
*
* If !PSM_COL_FIND_ENABLED(pageseg_mode), then no attempt is made to divide
* the image into columns, but multiple blocks are still made if the text is
* of non-uniform linespacing.
*
* If diacritic_blobs is non-null, then diacritics/noise blobs, that would
* confuse layout analysis by causing textline overlap, are placed there,
* with the expectation that they will be reassigned to words later and
* noise/diacriticness determined via classification.
*
* If osd (orientation and script detection) is true then that is performed
* as well. If only_osd is true, then only orientation and script detection is
* performed. If osd is desired, (osd or only_osd) then osr_tess must be
* another Tesseract that was initialized especially for osd, and the results
* will be output into osr (orientation and script result).
*/
int Tesseract::AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST* blocks,
TO_BLOCK_LIST* to_blocks,
BLOBNBOX_LIST* diacritic_blobs, Tesseract* osd_tess,
OSResults* osr) {
Pix* photomask_pix = nullptr;
Pix* musicmask_pix = nullptr;
// The blocks made by the ColumnFinder. Moved to blocks before return.
BLOCK_LIST found_blocks;
TO_BLOCK_LIST temp_blocks;
ColumnFinder* finder = SetupPageSegAndDetectOrientation(
pageseg_mode, blocks, osd_tess, osr, &temp_blocks, &photomask_pix,
pageseg_apply_music_mask ? &musicmask_pix : nullptr);
#if 1
pixDestroy(&photomask_pix);
pixDestroy(&musicmask_pix);
return 0;
#else
int result = 0;
if (finder != nullptr) {
TO_BLOCK_IT to_block_it(&temp_blocks);
TO_BLOCK* to_block = to_block_it.data();
if (musicmask_pix != nullptr) {
// TODO(rays) pass the musicmask_pix into FindBlocks and mark music
// blocks separately. For now combine with photomask_pix.
pixOr(photomask_pix, photomask_pix, musicmask_pix);
}
if (equ_detect_) {
finder->SetEquationDetect(equ_detect_);
}
result = finder->FindBlocks(pageseg_mode, scaled_color_, scaled_factor_,
to_block, photomask_pix, pix_thresholds_,
pix_grey_, &pixa_debug_, &found_blocks,
diacritic_blobs, to_blocks);
if (result >= 0)
finder->GetDeskewVectors(&deskew_, &reskew_);
delete finder;
}
pixDestroy(&photomask_pix);
pixDestroy(&musicmask_pix);
if (result < 0) return result;
blocks->clear();
BLOCK_IT block_it(blocks);
// Move the found blocks to the input/output blocks.
block_it.add_list_after(&found_blocks);
return result;
#endif
}
// Helper adds all the scripts from sid_set converted to ids from osd_set to
// allowed_ids.
static void AddAllScriptsConverted(const UNICHARSET& sid_set,
const UNICHARSET& osd_set,
GenericVector<int>* allowed_ids) {
for (int i = 0; i < sid_set.get_script_table_size(); ++i) {
if (i != sid_set.null_sid()) {
const char* script = sid_set.get_script_from_script_id(i);
allowed_ids->push_back(osd_set.get_script_id_from_name(script));
}
}
}
/**
* Sets up auto page segmentation, determines the orientation, and corrects it.
* Somewhat arbitrary chunk of functionality, factored out of AutoPageSeg to
* facilitate testing.
* photo_mask_pix is a pointer to a nullptr pointer that will be filled on return
* with the leptonica photo mask, which must be pixDestroyed by the caller.
* to_blocks is an empty list that will be filled with (usually a single)
* block that is used during layout analysis. This ugly API is required
* because of the possibility of a unlv zone file.
* TODO(rays) clean this up.
* See AutoPageSeg for other arguments.
* The returned ColumnFinder must be deleted after use.
*/
ColumnFinder* Tesseract::SetupPageSegAndDetectOrientation(
PageSegMode pageseg_mode, BLOCK_LIST* blocks, Tesseract* osd_tess,
OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
Pix** music_mask_pix) {
int vertical_x = 0;
int vertical_y = 1;
TabVector_LIST v_lines;
TabVector_LIST h_lines;
ICOORD bleft(0, 0);
ASSERT_HOST(pix_binary_ != nullptr);
if (tessedit_dump_pageseg_images) {
pixa_debug_.AddPix(pix_binary_, "PageSegInput");
}
// Leptonica is used to find the rule/separator lines in the input.
LineFinder::FindAndRemoveLines(source_resolution_,
textord_tabfind_show_vlines, pix_binary_,
&vertical_x, &vertical_y, music_mask_pix,
&v_lines, &h_lines);
if (tessedit_dump_pageseg_images) {
pixa_debug_.AddPix(pix_binary_, "NoLines");
}
// Leptonica is used to find a mask of the photo regions in the input.
*photo_mask_pix = ImageFind::FindImages(pix_binary_, &pixa_debug_);
if (tessedit_dump_pageseg_images) {
pixa_debug_.AddPix(pix_binary_, "NoImages");
}
if (!PSM_COL_FIND_ENABLED(pageseg_mode)) v_lines.clear();
// The rest of the algorithm uses the usual connected components.
textord_.find_components(pix_binary_, blocks, to_blocks);
TO_BLOCK_IT to_block_it(to_blocks);
// There must be exactly one input block.
// TODO(rays) handle new textline finding with a UNLV zone file.
ASSERT_HOST(to_blocks->singleton());
TO_BLOCK* to_block = to_block_it.data();
TBOX blkbox = to_block->block->pdblk.bounding_box();
ColumnFinder* finder = nullptr;
int estimated_resolution = source_resolution_;
if (source_resolution_ == kMinCredibleResolution) {
// Try to estimate resolution from typical body text size.
int res = IntCastRounded(to_block->line_size * kResolutionEstimationFactor);
if (res > estimated_resolution && res < kMaxCredibleResolution) {
estimated_resolution = res;
tprintf("Estimating resolution as %d\n", estimated_resolution);
}
}
if (to_block->line_size >= 2) {
finder = new ColumnFinder(static_cast<int>(to_block->line_size),
blkbox.botleft(), blkbox.topright(),
estimated_resolution, textord_use_cjk_fp_model,
textord_tabfind_aligned_gap_fraction, &v_lines,
&h_lines, vertical_x, vertical_y);
finder->SetupAndFilterNoise(pageseg_mode, *photo_mask_pix, to_block);
#ifndef DISABLED_LEGACY_ENGINE
if (equ_detect_) {
equ_detect_->LabelSpecialText(to_block);
}
BLOBNBOX_CLIST osd_blobs;
// osd_orientation is the number of 90 degree rotations to make the
// characters upright. (See osdetect.h for precise definition.)
// We want the text lines horizontal, (vertical text indicates vertical
// textlines) which may conflict (eg vertically written CJK).
int osd_orientation = 0;
bool vertical_text = textord_tabfind_force_vertical_text ||
pageseg_mode == PSM_SINGLE_BLOCK_VERT_TEXT;
if (!vertical_text && textord_tabfind_vertical_text &&
PSM_ORIENTATION_ENABLED(pageseg_mode)) {
vertical_text =
finder->IsVerticallyAlignedText(textord_tabfind_vertical_text_ratio,
to_block, &osd_blobs);
}
if (PSM_OSD_ENABLED(pageseg_mode) && osd_tess != nullptr && osr != nullptr) {
GenericVector<int> osd_scripts;
if (osd_tess != this) {
// We are running osd as part of layout analysis, so constrain the
// scripts to those allowed by *this.
AddAllScriptsConverted(unicharset, osd_tess->unicharset, &osd_scripts);
for (int s = 0; s < sub_langs_.size(); ++s) {
AddAllScriptsConverted(sub_langs_[s]->unicharset,
osd_tess->unicharset, &osd_scripts);
}
}
os_detect_blobs(&osd_scripts, &osd_blobs, osr, osd_tess);
if (pageseg_mode == PSM_OSD_ONLY) {
delete finder;
return nullptr;
}
osd_orientation = osr->best_result.orientation_id;
double osd_score = osr->orientations[osd_orientation];
double osd_margin = min_orientation_margin * 2;
for (int i = 0; i < 4; ++i) {
if (i != osd_orientation &&
osd_score - osr->orientations[i] < osd_margin) {
osd_margin = osd_score - osr->orientations[i];
}
}
int best_script_id = osr->best_result.script_id;
const char* best_script_str =
osd_tess->unicharset.get_script_from_script_id(best_script_id);
bool cjk = best_script_id == osd_tess->unicharset.han_sid() ||
best_script_id == osd_tess->unicharset.hiragana_sid() ||
best_script_id == osd_tess->unicharset.katakana_sid() ||
strcmp("Japanese", best_script_str) == 0 ||
strcmp("Korean", best_script_str) == 0 ||
strcmp("Hangul", best_script_str) == 0;
if (cjk) {
finder->set_cjk_script(true);
}
if (osd_margin < min_orientation_margin) {
// The margin is weak.
if (!cjk && !vertical_text && osd_orientation == 2) {
// upside down latin text is improbable with such a weak margin.
tprintf("OSD: Weak margin (%.2f), horiz textlines, not CJK: "
"Don't rotate.\n", osd_margin);
osd_orientation = 0;
} else {
tprintf(
"OSD: Weak margin (%.2f) for %d blob text block, "
"but using orientation anyway: %d\n",
osd_margin, osd_blobs.length(), osd_orientation);
}
}
}
osd_blobs.shallow_clear();
finder->CorrectOrientation(to_block, vertical_text, osd_orientation);
#endif // ndef DISABLED_LEGACY_ENGINE
}
return finder;
}
} // namespace tesseract.