openCV人脸识别
来源:互联网 发布:起重吊装常用数据手册 编辑:程序博客网 时间:2024/06/02 12:05
class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
// Create a face detector from the cascade file in the resources
// directory.
// CascadeClassifier faceDetector = new
// CascadeClassifier(getClass().getResource("./lbpcascade_frontalface.xml").getPath());
CascadeClassifier faceDetector = new CascadeClassifier(
"F:\\opencv\\sources\\data\\lbpcascades\\lbpcascade_frontalface.xml");
// Mat image =
// Highgui.imread(getClass().getResource("/lena.png").getPath());
Mat image = Highgui.imread("F:\\android\\OpenCvTest\\person.jpg");
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces",
faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x
+ rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "test.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
public class HelloOpenCV {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
// System.loadLibrary("opencv");
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new DetectFaceDemo().run();
}
}
public void run() {
System.out.println("\nRunning DetectFaceDemo");
// Create a face detector from the cascade file in the resources
// directory.
// CascadeClassifier faceDetector = new
// CascadeClassifier(getClass().getResource("./lbpcascade_frontalface.xml").getPath());
CascadeClassifier faceDetector = new CascadeClassifier(
"F:\\opencv\\sources\\data\\lbpcascades\\lbpcascade_frontalface.xml");
// Mat image =
// Highgui.imread(getClass().getResource("/lena.png").getPath());
Mat image = Highgui.imread("F:\\android\\OpenCvTest\\person.jpg");
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces",
faceDetections.toArray().length));
// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x
+ rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}
// Save the visualized detection.
String filename = "test.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
public class HelloOpenCV {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
// System.loadLibrary("opencv");
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new DetectFaceDemo().run();
}
}
0 0
- OpenCV人脸识别
- opencv人脸识别
- openCV人脸识别
- Opencv 人脸识别
- opencv人脸识别
- Opencv 人脸识别
- opencv 人脸识别
- OpenCv人脸识别
- openCV人脸识别
- OpenCV人脸识别
- 人脸识别opencv
- openCV人脸识别
- opencv人脸识别
- OpenCV的行人识别&人脸识别
- OpenCV的行人识别&人脸识别
- 【opencv】树莓派picamera+opencv人脸识别
- 有关opencv人脸识别
- OpenCV人脸识别知识
- category
- 增值税专用发票与增值税普通发票的区别?
- Json lib 抛出 net.sf.json.JSONArrayNote:ThiselementneitherhasattachedsourcenorattachedJavadocandhence
- 关于Rdlc报表无浏览打印 图片
- BlueTooth: 蓝牙协议栈
- openCV人脸识别
- 小恋人,我们能否用心“爱”一次,再不疯狂我们就老了!
- Bundle identifier Bundle Name Bundle display name
- java 入门书籍(java7)
- Word 2010打开大文档时速度很慢的解决方法
- 《爸爸2》首期拍摄环境遭曝光:房间下面就是粪坑
- 快速进入有效排名,页面质量+用户行为
- LUA源码编译成动态库
- linux c学习笔记----TCP基础客户/服务编程(socket,bind等)