Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fiin_sdk_ios
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Van An
fiin_sdk_ios
Commits
c17d42a5
Commit
c17d42a5
authored
Dec 09, 2021
by
Nguyễn Văn An
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update camera iphone x
parent
4d2eb396
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
19 deletions
+41
-19
OCR-SDK.xcworkspace/xcuserdata/ad.xcuserdatad/UserInterfaceState.xcuserstate
.../xcuserdata/ad.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
OCR-SDK/UI/SBKRecordFace/SBKRecordFaceView.swift
OCR-SDK/UI/SBKRecordFace/SBKRecordFaceView.swift
+41
-19
No files found.
OCR-SDK.xcworkspace/xcuserdata/ad.xcuserdatad/UserInterfaceState.xcuserstate
View file @
c17d42a5
No preview for this file type
OCR-SDK/UI/SBKRecordFace/SBKRecordFaceView.swift
View file @
c17d42a5
...
...
@@ -43,7 +43,7 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
var
timer
=
Timer
()
var
timeRecord
:
Int
=
0
var
checkStatusRecord
:
Bool
=
false
private
var
screenHeight
:
CGFloat
=
0
var
idFront
:
String
=
""
var
idBack
:
String
=
""
var
URLToken
:
String
=
""
...
...
@@ -53,7 +53,7 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
public
var
zoom
:
CGFloat
=
1.0
public
var
imageStartRecord
:
UIImage
?
public
var
checkStep
:
Int
=
0
private
var
startusCheck
:
Bool
=
false
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
commonInit
()
...
...
@@ -72,6 +72,7 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
if
AVCaptureDevice
.
authorizationStatus
(
for
:
.
video
)
==
.
denied
{
return
}
self
.
checkScreen
()
self
.
loadCamera
()
}
...
...
@@ -91,6 +92,10 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
}
}
public
func
setCameraChecker
(){
self
.
startusCheck
=
true
}
public
func
statusSubView
(
statusHide
:
Bool
)
{
viewSubIcon
.
isHidden
=
statusHide
}
...
...
@@ -307,22 +312,39 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
debugPrint
(
"unable to get image from sample buffer"
)
return
}
if
#available(iOS 11.0, *)
{
self
.
detectFace
(
in
:
self
.
resizeImageFace
(
pixelBuffer
:
frame
))
if
self
.
startusCheck
{
if
#available(iOS 11.0, *)
{
if
self
.
screenHeight
==
2436
{
self
.
detectFace
(
in
:
self
.
resizeImageFace
(
pixelBuffer
:
frame
.
resized
(
to
:
CGSize
(
width
:
360
,
height
:
480
))
!
))
}
else
{
self
.
detectFace
(
in
:
self
.
resizeImageFace
(
pixelBuffer
:
frame
))
}
}
}
}
func
checkScreen
(){
if
UIDevice
()
.
userInterfaceIdiom
==
.
phone
{
self
.
screenHeight
=
UIScreen
.
main
.
nativeBounds
.
height
}
}
private
func
addCameraInput
()
{
self
.
captureSession
.
sessionPreset
=
.
medium
if
self
.
screenHeight
==
2436
{
self
.
captureSession
.
sessionPreset
=
.
high
}
else
{
self
.
captureSession
.
sessionPreset
=
.
medium
}
if
#available(iOS 11.1, *)
{
guard
let
device
=
AVCaptureDevice
.
DiscoverySession
(
deviceTypes
:
[
.
builtInWideAngleCamera
,
.
builtInDualCamera
,
.
builtInTrueDepthCamera
],
mediaType
:
.
video
,
position
:
.
front
)
.
devices
.
first
else
{
print
(
"No back camera device found, please make sure to run SimpleLaneDetection in an iOS device and not a simulator"
)
return
}
deviceTypes
:
[
.
builtInWideAngleCamera
,
.
builtInDualCamera
,
.
builtInTrueDepthCamera
],
mediaType
:
.
video
,
position
:
.
front
)
.
devices
.
first
else
{
print
(
"No back camera device found, please make sure to run SimpleLaneDetection in an iOS device and not a simulator"
)
return
}
let
cameraInput
=
try!
AVCaptureDeviceInput
(
device
:
device
)
if
captureSession
.
canAddInput
(
cameraInput
)
{
self
.
captureSession
.
addInput
(
cameraInput
)
...
...
@@ -468,10 +490,10 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
if
Global
.
ratioPass
<
pass
*
100
&&
self
.
dataImageSuccess
.
count
>
2
{
DispatchQueue
.
main
.
async
{
guard
let
urlImageStraight
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageStraightFile.png"
,
image
:
self
.
dataImageSuccess
[
0
]),
let
urlImageRight
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageRightFile.png"
,
image
:
self
.
dataImageSuccess
[
1
]),
let
urlImageLeft
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageLeftFile.png"
,
image
:
self
.
dataImageSuccess
[
2
])
else
{
return
}
let
urlImageRight
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageRightFile.png"
,
image
:
self
.
dataImageSuccess
[
1
]),
let
urlImageLeft
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageLeftFile.png"
,
image
:
self
.
dataImageSuccess
[
2
])
else
{
return
}
let
data
:
[
String
:
Any
]
=
[
"imageStraightFile"
:
urlImageStraight
,
"imageRightFile"
:
urlImageRight
,
...
...
@@ -519,10 +541,10 @@ open class SBKRecordFaceView: UIView, AVCaptureVideoDataOutputSampleBufferDelega
if
self
.
dataImageSuccess
.
count
>
2
{
DispatchQueue
.
main
.
async
{
guard
let
urlImageStraight
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageStraightFile.png"
,
image
:
self
.
dataImageSuccess
[
0
]),
let
urlImageRight
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageRightFile.png"
,
image
:
self
.
dataImageSuccess
[
1
]),
let
urlImageLeft
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageLeftFile.png"
,
image
:
self
.
dataImageSuccess
[
2
])
else
{
return
}
let
urlImageRight
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageRightFile.png"
,
image
:
self
.
dataImageSuccess
[
1
]),
let
urlImageLeft
=
SBKValidateInput
.
shared
.
saveImage
(
imageName
:
"imageLeftFile.png"
,
image
:
self
.
dataImageSuccess
[
2
])
else
{
return
}
let
data
:
[
String
:
Any
]
=
[
"imageStraightFile"
:
urlImageStraight
,
"imageRightFile"
:
urlImageRight
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment