How can I use python3 to get text information from MATLAB ocr ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zhenxiang Jin
el 23 de En. de 2020
Respondida: Shrinidhi KR
el 8 de Mayo de 2020
This is my simple code:
ocr_result = mat_eng.ocr(image_matlab,'Language','ChineseTraditional','TextLayout','Word');
print("ocr_result: ", ocr_result, ".")
I am using python and working with MATLAB library ocr. After the scanning, I get a <matlab.object object at 0x7fc0908e9490> for each word. I am trying to get its string information contains in "Text". However, I cannot directly use ocr_result.Text. it would report an error: AttributeError: 'matlab.object' object has no attribute 'Text'. How can I extract the string information out?
0 comentarios
Respuesta aceptada
Shrinidhi KR
el 8 de Mayo de 2020
import matlab.engine
eng = matlab.engine.start_matlab()
img = eng.imread('businessCard.png')
eng.workspace['ocr_text'] = eng.ocr(img)
print(eng.eval['ocr_text.Text'])
The parameters you have used in ocr function can be specified here as well normally as you have done. Just save the ocr object returned to matlab workspace and then access the text value from the object by eval function call.
Hope this helps!
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Call MATLAB from Python en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!