Skip to content

Commit

Permalink
Update README and sample app.
Browse files Browse the repository at this point in the history
  • Loading branch information
Suaro committed Mar 24, 2021
1 parent 521d279 commit 4beb84c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ All configuration parameters are in PidroidConfig class.
| maxsize | Max radius of faces detected | 1000 |
| prominentFaceOnly | Parameter that determines if you want to return only the most predominant face | False |
| clustering | This parameter groups detections to prevent a face from being detected multiple times | True |
| stridefactorWidth | This parameter determines how many pixels the sliding window is moved to detect. For example, if the value is 0.1 and the image is 1000 pixels wide, the sliding window will move every 100 pixels. | 0.2 |
| stridefactorHeight | Same as stridefactorWidth but for height | 0.12 |
| stridefactorWidth | This parameter determines how many pixels the sliding window is moved to detect. For example, if the value is 0.1 and the image is 1000 pixels wide, the sliding window will move every 100 pixels. | 0.1 |
| stridefactorHeight | Same as stridefactorWidth but for height | 0.1 |
| scalefactor | The PICO algorithm searches for different face sizes starting from minsize to maxsize. This parameter determines how much the search size increases each iteration. | 1.1 |
| qthreshold | Minimum threshold to consider a region as a face. | 3.0 |
| perturbs | The detection of pupils and landmarks, start from an initial region to predict the exact position. This initial region is disturbed N times to increase the precision of detection. This also makes the method slower the larger this parameter grows. | 24 |
| perturbs | The detection of pupils and landmarks, start from an initial region to predict the exact position. This initial region is disturbed N times to increase the precision of detection. This also makes the method slower the larger this parameter grows. | 10 |
| pupilDetectionEnable | This parameter enable pupil detection | True |
| landmarkDetectionEnable | This parameter enable landmark detection. Its mandatory pupilDetectionEnable to True to detect landmarks. | True |

Expand Down
19 changes: 11 additions & 8 deletions imagesample/src/main/java/com/suaro/imagesample/ImageActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,26 @@ class ImageActivity : AppCompatActivity() {
val handler: Handler = Handler();

handler.postDelayed({
val drawable: BitmapDrawable = imageTest.getDrawable() as BitmapDrawable
val bitmap: Bitmap = drawable.bitmap
canvasView.setAspectRatio(bitmap.width, bitmap.height)
val dinfo = callDetectFace(bitmap)
drawResult(dinfo)

}, 1000)
performFaceDetection()
}, 100)
}

override fun onDestroy() {
super.onDestroy()
}

private fun performFaceDetection() {
val drawable: BitmapDrawable = imageTest.getDrawable() as BitmapDrawable
val bitmap: Bitmap = drawable.bitmap
canvasView.setAspectRatio(bitmap.width, bitmap.height)
val dinfo = callDetectFace(bitmap)
drawResult(dinfo)
}

fun callDetectFace(bitmap: Bitmap): FaceDetectionResult {
val pixels = IntArray(bitmap.width * bitmap.height * 4)
bitmap.getPixels(pixels, 0, bitmap.width, 0, 0, bitmap.width, bitmap.height)
var dInfo = FaceDetectionResult()
val dInfo = FaceDetectionResult()
Pidroid.detectFace(pixels, bitmap.width, bitmap.height, dInfo)
return dInfo
}
Expand Down
2 changes: 1 addition & 1 deletion imagesample/src/main/res/layout/activity_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_height="0dp"
android:adjustViewBounds="true"
android:keepScreenOn="true"
app:srcCompat="@drawable/friends"
app:srcCompat="@drawable/tonystark"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ public final class PidroidConfig {
private int minsize = 150;
private int maxsize = 1000;
private float scalefactor = 1.1F;
private float stridefactorWidth = 0.2F;
private float stridefactorHeight = 0.12F;
private float stridefactorWidth = 0.1F;
private float stridefactorHeight = 0.1F;
private float qthreshold = 3.0F;
private int perturbs = 10;
private boolean clustering = true;
Expand Down

0 comments on commit 4beb84c

Please sign in to comment.