Fix need to rotate android device to landscape to scan 1D barcodes, also fix focus and auto focus not being implemented#52
Conversation
|
Looks like a nice start, i need to take a closer look :) |
|
Can this get merged please? |
|
Hey, just curious if this is ready to be merged in or if there is some physical testing that needs to be done let me know and I am willing to do some testing on physical hardware. |
|
@Captnwalker1 The indentation looks wonky on Github. You might want to run the file through a formatter. |
| var factory = new SurfaceOrientedMeteringPointFactory(1f, 1f); | ||
| var fpoint = factory.CreatePoint(.5f, .5f); | ||
| var action = new FocusMeteringAction.Builder(fpoint,FocusMeteringAction.FlagAf) | ||
| //.DisableAutoCancel() |
| // Frame by frame analyze | ||
| imageAnalyzer = new ImageAnalysis.Builder() | ||
| .SetDefaultResolution(new Android.Util.Size(640, 480)) | ||
| .SetOutputImageRotationEnabled(true) |
There was a problem hiding this comment.
Shouldn't this be set based on some input?
I don't want it to auto-rotate if I initialise this:
new CameraBarcodeReaderView
{
Options = new BarcodeReaderOptions
{
AutoRotate = false,
Multiple = false,
}
}
|
|
||
| }), ContextCompat.GetMainExecutor(Context.Context)); //GetMainExecutor: returns an Executor that runs on the main thread. | ||
| AutoFocus(); | ||
| setupAutoFocusTimer(); |
There was a problem hiding this comment.
This seems like it adds a continuous autofocus that's never canceled, even when you explicitly call one of the other functions.
|
As much as I need part of this functionality, I think this PR needs rework. It adds three separate features in one PR.
Also the current implementation seems messy:
This should probably be at least three separate PRs The commit history of this PR is also quite dirty. Multiple commits whose changes cancel out should never exist in a PR, and be rewritten. |
|
Will anyone re-work this PR as @Ghostbird requested? I need the fix for the barcode so we won't need to rotate the device in order to scan a simple barcode. |
|
After I get some obligations off my plate, if this is still has no movement, I may take a look at it and give it a shot. However, if someone else wants to take it, please do. |
|
+1 |
|
This is still an issue |
|
@martintc any chance you would have a go at this? |
|
Hello @jfversluis! 😄 This is still a problem - any chance for this to get reworked and included in a future release? |
Simple fix using android ImageAnalysis Builder to auto-rotate images if needed.
https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder#setOutputImageRotationEnabled(boolean)
Implement Focus and AutoFocus via TimerTask