-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I tryed to read base64 image with OCR without success. I use the capacitor camera and it worked well when i used :
resultType: CameraResultType.Uri,
Then:
const imageUrl = photo.webPath;
this.lines = await this.processImage(imageUrl);
My processImage function for base64:
async processImage(base64: string): Promise<string[]> {
const data: TextDetections = await Ocr.detectText({ base64});
// I Also try
const data: TextDetections = await Ocr.detectText({base64: base64});
And the rest of the code to make it work.
But if i try to send base64 data
resultType: CameraResultType.Base64,
const imageUrl = 'data:image/jpeg;base64,'+base64Image; (the console.log see the base64data)
this.lines = await this.processImage(imageUrl);
The ProcessingImage function:
sync processImage(filename: string): Promise<string[]> {
const data: TextDetections = await Ocr.detectText({ filename });
The rest of the code.
If i use the name "filename" and .Uri from Capacitor Camera it will work.
If i use the name "base64" and .Base64 from Capacitor Camera it will not work.
Error: src/app/home/home.page.ts:388:56 - error TS2345: Argument of type '{ base64: string; }' is not assignable to parameter of type 'DetectTextOptions'.
Object literal may only specify known properties, and 'base64' does not exist in type 'DetectTextOptions'.
388 const data: TextDetections = await Ocr.detectText({base64: base64});
I also do not know what to do with these options and if i need it to make it work, (Not very well explained)
DetectTextFileOptions | DetectTextBase64Options
I cannot find any example to make it work with base64 data and i didn't find one anywhere.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels