Will delete page_identity_verification.xml

This commit is contained in:
wanlop run 2023-11-02 09:19:04 +07:00
parent 6e54881c03
commit 7ce1a44022
47 changed files with 215 additions and 223 deletions

View file

@ -5,66 +5,44 @@
<Background> "0xeae6e1" </Background>
<Volume> SoundVolume </Volume>
<EventOpen>
Var KornCropCountDown = 5
Var KornIsShuttered = "false"
Var KornOpenFaceCompareCountDown = 10
Var KornIsCropped = "false"
; Note:
; - Can't change roi and camera params in xml,
; because the java code is not dynamic.
; (It's a work-around method. (Maybe) Improve later.)
; Absolute positions
Var KornRoiX = 440
Var KornRoiY = 909
Var KornRoiW = 200
Var KornRoiH = 200
Var KornRoiStepY = 40
Var Debug_Count = 0
Var Debug_Count_Start = "false"
Var Timeout_Delay_Count = 5
; Re-calculate these values when either,
; - CameraX size changes
; - CameraX's hidden part size changes
Var KornCamDisplayX = 285
Var KornCamDisplayY = 781
Var KornCamDisplayW = 500
Var KornCamDisplayH = 680
Var KornCamYHidden = 208
;Var CamDisplayX = 285
Var CamDisplayX = 320
Var CamDisplayY = 781
Var CamDisplayW = 500
Var CamDisplayH = 680
Var CamYHidden = 208
Var KornCamX = KornCamDisplayX
Var KornCamY = KornCamDisplayY - KornCamYHidden
Var KornCamW = KornCamDisplayW
Var KornCamH = KornCamDisplayH + KornCamYHidden
Var KornRoiYMin = KornCamDisplayY
Var KornRoiYRange = 220
Var KornRoiYMax = KornCamDisplayY + KornRoiYRange
; To shrink the roi size, use this variable,
; (value is between 0 and 100 (unit = percent))
Var KornRoiPercentShrink = 30
Var KornCamRoiDeltaX = KornRoiW * KornRoiPercentShrink
Var KornCamRoiDeltaX = KornCamRoiDeltaX / 100
Var KornCamRoiDeltaY = KornRoiH * KornRoiPercentShrink
Var KornCamRoiDeltaY = KornCamRoiDeltaY / 100
Var KornCamRoiW = KornRoiW - KornCamRoiDeltaX
Var KornCamRoiH = KornRoiH - KornCamRoiDeltaY
Var CamX = CamDisplayX
Var CamY = CamDisplayY - CamYHidden
Var CamW = CamDisplayW
Var CamH = CamDisplayH + CamYHidden
; CameraX params
Var KornCameraXOffsetX = 150
Var KornCameraXX = KornCamDisplayX - KornCameraXOffsetX
Var KornCameraXY = KornCamDisplayY
Var KornCameraXW = 800
Var KornCameraXH = 800
Var CameraXOffsetX = 150
Var CameraXX = CamDisplayX - CameraXOffsetX
Var CameraXY = CamDisplayY
Var CameraXW = 800
Var CameraXH = 800
; 800 = magic number
; Shift to right to leave space for customer's guide
Var CameraXX = CameraXX + 100
Var CamFlag = 0
Var CamCount = 0
Var CamCount = 0
Var Timeout = 0
Var ShutterResult = "-"
Var AdultFlag = 1
If AdultFlag = 1 Then
Var AdultFlag = 0
@ -228,11 +206,14 @@
If Adult20 = 1 Then
LivenessCommand "SetY" KornRoiY
LivenessCommand "SetX" KornRoiX
;LivenessCommand "SetY" RoiY
;LivenessCommand "SetX" RoiX
LivenessCommand "start" 0
Var Debug_Count_Start = "true"
StartSavingLiveness
Var load_gif_stage = "Invisible"
Var IDcardStageText = "Invisible"
Var IDcardStage = "Invisible"
@ -253,6 +234,10 @@
<Timeout> 1000 </Timeout>
<EventTimeout>
If Debug_Count_Start = "true" Then
Var Debug_Count = Debug_Count + 1
EndIf
DEBUGVAR IDCardStatus
DEBUGVAR IDCardReady
DEBUGVAR IDCardData
@ -261,10 +246,10 @@
DEBUGVAR ShutterResult
DEBUGVAR IDCardState
Var KornCamRoiDeltaXTmp = KornCamRoiDeltaX / 2
Var KornCamRoiX = KornRoiX + KornCamRoiDeltaXTmp
Var KornCamRoiY = KornRoiY
; Debug rare case : id card is read but nothing happens
DEBUGVAR IDcardStage
DEBUGVAR CameraStage
DEBUGVAR load_gif_stage
If IDBirthdate = "" Then
Var CountDownDelayReadCardID = CountDownDelayReadCardID - 1
@ -274,11 +259,24 @@
EndIf
EndIf
DEBUGVAR Timeout
DEBUGVAR Timeout
Var Timeout = Timeout + 1
If Timeout = 120 Then
StopSavingLiveness
LivenessCommand "stop" 0
EndIf
If Timeout > 120 Then
Open "ROOT/taobin_project/xml/page_catalog2.xml"
Var LivenessShowString = "หมดเวลา กลับเมนูใน " + Timeout_Delay_Count
Var LivenessShowString = LivenessShowString + " วิ"
Var Timeout_Delay_Count = Timeout_Delay_Count - 1
If Timeout > 125 Then
LivenessCommand "stop" 0
Open "ROOT/taobin_project/xml/page_catalog2.xml"
EndIf
EndIf
;If ShutterResult = "ok" Then
@ -288,44 +286,8 @@
DEBUGVAR LivenessResult
If LivenessResult = "pass" Then
If KornCropCountDown > 0 Then
DEBUGVAR KornCropCountDown
Var KornCropCountDown = KornCropCountDown - 1
Var LivenessShowString = "Pass "
Var load_gif_stage = "Enable"
If KornIsShuttered = "false" Then
CameraCmd "usbfront" "shutter" "/mnt/sdcard/camera1.jpg"
Var KornShutter = "Shuttered"
DEBUGVAR KornShutter
Var KornIsShuttered = "true"
EndIf
EndIf
If KornCropCountDown <= 0 Then
If KornIsCropped = "false" Then
CROP_IMAGE "/mnt/sdcard/camera1.jpg" "/mnt/sdcard/camera1_alter.jpg"
Var KornCrop = "Cropped"
DEBUGVAR KornCrop
Var KornIsCropped = "true"
EndIf
DEBUGVAR KornOpenFaceCompareCountDown
Var KornOpenFaceCompareCountDown = KornOpenFaceCompareCountDown - 1
If KornOpenFaceCompareCountDown <= 0 Then
Open "ROOT/taobin_project/xml/page_face_compare.xml"
EndIf
EndIf
LivenessCommand "stop" 0
Open "ROOT/taobin_project/xml/page_face_compare.xml"
EndIf
If LivenessResult = "fail" Then
@ -348,12 +310,8 @@
EndIf
EndIf
DEBUGVAR LivenessFramePositionX
DEBUGVAR LivenessFramePositionY
Refresh
TimerReset
Refresh
TimerReset
</EventTimeout>
@ -377,7 +335,8 @@
</Image>
<Image>
<X> 123 </X>
;<X> 123 </X>
<X> 223 </X>
<Y> 598 </Y>
<State> CameraStage </State>
<Filename> "ROOT/taobin_project/image/liveness/bg2.png" </Filename>
@ -385,9 +344,11 @@
<Text>
<X> 0 </X>
;<X> 0 </X>
<X> 220 </X>
<Y> 602 </Y>
<Width> 1080</Width>
;<Width> 1080</Width>
<Width> 980</Width>
<Align> Center </Align>
<Size> 60 </Size>
<Font> KanitMediumTTF </Font>
@ -396,6 +357,95 @@
<Value> LivenessShowString </Value>
</Text>
; guide for customers
;<Text>
;<X> 20 </X>
;<Y> 800 </Y>
;<Width> 1080</Width>
;<Align> Start </Align>
;<Size> 45 </Size>
;<Font> KanitRegularTTF </Font>
;<Color> 0xFFFFFF </Color>
;<Value> "ทำยังไงให้ง่าย
;- มองกล้อง
;- ถอดแว่น
;- ถอดแมส
;- ไม่หลับตา
;- หน้าในกรอบ
;" </Value>
;</Text>
<Text>
<X> 100 </X>
<Y> 750 </Y>
<Width> 1080</Width>
<Align> Start </Align>
<Size> 30 </Size>
<Font> KanitRegularTTF </Font>
<Color> 0xFFFFFF </Color>
<Value> "ตัวอย่าง" </Value>
</Text>
<Image>
<X> 25 </X>
<Y> 800 </Y>
<Height>150</Height>
<Filename> "ROOT/taobin_project/image/liveness/liveness_good_1.png" </Filename>
</Image>
<Image>
<X> 25 </X>
<Y> 1000 </Y>
<Height>150</Height>
<Filename> "ROOT/taobin_project/image/liveness/liveness_good_2.png" </Filename>
</Image>
<Image>
<X> 25 </X>
<Y> 1200 </Y>
<Height>150</Height>
<Filename> "ROOT/taobin_project/image/liveness/liveness_good_3.png" </Filename>
</Image>
<Image>
<X> 175 </X>
<Y> 800 </Y>
<Height>150</Height>
<Filename> "ROOT/taobin_project/image/liveness/liveness_bad_1.png" </Filename>
</Image>
<Image>
<X> 175 </X>
<Y> 1000 </Y>
<Height>150</Height>
<Filename> "ROOT/taobin_project/image/liveness/liveness_bad_2.png" </Filename>
</Image>
<Image>
<X> 175 </X>
<Y> 1200 </Y>
<Height>150</Height>
<Filename> "ROOT/taobin_project/image/liveness/liveness_bad_3.png" </Filename>
</Image>
;<Text>
;<X> 25 </X>
;<Y> 1400 </Y>
;<Width> 1080</Width>
;<Align> Start </Align>
;<Size> 30 </Size>
;<Font> KanitRegularTTF </Font>
;<Color> 0xFFFFFF </Color>
;<Value> "เลื่อนกล้องให้ยืนสบาย" </Value>
;</Text>
;<GIF>
;<X> 66 </X>
;<Y> 1450 </Y>
;<Height>300</Height>
;<State> "Enable" </State>
;<Filename> "ROOT/taobin_project/image/liveness/move_cam_2.gif"</Filename>
;</GIF>
; back
@ -408,157 +458,76 @@
<Volume> SoundVolume </Volume>
<EventClick>
SAVELOG "Liveness Result - Cancel"
Var Debug_Message = "Liveness Result - cancel " + FailTrickCount
Var Debug_Message = Debug_Message + " ("
Var Debug_Message = Debug_Message + Debug_Count
Var Debug_Message = Debug_Message + " seconds)"
SAVELOG Debug_Message
StopSavingLivenessDelete
LivenessCommand "stop" 0
Open "ROOT/taobin_project/xml/page_catalog2.xml"
</EventClick>
</Button>
; arrow up
<Button>
<X> 20 </X>
<Y> 888 </Y>
<Width>180</Width>
<Height>180</Height>
<Filename> "ROOT/taobin_project/image/liveness/arrow_up.png" </Filename>
<FilenamePress> "ROOT/taobin_project/image/liveness/arrow_up.png" </FilenamePress>
<Sound> "/mnt/sdcard/coffeevending/wav/click.wav" </Sound>
<Volume> SoundVolume </Volume>
<EventClick>
SAVELOG "Allow up"
Var KornRoiYTmp = KornRoiY - KornRoiStepY
If KornRoiYTmp > KornRoiYMin Then
Var KornRoiY = KornRoiYTmp
DEBUGVAR KornRoiY
LivenessCommand "SetY" KornRoiY
LivenessCommand "stop" 0
LivenessCommand "start" 0
EndIf
</EventClick>
</Button>
; arrow down
<Button>
<X> 20 </X>
<Y> 1249 </Y>
<Width>180</Width>
<Height>180</Height>
<Filename> "ROOT/taobin_project/image/liveness/arrow_down.png" </Filename>
<FilenamePress> "ROOT/taobin_project/image/liveness/arrow_down.png" </FilenamePress>
<Sound> "/mnt/sdcard/coffeevending/wav/click.wav" </Sound>
<Volume> SoundVolume </Volume>
<EventClick>
SAVELOG "Allow down"
Var KornRoiYTmp = KornRoiY + KornRoiStepY
If KornRoiYTmp < KornRoiYMax Then
Var KornRoiY = KornRoiYTmp
DEBUGVAR KornRoiY
LivenessCommand "SetY" KornRoiY
LivenessCommand "stop" 0
LivenessCommand "start" 0
EndIf
</EventClick>
</Button>
; arrow up
<Button>
<X> 892 </X>
<Y> 888 </Y>
<Width>180</Width>
<Height>180</Height>
<Filename> "ROOT/taobin_project/image/liveness/arrow_up.png" </Filename>
<FilenamePress> "ROOT/taobin_project/image/liveness/arrow_up.png" </FilenamePress>
<Sound> "/mnt/sdcard/coffeevending/wav/click.wav" </Sound>
<Volume> SoundVolume </Volume>
<EventClick>
SAVELOG "Allow up"
Var KornRoiYTmp = KornRoiY - KornRoiStepY
If KornRoiYTmp > KornRoiYMin Then
Var KornRoiY = KornRoiYTmp
DEBUGVAR KornRoiY
LivenessCommand "SetY" KornRoiY
LivenessCommand "stop" 0
LivenessCommand "start" 0
EndIf
</EventClick>
</Button>
; arrow down
<Button>
<X> 892 </X>
<Y> 1249 </Y>
<Width>180</Width>
<Height>180</Height>
<Filename> "ROOT/taobin_project/image/liveness/arrow_down.png" </Filename>
<FilenamePress> "ROOT/taobin_project/image/liveness/arrow_down.png" </FilenamePress>
<Sound> "/mnt/sdcard/coffeevending/wav/click.wav" </Sound>
<Volume> SoundVolume </Volume>
<EventClick>
SAVELOG "Allow down"
;Var KornRoiYTmp = KornRoiY + KornRoiStepY
;If KornRoiYTmp < KornRoiYMax Then
; Var KornRoiY = KornRoiYTmp
; DEBUGVAR KornRoiY
; LivenessCommand "SetY" KornRoiY
; LivenessCommand "stop" 0
; LivenessCommand "start" 0
;EndIf
Var LivenessResult = "pass"
</EventClick>
</Button>
<Image>
<X> 196 </X>
;<X> 196 </X>
<X> 320 </X>
<Y> 737 </Y>
<Filename> "ROOT/taobin_project/image/liveness/bg_21.png" </Filename>
</Image>
<CameraX>
<X> KornCameraXX </X>
<X> CameraXX </X>
;140
<Y> KornCameraXY </Y>
<Y> CameraXY </Y>
;781
<Name>"usbfront"</Name>
<Width> KornCameraXW </Width>
<Width> CameraXW </Width>
;800
; Display width is about 500, (full width is about the same)
<Height> KornCameraXH </Height>
<Height> CameraXH </Height>
;800
; Display height is about 680, (full height = 888)
<LivenessParameterWhenOK> "FileName=/mnt/sdcard/camera1_alter.jpg" </LivenessParameterWhenOK>
<LivenessParameterWhenOK> "FileName=/mnt/sdcard/camera1.jpg" </LivenessParameterWhenOK>
</CameraX>
<Image>
;<X> -35 </X>
<X> 5 </X>
<Y> 780 </Y>
<Height>680</Height>
<State> CameraStage </State>
<Filename> "ROOT/taobin_project/image/liveness/transparent.png" </Filename>
</Image>
<Image>
<X> KornCamRoiX </X>
;FrameOfFaceXPosition
<Y> KornCamRoiY </Y>
;FrameOfFaceYPosition
<Width> KornCamRoiW </Width>
;200
<Height> KornCamRoiH </Height>
;200
;<X> 550 </X>
<X> 620 </X>
<Y> 780 </Y>
<Height>680</Height>
<State> CameraStage </State>
<Filename> "ROOT/taobin_project/image/liveness/bg3.png" </Filename>
<Filename> "ROOT/taobin_project/image/liveness/transparent.png" </Filename>
</Image>
<Image>
<X> 196 </X>
;<X> 196 </X>
;<X> 296 </X>
<X> 320 </X>
<Y> 737 </Y>
<State> IDcardStage </State>
<Filename> "ROOT/taobin_project/image/liveness/bg_21.png" </Filename>
</Image>
<Text>
<X> 0 </X>
;<X> 0 </X>
;<X> 220 </X>
<X> 240 </X>
<Y> 1050 </Y>
<State> IDcardStageText </State>
<Width> 1080</Width>
@ -572,7 +541,9 @@
<GIF>
<X> 440 </X>
;<X> 440 </X>
;<X> 540 </X>
<X> 580 </X>
<Y> 988 </Y>
<State> load_gif_stage </State>
<Filename> "ROOT/taobin_project/image/page_payment/loading.gif"</Filename>
@ -603,11 +574,13 @@
Play SoundWavFileName
Var PrevSoundWavFileName = SoundWavFileName
EndIf
If LivenessResult = "pass" Then
Else
Var LivenessShowString = LivenessStateString
If Timeout < 120 Then
Var LivenessShowString = LivenessStateString
EndIf
EndIf
Refresh
</EventLivenessState>
@ -619,10 +592,28 @@
Var strlog_liveness = "Liveness Result - pass " + FailTrickCount
SAVELOG strlog_liveness
Var Debug_Message = "Liveness Result - pass " + FailTrickCount
Var Debug_Message = Debug_Message + " ("
Var Debug_Message = Debug_Message + Debug_Count
Var Debug_Message = Debug_Message + " seconds)"
SAVELOG Debug_Message
StopSavingLivenessDelete
Else
Var FailTrickCount = FailTrickCount + 1
Var strlog_liveness = "Liveness Result - fail " + FailTrickCount
SAVELOG strlog_liveness
Var Debug_Message = "Liveness Result - failed " + FailTrickCount
Var Debug_Message = Debug_Message + " ("
Var Debug_Message = Debug_Message + Debug_Count
Var Debug_Message = Debug_Message + " seconds)"
SAVELOG Debug_Message
Var Debug_Count = 0
StopSavingLiveness
StartSavingLiveness
EndIf
</EventLivenessResult>