diff --git a/README.md b/README.md index cc60135..9729947 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/imagesample/src/main/java/com/suaro/imagesample/ImageActivity.kt b/imagesample/src/main/java/com/suaro/imagesample/ImageActivity.kt index e44bbf5..e9b88f4 100644 --- a/imagesample/src/main/java/com/suaro/imagesample/ImageActivity.kt +++ b/imagesample/src/main/java/com/suaro/imagesample/ImageActivity.kt @@ -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 } diff --git a/imagesample/src/main/res/layout/activity_image.xml b/imagesample/src/main/res/layout/activity_image.xml index 132ba51..a2e7f2b 100644 --- a/imagesample/src/main/res/layout/activity_image.xml +++ b/imagesample/src/main/res/layout/activity_image.xml @@ -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" diff --git a/pidroid/src/main/java/com/suaro/pidroid/core/PidroidConfig.java b/pidroid/src/main/java/com/suaro/pidroid/core/PidroidConfig.java index 6aec845..1c1f8b5 100644 --- a/pidroid/src/main/java/com/suaro/pidroid/core/PidroidConfig.java +++ b/pidroid/src/main/java/com/suaro/pidroid/core/PidroidConfig.java @@ -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;