Comments (2)
I think you have two options:
- The
detect_multiple_in_luma
function. In order to use that you will need to convert the RGB data to luminosity. An example of how this is done from an array of RGB data is available in the rxing-wasm crate, but keep in mind that this example is specifically designed to work with JavaScript RGBA values, and may not apply to what you are using. This might not be exactly what you want, though, since you already seem to be using the Image create to pull the image out of the memory buffer. That leads us to the second option. - Skip using the helper functions and create your barcode decoder yourself. The helper functions are just a wrapper around the library’s core structs and traits. You can look at the code for the helper functions to see how they are doing it.
let img = image::open(file_name)
.map_err(|e| Exceptions::runtime_with(format!("couldn't read {file_name}: {e}")))?;
let multi_format_reader = MultiUseMultiFormatReader::default();
let mut scanner = GenericMultipleBarcodeReader::new(multi_format_reader);
hints
.entry(DecodeHintType::TRY_HARDER)
.or_insert(DecodeHintValue::TryHarder(true));
scanner.decode_multiple_with_hints(
&mut BinaryBitmap::new(HybridBinarizer::new(BufferedImageLuminanceSource::new(img))),
hints,
)
So in this case you can see that you have an image already, so you should be able to skip the helper functions and access the library directly. This would be my preferred solution in your case, as it gives you more options on how you work with the library.
Another point, above you can see that we create a MultiUseMultiFormatReader
which is the type of reader used when you intend to use the reader over and over again, so you would create that reader outside of your frame handling loop, and then call the decode_multiple_with_hints
function of it inside the loop to decode the barcodes. Also note that the you had picked the “detect multiple” option, which is why I used the code for that, if you only think there is one barcode per image then you would use slightly different (and faster) code.
Feel free to reach out again if you have more questions.
from rxing.
Closing for now, please re-open if you need additional help.
from rxing.
Related Issues (20)
- Add special case reader for multiple reuse situations
- Enable all ECI encodings HOT 1
- Library should support MicroQR HOT 1
- Port Updated qrcode decode / detect from zxing-cpp HOT 3
- detect_in_luma supports only square input HOT 14
- get in BitMatrix goes out of bounds for Maxicode in certain image. HOT 4
- encoding pdf417_compact has extra white space HOT 2
- Barcode rotate bug HOT 2
- rxing-cli fails to build HOT 2
- Index out of bounds in FitQadrilateralToPoints try_get_range HOT 4
- Join forces with zxing-cpp? HOT 11
- Support Telepen barcodes for reading and writing HOT 7
- Move to a more “rust” appropriate DecodeOptions approach
- Performance Tuning
- Bug with aztec binary data? HOT 4
- The multiple barcodes decoder issue HOT 5
- Brazillian barcode not being decoded HOT 4
- Pure ITF barcode not being decoded HOT 3
- Multiple barcode decoder issue HOT 4
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 rxing.