-
Notifications
You must be signed in to change notification settings - Fork 54
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
Return box coordinates of scanned codes #52
Comments
Hi, glad you like the plugin! That is totally something I will implement into 2.0! In fact if you are proficient in flutter, Swift or Kotlin, I will gladly accept any pull request on the develop branch (will will become 2.0) :) |
I'm happy to contribute. I'll see if I can get this done in the next
week or so.
…On Sun, Dec 12, 2021, 8:54 AM jhoogstraat ***@***.***> wrote:
Hi, glad you like the plugin!
That is totally something I will implement into 2.0!
Just please bear with my, as I won't have time to work in the plugin until
next year, as I am in my critical phase of my masters thesis right now.
In fact if you are proficient in flutter, Swift or Kotlin, I will gladly
accept any pull request on the develop branch (will will become 2.0) :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHKLO5YED3UMLKCAUII2C3UQTATVANCNFSM5J3TYS5A>
.
|
@jhoogstraat , I'm working on this feature right now. I have one initial question as I look at this code. Is there a specific reason why the plugin only sends the first code it scans? @SuppressLint("UnsafeOptInUsageError")
private fun initialize(configuration: HashMap<String, Any>): Task<PreviewConfiguration> {
if (this.camera != null)
throw ScannerException.AlreadyInitialized()
val pluginBinding = this.pluginBinding ?: throw ScannerException.ActivityNotConnected()
val activityBinding = this.activityBinding ?: throw ScannerException.ActivityNotConnected()
val camera = Camera(
activityBinding.activity,
pluginBinding.textureRegistry.createSurfaceTexture(),
configuration
) { barcodes ->
// *** Question: should we return all the codes? *****
detectionEventSink?.success(encode(barcodes.first()))
}
this.camera = camera
activityBinding.addRequestPermissionsResultListener(camera)
return camera.requestPermissions()
.continueWithTask { camera.loadCamera() }
} In my use case, my drivers scan a packing label that may have multiple codes on it. The native functionality is to return a list of all visible codes. Would it be ok to just pass them all through? |
Yeah definitely. My use case just only required scanning one code at a time. Line 174 in 6104e14
|
@jhoogstraat , I'm continuing work today on this. I'm looking at the event channel messages we are sending between native and dart. Since I'm adding in coordinates and also passing through all the barcodes instead of just the first in the list, I'd like to move to something like Pigeon to make the platform communication easier. https://pub.dev/packages/pigeon. Any objections to this? |
I never worked with Pigeon. Does using it mean to rewrite the whole communication part between native and flutter? |
@jhoogstraat , thanks for the feedback. Pigeon is new to me, but I've been looking into it. But yes, Pigeon would replace the current communication layer with generated code. It looks to be a fairly large lift, so for now I'm going to first get box coordinates working for the single barcode with the communication layer as-is and then I'll probably open up a separate issue for supporting multiple barcodes at once. Pigeon makes more sense when supporting multiple codes I think. I'm almost done with drawing the boxes around the barcode. It took a little bit of thinking to make sure the coordinate translation is correct. I'm going to be adding a Do you have any additional requests or suggestions for customization? |
@jhoogstraat , I was thinking that I need to account for different camera orientations. The orientation system can often be confusing to me, so I apologize if I misunderstand, but it appears that the current code assumes portrait orientation? That seems to be how the native camera code is configured and he sample is locked into portrait. Is landscape orientation supposed to be supported for scanning? I'd actually be completely comfortable if we just support portrait orientation. That is the most conducive to effective scanning UI I think. But please let me know if I'm mistaken. |
Yeah, good idea to put Pigeon into another issue. One notion: You only need two coordinates (diagonals) to fully describe the rectangle. I dont know any code type that is not rectangular or square. I have to ask: Do you base your changes onto the main or the develop branch? Orientation and resolution are the hardest thing about cameras and viewfinders. I am okay with portrait only. |
@jhoogstraat , I'm based on develop right now. With regard to coordinates, I'm sending all 4 corners to provide a nice, neat fit. The codes are square, but if your camera is pointed at the code at an angle, the square code is skewed in the 2D image. sending all 4 corners allows us to match the camera skew. This is especially nice when the camera is rotated slightly. If you just draw the box it creates an upright box that circumscribes all the corners. This looks better: |
You are right, totally missed that! |
@jhoogstraat PR is up. |
* Android code coordinate implementation * ios code coordinate implementation * cleanup * resolve analysis warnings * fix method channel test * fix formatting of PreviewConfiguration.kt * remove analysis string in message channel * clean up kotlin code style * make overlay configurable * improve class naming * move coordinate conversion to swift plugin * make PreviewView not static * improve file and class naming
Hello,
I'm very pleased with this plugin. One thing that is missing for us is the ability to paint boxes around the scanned codes from the camera. I know MLKit reports the coordinates of the scanned codes, would it be possible to report coordinates along with the barcode values?
Thank you!
The text was updated successfully, but these errors were encountered: