Code Monkey home page Code Monkey logo

Comments (3)

faithoflifedev avatar faithoflifedev commented on August 18, 2024 1

Hi @bisketashwin ,

I think your mistake is with the following line:

final jsonImage = JsonImage(imageUri: base64Image);

The imageUri attribute is meant to be set to a String value that points to the location of an image stores in a Google Storage bucket.

Try the following changes:

  final imageFile = File(imageFile!.path).readAsBytesSync();

// ...

  final annotatedResponses = await googleVision.annotate(
    requests: AnnotationRequests(
      requests: [
        AnnotationRequest(
            jsonImage: JsonImage(byteBuffer: imageFile.buffer),
            features: [
              Feature(maxResults: 10, type: AnnotationType.textDetection)
            ])
      ],
    ),
  );

Here are the results I get when I run the text_detection.dart example with your supplied image:

chris@wxyz-3 example % dart run text_detection.dart
checking...
ಟಿ ಕುಣಿದಾಡ
ವ
ಕನ್ನಡ ಎನೆ ಕುಣಿದಾಡುವುದಕ್ಕೆ
ಕನ್ನಡ ಎನೆ ಕುಣಿ ಕಿವಿ ನಿಮಿರುವುದು
LIFE IS HARD. IF WE GO DAY WISE
SOME DAYS ARE VERY HARD
SOME ARE VERY REWARDING
SO INSTED OF LONG TERM VIEW
PREFER DAY VIEW.
IT IS NEW DAY NEW POSSIBILITY
[{"x":-11,"y":-21}, {"x":1234,"y":-21}, {"x":1234,"y":1548}, {"x":-11,"y":1548}]
ಟಿ
[{"x":1,"y":118}, {"x":186,"y":105}, {"x":201,"y":327}, {"x":17,"y":340}]
ಕುಣಿದಾಡ
[{"x":344,"y":94}, {"x":1101,"y":40}, {"x":1117,"y":262}, {"x":360,"y":316}]
ವ
[{"x":1009,"y":480}, {"x":1047,"y":475}, {"x":1064,"y":603}, {"x":1027,"y":608}]
ಕನ್ನಡ
[{"x":140,"y":614}, {"x":339,"y":579}, {"x":361,"y":706}, {"x":162,"y":740}]
ಎನೆ
[{"x":392,"y":570}, {"x":485,"y":554}, {"x":507,"y":680}, {"x":414,"y":696}]
ಕುಣಿದಾಡುವುದಕ್ಕೆ
[{"x":520,"y":547}, {"x":977,"y":468}, {"x":999,"y":595}, {"x":542,"y":674}]
ಕನ್ನಡ
[{"x":174,"y":749}, {"x":386,"y":712}, {"x":406,"y":829}, {"x":195,"y":866}]
ಎನೆ
[{"x":429,"y":705}, {"x":530,"y":687}, {"x":551,"y":803}, {"x":449,"y":821}]
ಕುಣಿ
[{"x":559,"y":682}, {"x":696,"y":658}, {"x":716,"y":774}, {"x":579,"y":798}]
ಕಿವಿ
[{"x":715,"y":654}, {"x":805,"y":638}, {"x":825,"y":755}, {"x":736,"y":771}]
ನಿಮಿರುವುದು
[{"x":853,"y":630}, {"x":1128,"y":582}, {"x":1148,"y":699}, {"x":874,"y":747}]
LIFE
[{"x":205,"y":944}, {"x":354,"y":926}, {"x":360,"y":973}, {"x":211,"y":992}]
IS
[{"x":410,"y":922}, {"x":457,"y":916}, {"x":462,"y":959}, {"x":415,"y":965}]
HARD
[{"x":499,"y":910}, {"x":643,"y":891}, {"x":649,"y":939}, {"x":505,"y":958}]
.
[{"x":651,"y":913}, {"x":669,"y":910}, {"x":672,"y":932}, {"x":654,"y":935}]
IF
[{"x":695,"y":884}, {"x":747,"y":879}, {"x":751,"y":920}, {"x":699,"y":925}]
WE
[{"x":782,"y":881}, {"x":861,"y":875}, {"x":864,"y":913}, {"x":785,"y":919}]
GO
[{"x":889,"y":869}, {"x":959,"y":871}, {"x":958,"y":909}, {"x":888,"y":907}]
DAY
[{"x":985,"y":872}, {"x":1073,"y":878}, {"x":1070,"y":922}, {"x":982,"y":916}]
WISE
[{"x":1081,"y":881}, {"x":1181,"y":887}, {"x":1179,"y":928}, {"x":1079,"y":922}]
SOME
[{"x":212,"y":1036}, {"x":362,"y":1024}, {"x":366,"y":1084}, {"x":217,"y":1096}]
DAYS
[{"x":398,"y":1021}, {"x":530,"y":1011}, {"x":534,"y":1071}, {"x":403,"y":1081}]
ARE
[{"x":546,"y":1010}, {"x":656,"y":1001}, {"x":660,"y":1060}, {"x":551,"y":1069}]
VERY
[{"x":677,"y":1000}, {"x":834,"y":988}, {"x":838,"y":1047}, {"x":682,"y":1059}]
HARD
[{"x":860,"y":985}, {"x":1020,"y":973}, {"x":1024,"y":1032}, {"x":865,"y":1045}]
SOME
[{"x":235,"y":1142}, {"x":396,"y":1130}, {"x":400,"y":1184}, {"x":239,"y":1196}]
ARE
[{"x":439,"y":1126}, {"x":550,"y":1118}, {"x":554,"y":1171}, {"x":443,"y":1180}]
VERY
[{"x":594,"y":1115}, {"x":741,"y":1104}, {"x":745,"y":1157}, {"x":598,"y":1168}]
REWARDING
[{"x":773,"y":1101}, {"x":1091,"y":1077}, {"x":1095,"y":1130}, {"x":777,"y":1155}]
SO
[{"x":231,"y":1256}, {"x":293,"y":1249}, {"x":299,"y":1311}, {"x":238,"y":1318}]
INSTED
[{"x":330,"y":1245}, {"x":545,"y":1222}, {"x":551,"y":1283}, {"x":337,"y":1307}]
OF
[{"x":573,"y":1219}, {"x":640,"y":1212}, {"x":646,"y":1273}, {"x":580,"y":1281}]
LONG
[{"x":659,"y":1210}, {"x":810,"y":1194}, {"x":817,"y":1254}, {"x":666,"y":1271}]
TERM
[{"x":843,"y":1190}, {"x":993,"y":1174}, {"x":1000,"y":1234}, {"x":850,"y":1251}]
VIEW
[{"x":997,"y":1173}, {"x":1122,"y":1159}, {"x":1129,"y":1221}, {"x":1004,"y":1235}]
PREFER
[{"x":240,"y":1356}, {"x":484,"y":1326}, {"x":491,"y":1383}, {"x":247,"y":1414}]
DAY
[{"x":532,"y":1320}, {"x":636,"y":1307}, {"x":643,"y":1364}, {"x":539,"y":1377}]
VIEW
[{"x":660,"y":1304}, {"x":810,"y":1285}, {"x":817,"y":1343}, {"x":667,"y":1362}]
.
[{"x":833,"y":1283}, {"x":853,"y":1281}, {"x":860,"y":1337}, {"x":840,"y":1340}]
IT
[{"x":249,"y":1448}, {"x":324,"y":1439}, {"x":331,"y":1499}, {"x":256,"y":1508}]
IS
[{"x":346,"y":1441}, {"x":401,"y":1435}, {"x":407,"y":1492}, {"x":353,"y":1499}]
NEW
[{"x":444,"y":1429}, {"x":577,"y":1415}, {"x":583,"y":1472}, {"x":450,"y":1486}]
DAY
[{"x":611,"y":1410}, {"x":715,"y":1400}, {"x":720,"y":1461}, {"x":617,"y":1471}]
NEW
[{"x":748,"y":1397}, {"x":884,"y":1389}, {"x":887,"y":1446}, {"x":751,"y":1454}]
POSSIBILITY
[{"x":911,"y":1380}, {"x":1182,"y":1406}, {"x":1176,"y":1471}, {"x":905,"y":1445}]

from google_vision_workspace.

faithoflifedev avatar faithoflifedev commented on August 18, 2024 1

final annotatedResponses = await googleVision.annotate( requests: AnnotationRequests( requests: [ AnnotationRequest( jsonImage: JsonImage(byteBuffer: imageFile.buffer), features: [ Feature(maxResults: 10, type: AnnotationType.textDetection) ], imageContext: ImageContext( languageHints: ['kn', 'en-IN'], ), ), ], ), );

from google_vision_workspace.

bisketashwin avatar bisketashwin commented on August 18, 2024

Thank you.

I am not able to add 'imageContext': {
'languageHints': [
'kn',
'en-IN'
] // 'kn' for Kannada, 'en-IN' for English (India)
},

from google_vision_workspace.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.