OpenCV+JAVA realizes face cropping

1. Install opencv4.10

2. Copy the jar and dll files in the installation directory to lib in the project folder

D:\opencv\opencv\build\java

D:\opencv\opencv\build\java\x64

3. Copy haarcascade_frontalface_alt.xml under the folder D:\opencv\opencv\sources\data\haarcascades to

resources

 

code show as below

package com.zsj.tool.apps.holiday.web;

/**
 * @Description TODO
 * @Date 2019/5/31 15:17
 * @Author zsj
 */

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

Guess you like

Origin blog.csdn.net/zsj777/article/details/90717672