Coder Social home page Coder Social logo

react-native support? about tesseract.js HOT 30 CLOSED

naptha avatar naptha commented on August 28, 2024 14
react-native support?

from tesseract.js.

Comments (30)

arheom avatar arheom commented on August 28, 2024 51

+1 for react-native support.

from tesseract.js.

AlexisLeon avatar AlexisLeon commented on August 28, 2024 20

Hi everyone, I'm currently working to add support for react native.
I already fixed the JavaScript workers issue and I'm working on how to implement the HTML Image API.

Will be very helpful to know what's the flow in loadImage for node and browser.

from tesseract.js.

MeKyleH avatar MeKyleH commented on August 28, 2024 14

Any update on the RN support?

from tesseract.js.

AlexisLeon avatar AlexisLeon commented on August 28, 2024 5

@mikasjoman @alburdette619 Almost there..
screen shot 2017-11-04 at 12 17 59 am

  • JS Worker

from tesseract.js.

alburdette619 avatar alburdette619 commented on August 28, 2024 2

@jonathanpalma oh looks like they got iOS implementation in, that's what was holding me up. I'll take a further look asap.

from tesseract.js.

jeromewu avatar jeromewu commented on August 28, 2024 2

@broros I tried to use webview and sadly there is a out of memory error... (just like in Cordova)

I think it is a dead end for using tesseract.js in webview, I would recommend to use the native one in Android or iOS, here is a library that leverages native tesseract-ocr in react-native: https://github.com/jonathanpalma/react-native-tesseract-ocr

from tesseract.js.

jonathanpalma avatar jonathanpalma commented on August 28, 2024 1

I would like to know if somebody could help us to have a look at @daominhsangvn's fork and provide some feedback about it. @AlexisLeon @nikita-pankratov @sanchezzzhak @alburdette619 @mikasjoman @arheom @enapupe @rgoldiez @bijection @bartvanremortele

from tesseract.js.

jopicornell avatar jopicornell commented on August 28, 2024 1

Hey @AlexisLeon, where is your code published? I'm interested in working on this allowing us to not depend on node/browser native apis without having to eject. Let's see if it's possible!

from tesseract.js.

bartvanremortele avatar bartvanremortele commented on August 28, 2024

The packager goes out of memory when importing tesseract.js-core
schermafbeelding 2016-10-18 om 12 30 35
schermafbeelding 2016-10-18 om 12 29 15

from tesseract.js.

bartvanremortele avatar bartvanremortele commented on August 28, 2024

So I ran some more tests. I bumped the memory limit of the packager by changing the following lines:

node "$THIS_DIR/../local-cli/cli.js" start "$@"

to

node --max_old_space_size=4096 "$THIS_DIR/../local-cli/cli.js" start "$@"

in file:

node_modules/react-native/packager/packager.sh

and

$NODE_BINARY "$REACT_NATIVE_DIR/local-cli/cli.js" bundle \
  --entry-file "$ENTRY_FILE" \
  --platform ios \
  --dev $DEV \
  --reset-cache \
  --bundle-output "$BUNDLE_FILE" \
  --assets-dest "$DEST"

to

$NODE_BINARY \
  --expose-gc \
  --max_old_space_size=4096 \
"$REACT_NATIVE_DIR/local-cli/cli.js" bundle \
  --entry-file "$ENTRY_FILE" \
  --platform ios \
  --dev $DEV \
  --reset-cache true \
  --bundle-output "$BUNDLE_FILE" \
  --assets-dest "$DEST"

in file:
node_modules/react-native/packager/react-native-xcode.sh

which resulted in a timeout:
schermafbeelding 2016-10-18 om 13 25 55

I don't know that much about react-native but maybe there is a way to include Tesseract.js core like they do with other tesseract native wrappers and bypassing the packager.

https://github.com/jonathanpalma/react-native-tesseract-ocr

from tesseract.js.

bijection avatar bijection commented on August 28, 2024

have you tried adjusting the timeout as the error suggests?

from tesseract.js.

enapupe avatar enapupe commented on August 28, 2024

Considering Tesseract.js currently requires node v6.8.0 or greater., I suppose there's no support for it on react native, since reactnative runs JavaScriptCore..
The question to ask: which APIs or features Tesseract.js depends on? if we are talking about some native node apis, there's probably polyfills avaialble...

from tesseract.js.

rgoldiez avatar rgoldiez commented on August 28, 2024

Anyone get this to work with React Native?

from tesseract.js.

enapupe avatar enapupe commented on August 28, 2024

So, I went through this a little bit more and aside from the location dependency, which is easy to workaround, tesseract heavily depends on workers (which I managed to polyfill) (https://www.w3.org/TR/workers/) and some Image api to get the binary image data - which seems impossible to do in react-native.

For the people interested in continuing this quest: there's currently 2 "drivers" implementations of this package: browser and node. Ideally you would start one from scratch, calling it react-native and linking it on package.json under react-native section (there's a similar thing going on with browser). The gotcha now is finding a way to load image binary data and forward it to tesseract.

from tesseract.js.

enapupe avatar enapupe commented on August 28, 2024

BTW. I tried to make it work by adapting the current browser implementation. But there's really no good starting point. Both implementation (node & browser) heavily use their own APIS which are NOT available in react-native context.

from tesseract.js.

mikasjoman avatar mikasjoman commented on August 28, 2024

@AlexisLeon keep us updated with the progress :) Looking forward to implement this in my RN app!

from tesseract.js.

alburdette619 avatar alburdette619 commented on August 28, 2024

@AlexisLeon How's it going? Do you have anything published yet or need any help?

from tesseract.js.

sanchezzzhak avatar sanchezzzhak commented on August 28, 2024

can it help?
https://medium.com/@aakashns/using-core-node-js-modules-in-react-native-apps-64acd4d07140

from tesseract.js.

nikita-pankratov avatar nikita-pankratov commented on August 28, 2024

@AlexisLeon +1 looking forward to it. what is the status? do you need any help?

from tesseract.js.

AlexisLeon avatar AlexisLeon commented on August 28, 2024

@nikita-pankratov I'll publish my code soon.
I implemented the Workers in RN via Native Modules, now I'm looking for a way to implement the Image API, but it's getting tough. Any ideas?

from tesseract.js.

maciejrrr avatar maciejrrr commented on August 28, 2024

@AlexisLeon Any updates on workers? Maybe you can find solution for Image here expo/browser-polyfill.

from tesseract.js.

devgunyogesh avatar devgunyogesh commented on August 28, 2024

@AlexisLeon Any update if it supports React Native now?

from tesseract.js.

AlexisLeon avatar AlexisLeon commented on August 28, 2024

@mradziwon @devgunyogesh Nope, still looking for Image api solution, Workers are native modules

from tesseract.js.

Talalisi avatar Talalisi commented on August 28, 2024

@AlexisLeon did you find a solution for React Native support ?

from tesseract.js.

AlexisLeon avatar AlexisLeon commented on August 28, 2024

@Talalisi no 😞
Sadly for us there is not support (yet) for the js Image API
To implement OCR I decided to send the image to an API (Node.js) and return the extracted text

from tesseract.js.

callmejm avatar callmejm commented on August 28, 2024

any update for this awesome library use in react-native ?

from tesseract.js.

 avatar commented on August 28, 2024

maybe use WebAssembly

from tesseract.js.

jeromewu avatar jeromewu commented on August 28, 2024

I would like to close this issue for now as it is not possible for tesseract.js to support react-native now.

The key issue we faced is that react-native have a poor support for asm.js and no support for webassembly now, so it is impossible to use tesseract.js in react-native (of course tesseract.js works in WebView, but it is not "native").

Cross our finger and hope one day we can reopen this issue with more support from react-native.

from tesseract.js.

 avatar commented on August 28, 2024

@jeromewu do you have an example of how this should work with webView?

from tesseract.js.

wilson0x4d avatar wilson0x4d commented on August 28, 2024

bummer.

from tesseract.js.

Related Issues (20)

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.