Skip to content

Comments

Fix need to rotate android device to landscape to scan 1D barcodes, also fix focus and auto focus not being implemented#52

Open
Captnwalker1 wants to merge 4 commits intoRedth:mainfrom
Captnwalker1:AndroidRotationFix
Open

Fix need to rotate android device to landscape to scan 1D barcodes, also fix focus and auto focus not being implemented#52
Captnwalker1 wants to merge 4 commits intoRedth:mainfrom
Captnwalker1:AndroidRotationFix

Conversation

@Captnwalker1
Copy link

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

@Redth
Copy link
Owner

Redth commented Sep 24, 2022

Looks like a nice start, i need to take a closer look :)

ili added a commit to ili/ZXing.Net.Maui that referenced this pull request Sep 29, 2022
Manual focus on click
ili added a commit to ili/ZXing.Net.Maui that referenced this pull request Sep 29, 2022
Manual CallAutoFcous
@Captnwalker1
Copy link
Author

Can this get merged please?

@martintc
Copy link

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.

@Ghostbird
Copy link

Ghostbird commented Jan 6, 2023

@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()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either remove this or uncomment it.

// Frame by frame analyze
imageAnalyzer = new ImageAnalysis.Builder()
.SetDefaultResolution(new Android.Util.Size(640, 480))
.SetOutputImageRotationEnabled(true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it adds a continuous autofocus that's never canceled, even when you explicitly call one of the other functions.

@Ghostbird
Copy link

Ghostbird commented Jan 6, 2023

As much as I need part of this functionality, I think this PR needs rework. It adds three separate features in one PR.

  • Autorotate
  • Implement Focus(Point) and AutoFocus()
  • Continuous autofocus

Also the current implementation seems messy:

  • Code is poorly formatted
  • Autorotate seems always on, regardless of BarcodeReaderOptions
  • Continuous autofocus seems to clash with the use of Focus(Point) and AutoFocus().

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.

@kocevilija
Copy link

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.

@martintc
Copy link

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.

@INHack20
Copy link

INHack20 commented Dec 3, 2024

+1

@r4b8iiiiiit
Copy link

This is still an issue

@r4b8iiiiiit
Copy link

@martintc any chance you would have a go at this?

@Bauda
Copy link

Bauda commented Nov 7, 2025

Hello @jfversluis! 😄 This is still a problem - any chance for this to get reworked and included in a future release?

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

Successfully merging this pull request may close these issues.

9 participants