Comments (30)
+1 for react-native support.
from tesseract.js.
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.
Any update on the RN support?
from tesseract.js.
@mikasjoman @alburdette619 Almost there..
- JS Worker
from tesseract.js.
@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.
@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.
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.
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.
The packager goes out of memory when importing tesseract.js-core
from tesseract.js.
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
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.
have you tried adjusting the timeout as the error suggests?
from tesseract.js.
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.
Anyone get this to work with React Native?
from tesseract.js.
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.
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.
@AlexisLeon keep us updated with the progress :) Looking forward to implement this in my RN app!
from tesseract.js.
@AlexisLeon How's it going? Do you have anything published yet or need any help?
from tesseract.js.
can it help?
https://medium.com/@aakashns/using-core-node-js-modules-in-react-native-apps-64acd4d07140
from tesseract.js.
@AlexisLeon +1 looking forward to it. what is the status? do you need any help?
from tesseract.js.
@nikita-pankratov I'll publish my code soon.
I implemented the Worker
s 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.
@AlexisLeon Any updates on workers? Maybe you can find solution for Image here expo/browser-polyfill.
from tesseract.js.
@AlexisLeon Any update if it supports React Native now?
from tesseract.js.
@mradziwon @devgunyogesh Nope, still looking for Image api solution, Workers
are native modules
from tesseract.js.
@AlexisLeon did you find a solution for React Native support ?
from tesseract.js.
@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.
any update for this awesome library use in react-native ?
from tesseract.js.
maybe use WebAssembly
from tesseract.js.
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.
@jeromewu do you have an example of how this should work with webView?
from tesseract.js.
bummer.
from tesseract.js.
Related Issues (20)
- `Tesseract.recognize` returns empty string in `data.text` HOT 6
- Missing "languages" attributes on default export HOT 1
- Switch from CommonJS to ESM modules HOT 3
- setImage is re-run unnecessarily when rotateAuto is enabled
- `debug` output missing from types HOT 1
- Custom traindata do not work HOT 2
- possibility to capture stderr HOT 3
- JSDelivr CDN not accessible in China HOT 8
- Large images cause excessive memory usage HOT 2
- Worker stuck on "loading language traineddata" HOT 4
- Updated types to infer output formats
- Inference of Chinese handwritten characters is bad HOT 3
- Add line size metrics (ascender, descender, size) to `line` objects in `blocks` output HOT 1
- Font attributes incorrect even when font is properly identified (`is_italic`, `is_serif`, etc.) HOT 3
- Focusing area HOT 1
- Multiple issues: Discussion
- Disable non-text output formats by default
- Tesseract - Running in Browser Console HOT 1
- Execution `worker.recognize` repeatedly causes "Out of Memory" error in JSFiddle HOT 5
- Error: Network error while fetching HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tesseract.js.