-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7e2256
commit 0dba89b
Showing
82 changed files
with
1,506 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 0 additions & 122 deletions
122
android/app/src/main/kotlin/com/abdulmomin/face_attendance/MainActivity.kt
This file was deleted.
Oops, something went wrong.
118 changes: 118 additions & 0 deletions
118
android/app/src/main/kotlin/com/ttv/faceattendance/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package com.ttv.faceattendance | ||
import io.flutter.embedding.android.FlutterActivity | ||
import androidx.annotation.NonNull | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.MethodChannel | ||
import android.util.Log | ||
import android.content.Context | ||
import android.graphics.BitmapFactory | ||
import com.ttv.attendance.CamerakitPlugin | ||
import com.ttv.face.* | ||
|
||
class MainActivity: FlutterActivity() { | ||
|
||
private val channelName = "turingtech" | ||
private var appCtx: Context?= null | ||
|
||
init { | ||
appCtx = this | ||
} | ||
|
||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { | ||
super.configureFlutterEngine(flutterEngine) | ||
flutterEngine.plugins.add(CamerakitPlugin()) | ||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channelName).setMethodCallHandler { | ||
call, result -> | ||
|
||
// <--- METHOD: Verify Against All Picture ---> | ||
when (call.method) { | ||
"setDatabase" -> { | ||
val memberList : HashMap<Int, ByteArray>? = call.argument("membersList") | ||
/// Should Call everytime the app starts | ||
/// This will set the database of faces | ||
|
||
FaceEngine.getInstance(this).removeFaceFeature(-1) | ||
for ((key, value) in memberList!!) { | ||
val faceFeatureInfo = | ||
FaceFeatureInfo(key, value) | ||
|
||
FaceEngine.getInstance(this).registerFaceFeature(faceFeatureInfo) | ||
} | ||
// Do verification and | ||
// Put the verified user id in this variable | ||
result.success(true) | ||
} | ||
|
||
// <--- METHOD: Verify Single Person ---> | ||
"verifySinglePerson" -> { | ||
val personImage : ByteArray? = call.argument("personImage") | ||
val capturedImage: ByteArray? = call.argument("capturedImage") | ||
|
||
// You can verify this 1to1 and put your result in this | ||
var isThisPersonVerified = false | ||
|
||
val image1 = BitmapFactory.decodeByteArray(personImage!!, 0, personImage.size) | ||
if(image1 != null) { | ||
val faceResults1:List<FaceResult> = FaceEngine.getInstance(this).detectFace(image1) | ||
if(faceResults1.count() == 1) { | ||
FaceEngine.getInstance(this).extractFeature(image1, true, faceResults1) | ||
|
||
val image2 = BitmapFactory.decodeByteArray(capturedImage!!, 0, capturedImage.size) | ||
val faceResults2:List<FaceResult> = FaceEngine.getInstance(this).detectFace(image2) | ||
if(faceResults2.count() == 1) { | ||
FaceEngine.getInstance(this).extractFeature(image2, false, faceResults2) | ||
val face1 = faceResults1[0].feature | ||
val face2 = faceResults2[0].feature | ||
val score = FaceEngine.getInstance(this).compareFeature(face1, face2) | ||
if(score > 0.82) { | ||
Log.e("ddd", "The score is") | ||
Log.e("ddd",score.toString()) | ||
isThisPersonVerified = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
result.success(isThisPersonVerified) | ||
|
||
} | ||
"initSDK" -> { | ||
Log.e("ddd", "init SDK!!!!") | ||
|
||
FaceEngine.getInstance(this).setActivation("") | ||
FaceEngine.getInstance(this).init(1) | ||
|
||
Log.e("ddd", "init ok!!!") | ||
|
||
result.success(true) | ||
} | ||
"getFeature" -> { | ||
Log.e("ddd", "getFeature!!!!") | ||
|
||
var feat:ByteArray? = null | ||
val capturedImage: ByteArray? = call.argument("image") | ||
// val mode:Int? = call.argument("mode") | ||
if(capturedImage != null) { | ||
val image = BitmapFactory.decodeByteArray(capturedImage, 0, capturedImage.size) | ||
val faceResults: List<FaceResult> = FaceEngine.getInstance(this).detectFace(image) | ||
if (faceResults.count() == 1) { | ||
FaceEngine.getInstance(this).extractFeature(image, true, faceResults) | ||
|
||
feat = faceResults[0].feature | ||
|
||
// val faceFeatureInfo = | ||
// FaceFeatureInfo(1, feat) | ||
// FaceEngine.getInstance(this).registerFaceFeature(faceFeatureInfo) | ||
} | ||
} | ||
|
||
result.success(feat) | ||
} | ||
else -> { | ||
result.notImplemented() | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
Binary file modified
BIN
-1.72 KB
(72%)
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-33 KB
(28%)
android/app/src/main/res/mipmap-hdpi/launch_image.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-749 Bytes
(80%)
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-18.2 KB
(31%)
android/app/src/main/res/mipmap-mdpi/launch_image.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.68 KB
(69%)
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-51.4 KB
(26%)
android/app/src/main/res/mipmap-xhdpi/launch_image.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.39 KB
(68%)
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-104 KB
(23%)
android/app/src/main/res/mipmap-xxhdpi/launch_image.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.55 KB
(70%)
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-28.8 KB
(52%)
android/app/src/main/res/mipmap-xxxhdpi/launch_image.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
rules_version = '2'; | ||
service cloud.firestore { | ||
|
||
function isSignedIn(){ | ||
return request.auth != null; | ||
} | ||
|
||
// If the requests match the request of Admin request | ||
function isRequestsFieldValid(){ | ||
return request.resource.data.keys().hasOnly( | ||
['name', 'companyName', 'extraInfo', 'email', 'idToken']); | ||
} | ||
|
||
match /databases/{database}/documents { | ||
match /{document=**} { | ||
/// This is only for debugging the final version will contain all the security rules; | ||
allow read, write: if isSignedIn(); | ||
} | ||
|
||
|
||
|
||
match /meta_data/admin_requests/the_requests/{requests}{ | ||
allow write: if isRequestsFieldValid(); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.