ocr encoding fix & 2.1.2 release
This commit is contained in:
@@ -49,7 +49,7 @@ import com.uns.maincar.cpp_interface.TrafficSign;
|
||||
import com.uns.maincar.tools.ImageReleaser;
|
||||
import com.uns.maincar.tools.OCRDataReleaser;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -309,7 +309,18 @@ public class MainActivity extends AppCompatActivity
|
||||
{
|
||||
// String str = OCR.DecodeImage(currImage);
|
||||
String str = OCR.SelfTest(this);
|
||||
byte[] b_str = str.getBytes(StandardCharsets.UTF_8);
|
||||
byte[] b_str;
|
||||
try
|
||||
{
|
||||
b_str = str.getBytes("GBK");
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
ToastLog("GBK Encoding is Not Supported", false, true);
|
||||
CommandEncoder encoder = new CommandEncoder();
|
||||
dtc_client.Send(encoder.GenerateCommand(Commands.OCR_TEXT_FAILED, (byte) 0x00, (byte) 0x00, (byte) 0x00));
|
||||
return;
|
||||
}
|
||||
CommandEncoder encoder = new CommandEncoder();
|
||||
dtc_client.Send(encoder.GenerateCommand(Commands.OCR_TEXT_LENGTH, (byte) b_str.length, (byte) 0x00, (byte) b_str.length));
|
||||
for (int i = 0; i < b_str.length; i += 2)
|
||||
|
||||
Reference in New Issue
Block a user