Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Crash in TessBaseAPI.setImage() #194

Closed
privatez opened this issue Feb 22, 2017 · 2 comments
Closed

Crash in TessBaseAPI.setImage() #194

privatez opened this issue Feb 22, 2017 · 2 comments

Comments

@privatez
Copy link

privatez commented Feb 22, 2017

When i use TessBaseAPI.setImage(byte[] imagedata, int width, int height, int bpp, int bpl).
The app will crash in this api.
Log:

02-22 09:45:15.711 I/DEBUG ( 374): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-22 09:45:15.711 I/DEBUG ( 374): Build fingerprint: 'Xiaomi/ido/ido:5.1.1/LMY47V/V8.1.1.0.LAICNDI:user/release-keys'
02-22 09:45:15.711 I/DEBUG ( 374): Revision: '0'
02-22 09:45:15.711 I/DEBUG ( 374): ABI: 'arm64'
02-22 09:45:15.711 I/DEBUG ( 374): pid: 563, tid: 1264, name: AsyncTask #1 >>> <<<
02-22 09:45:15.711 I/DEBUG ( 374): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x55800fd000
02-22 09:45:15.731 I/DEBUG ( 374): x0 00000000000001b3 x1 0000000000000000 x2 0000000000000000 x3 0000000000000010
02-22 09:45:15.731 I/DEBUG ( 374): x4 fffffffffffffff0 x5 0000000000000040 x6 000000000000003f x7 0000000000000000
02-22 09:45:15.731 D/mm-camera( 412): cpp_hardware_process_frame:1047] stream_status:0xab3fa334, iden:0x10002, stream type: 1,cur_frame_id:130
02-22 09:45:15.731 I/DEBUG ( 374): x8 0000000000000011 x9 00000000000006cc x10 00000000000006cc x11 0000000000000414
02-22 09:45:15.731 I/DEBUG ( 374): x12 00000000000000ae x13 00000055800fd000 x14 0000000000000000 x15 0000000000000000
02-22 09:45:15.731 I/DEBUG ( 374): x16 0000000000000000 x17 0000007f69667360 x18 0000000000000640 x19 000000557ffcdeb0
02-22 09:45:15.741 I/DEBUG ( 374): x20 00000000000000a0 x21 00000000000001b3 x22 0000007f67ab339c x23 00000055800fcbec
02-22 09:45:15.741 I/DEBUG ( 374): x24 00000000000006cc x25 0000000000000020 x26 000000557ffcdf00 x27 600293cf926af5a8
02-22 09:45:15.741 I/DEBUG ( 374): x28 0000000000007118 x29 0000007f67bf33c0 x30 0000007f69016420
02-22 09:45:15.741 I/DEBUG ( 374): sp 0000007f67bf3360 pc 0000007f690164c8 pstate 0000000020000000
02-22 09:45:15.741 I/DEBUG ( 374):
02-22 09:45:15.741 I/DEBUG ( 374): backtrace:
02-22 09:45:15.741 I/DEBUG ( 374): #00 pc 00000000000f94c8 /data/app/com/lib/arm64/libtess.so (_ZN9tesseract16ImageThresholder8SetImageEPKhiiii+300)
02-22 09:45:15.741 E/mm-camera( 412): End of measure Total 4 ms
02-22 09:45:15.741 I/DEBUG ( 374): #1 pc 000000000022ecd0 /data/app/com/lib/arm64/libtess.so (Java_com_googlecode_tesseract_android_TessBaseAPI_nativeSetImageBytes+304)
02-22 09:45:15.741 I/DEBUG ( 374): #2 pc 000000000000e09c /data/data/com/cache/slice-com.rmtheis-tess-two-6.2.0_438362aa1e26cd70c4ba6f307c0ffd37c33b0543-classes.dex

Tess-two version used:
6.2.0

@privatez
Copy link
Author

privatez commented Feb 22, 2017

And i can't find any example for the Api TessBaseAPI.setImage(byte[] imagedata, int width, int height, int bpp, int bpl).
How to use this API?

In my guess:

int perPixelByte = bitmap.getByteCount() / (bitmap.getWidth() * bitmap.getHeight());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte[] data = baos.toByteArray();
try {
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
mTessBaseAPI.setImage(data, bitmap.getWidth(), bitmap.getHeight(), perPixelByte, bitmap.getRowBytes());

@rmtheis
Copy link
Owner

rmtheis commented Mar 21, 2017

Thanks for the crash report. Let's track this on #197.

@rmtheis rmtheis closed this as completed Mar 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants