Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need full screen camera and the scanning for barcode should be done in between a rectangular square #54

Open
urlAkash opened this issue Dec 24, 2015 · 14 comments

Comments

@urlAkash
Copy link

How to make a middle section of the camera activity bordered and the scanning should be done between that section!!

@pm0733464
Copy link
Contributor

Maybe this would help?:

#23

@khurramengr
Copy link

@urlAkash did you find any solution, i am looking for exactly same thing?

@AkashAndi
Copy link

@khurramengr Kindly look this link
http://stackoverflow.com/questions/32999813/preview-size-for-barcode-scanner-from-vision-api/34156158#34156158

And for rectangular square, You have to draw one rectangular at camera activity java file

@khurramengr
Copy link

khurramengr commented Jul 25, 2016

@urlAkash that's what I've already done, i need to know how do we feed the Bar Code Scanning Algorithm some portion(the portion which is inside the rectangle) of each Camera frame so that it processes only that specific region for BarCode and not the entire frame.
To be more specific take a look inside the CameraSource class

outputFrame = new Frame.Builder()
                        .setImageData(mPendingFrameData, mPreviewSize.getWidth(),
                                mPreviewSize.getHeight(), ImageFormat.NV21)
                        .setId(mPendingFrameId)
                        .setTimestampMillis(mPendingTimeMillis)
                        .setRotation(mRotation)
                        .build();

here we are building the Frame from mPendingFrameData, which is the entire frame data from camera.

I need to know how do we crop the frame here so that we could send the cropped Frame to this code

 try {
                mDetector.receiveFrame(outputFrame);
            } catch (Throwable t) {
                Log.e(TAG, "Exception thrown from receiver.", t);
            } finally {
                mCamera.addCallbackBuffer(data.array());
            }

@urlAkash
Copy link
Author

When I had drawn a border on the camera activity,

The barcode will get scanned if it is within that border(ROI).

I didn't coded anything to make scanning between that region of interest
but I don't know why it happens.

I had just drawn one Rectangle box above the camera activity and then when
I scan a barcode, It would be scanned if it is within the ROI.

I don't know why but it happens.

But after making it full screen the aspect ratio doesn't remains well,
that's why I had made the camera view as of 4:3 Ratio Height and Width
then it looks fine.

Thanks & Regards,

Akash Dubey,

URL Software Global Inc

On Mon, Jul 25, 2016 at 9:29 PM, Khurram Shehzad [email protected]
wrote:

@urlAkash https://github.com/urlAkash that's what I've already done, i
need to know how do we feed the Bar Code Scanning Algorithm some
portion(the portion which is inside the rectangle) of each Camera frame so
that it processes only that specific region for BarCode and not the entire
frame.
To be more specific take a look inside the CameraSource class

outputFrame = new Frame.Builder()
.setImageData(mPendingFrameData, mPreviewSize.getWidth(),
mPreviewSize.getHeight(), ImageFormat.NV21)
.setId(mPendingFrameId)
.setTimestampMillis(mPendingTimeMillis)
.setRotation(mRotation)
.build();
here we are building the Frame from mPendingFrameData, which is the
entire frame data from camera.
I need to know how do we crop the frame here so that we could send the
cropped Frame to this code
try {
mDetector.receiveFrame(outputFrame);
} catch (Throwable t) {
Log.e(TAG, "Exception thrown from receiver.", t);
} finally {
mCamera.addCallbackBuffer(data.array());
}


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#54 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APqqozd-HXL0Gkofk8SueryJYgXNAqPHks5qZN1dgaJpZM4G7FWp
.

@khurramengr
Copy link

In my case i had multiple bar codes in a single frame of camera but when i try to scan that frame it picks up some random bar code(which was outside the rectangle), i am currently looking for mechanism through which i could crop the Frame before passing to the BarCodeScanner.
In your case of Aspect Ratio issue try out this wrapper of vision API https://github.com/EdwardvanRaak/MaterialBarcodeScanner, this guy has done some pretty good job to adjust the CameraPreview with proper aspect ratio.

@dibakarece
Copy link

dibakarece commented Oct 12, 2016

Hi, khurramengr have you got any solution. I have also a same requirement.In my camera preview there are multiple bar code present but I need only center one witch is in my custom rectangle( like zxing lib sample).I have done something with vision API. But it always detect random one.

https://cloud.githubusercontent.com/assets/10453203/19023016/e7ee57be-8901-11e6-8215-aef5fcf58d99.png

@khurramengr
Copy link

You'll have to manually process the frames before feeding them to
FrameProcessor, i.e construct the Bitmap from available data and then
process that bitmap somehow that it contains your region of interest only,
and then feed that bitmap to FrameProcessor.

On Wed, Oct 12, 2016 at 4:18 PM, Dibakar Mistry [email protected]
wrote:

Hi, khurramengr have you got any solution. I have also a same
requirement.In my camera preview there are multiple barcode present but I
need only center one witch is in my custom rectangle.

https://cloud.githubusercontent.com/assets/10453203/19023016/e7ee57be-
8901-11e6-8215-aef5fcf58d99.png


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#54 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEBWdxzLRcfVOTnxkjkfplygt3ztYA5Oks5qzMHrgaJpZM4G7FWp
.

Best Regards

Khurram Shehzad
Computer Engineer ( University of Engineering & Technology (UET) Taxila )

@nrazon
Copy link

nrazon commented Jan 7, 2017

@khurramengr Any sample code to do this? Need to limit detection area due to multiple barcodes inside same frame.

@WilsonCP
Copy link

WilsonCP commented Nov 27, 2019

anyone has a solution to this? I, too have a multiple QR on screen. I've noticed that having 4 or more, the scanner cannot read the other. problem there is need to read them all one after another.

@visionfaysal
Copy link

visionfaysal commented Nov 27, 2019 via email

@AmilaCG
Copy link

AmilaCG commented Apr 15, 2020

@nrazon @khurramengr @urlAkash see here
http://stackoverflow.com/questions/32299947/mobile-vision-api-concatenate-new-detector-object-to-continue-frame-processing/43915078#43915078

This seems to be a good solution. I'll look into this. Thanks! I'm also stumbled accross this problem and now looking for a solution.

@Ashmeeto4s
Copy link

Anybody found any solution guys? The above workaround also not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests