Commit 14042025

This commit is contained in:
2025-04-14 18:16:42 +07:00
parent fb5d143cd1
commit ca3fa0ed08
8 changed files with 153 additions and 109 deletions

View File

@@ -180,41 +180,29 @@ public class Detectors {
*/
public static RectVector DetectEye(UMat graymat, int facewidth){
//return Detect(graymat, eyeDetector);
int minwidth = (int)(facewidth*0.2);
int minwidth = Math.max((int)(facewidth*0.25), 24);
int maxwidth = (int)(facewidth*0.4);
Size minsize = new Size(minwidth, minwidth);
Size maxsize = new Size(maxwidth, maxwidth);
return Detect(graymat, eyeDetector, scaleFactor, minNeighbors, flags, minsize, maxsize);
}
@SuppressWarnings("unused")
private static RectVector Detect(UMat graymat, CascadeClassifier detector){
if (detector!=null){
if (graymat!=null){
if (!graymat.empty()){
RectVector detected = new RectVector();
detector.detectMultiScale(graymat, detected);
return detected;
}
}
}
return null;
}
@SuppressWarnings("SameParameterValue")
private static RectVector Detect(UMat graymat, CascadeClassifier detector, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize){
if (detector!=null){
if (graymat!=null){
if (graymat!=null && graymat.channels()==1){
if (!graymat.empty()){
if (minSize!=null){
if (maxSize!=null){
RectVector detected = new RectVector();
detector.detectMultiScale(graymat, detected, scaleFactor, minNeighbors, flags, minSize, maxSize);
return detected;
try{
RectVector detected = new RectVector();
detector.detectMultiScale(graymat, detected, scaleFactor, minNeighbors, flags, minSize, maxSize);
return detected;
} catch (Exception e){
System.out.println("Detectors Detect Error, Message : "+e.getMessage());
}
}
}