Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-10-22 16:52:22 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eeee39888733d7c76e9146a191844cda7b26865c
eeee3988
1 parent
45c35d63
format iOS/Classes/MobileScanner.swift
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
ios/Classes/MobileScanner.swift
ios/Classes/MobileScanner.swift
View file @
eeee398
//
//
Swift
MobileScanner.swift
// MobileScanner.swift
// mobile_scanner
//
// Created by Julian Steenbakker on 15/02/2022.
...
...
@@ -191,7 +191,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
throw
MobileScannerError
.
cameraError
(
error
)
}
captureSession
.
sessionPreset
=
AVCaptureSession
.
Preset
.
photo
;
captureSession
.
sessionPreset
=
AVCaptureSession
.
Preset
.
photo
// Add video output.
let
videoOutput
=
AVCaptureVideoDataOutput
()
...
...
@@ -294,7 +294,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
public
override
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
switch
keyPath
{
case
"torchMode"
:
// off = 0; on = 1; auto = 2
;
// off = 0; on = 1; auto = 2
let
state
=
change
?[
.
newKey
]
as?
Int
torchModeChangeCallback
(
state
)
case
"videoZoomFactor"
:
...
...
@@ -348,7 +348,6 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
}
}
/// Analyze a single image
func
analyzeImage
(
image
:
UIImage
,
position
:
AVCaptureDevice
.
Position
,
callback
:
@escaping
BarcodeScanningCallback
)
{
let
image
=
VisionImage
(
image
:
image
)
...
...
@@ -363,18 +362,16 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega
var
barcodesString
:
Array
<
String
?
>
?
// /// Convert image buffer to jpeg
// private func ciImageToJpeg(ciImage: CIImage) -> Data {
//
// // let ciImage = CIImage(cvPixelBuffer: latestBuffer)
// let context:CIContext = CIContext.init(options: nil)
// let cgImage:CGImage = context.createCGImage(ciImage, from: ciImage.extent)!
// let uiImage:UIImage = UIImage(cgImage: cgImage, scale: 1, orientation: UIImage.Orientation.up)
//
// return uiImage.jpegData(compressionQuality: 0.8)!;
// }
// /// Convert image buffer to jpeg
// private func ciImageToJpeg(ciImage: CIImage) -> Data {
//
// // let ciImage = CIImage(cvPixelBuffer: latestBuffer)
// let context:CIContext = CIContext.init(options: nil)
// let cgImage:CGImage = context.createCGImage(ciImage, from: ciImage.extent)!
// let uiImage:UIImage = UIImage(cgImage: cgImage, scale: 1, orientation: UIImage.Orientation.up)
//
// return uiImage.jpegData(compressionQuality: 0.8)!
// }
/// Rotates images accordingly
func
imageOrientation
(
...
...
Please
register
or
login
to post a comment