利用opencv进行头像识别合并识别前跟识别后照片

package com.sdxm;

import org.opencv.core.*;
import org.opencv.core.Point;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * @author sdxm
 * @version 1.0
 * @description: TODO
 * @date 2024/5/9 10:30
 */
public class ImageMergerWithLabels {
    static {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    }

    public static void main(String[] args) {
        String path1 = "C:\\Users\\sdxm\\Desktop\\southeast.jfif";
        String path2 = "C:\\Users\\sdxm\\Desktop\\southeast.jfif";
        fileAccessChecker(path1);
        imageMergerWithLabelsMethods(path1,path2);
        faceDetectionExample(path1);
    }
    public static void imageMergerWithLabelsMethods(String path1, String path2){
        try {
            // 读取两个图像文件
            BufferedImage image1 = ImageIO.read(new File(path1)); // 修剪前
            BufferedImage image2 = ImageIO.read(new File(path2)); // 修剪后
            if (image1 == null || image2 == null) {
                System.err.println("无法读取图片文件!");
                // 在这里可以添加更详细的错误处理代码,比如打印出堆栈跟踪或者退出程序
                return; // 或者你可以选择抛出一个异常
            }
            // 假设我们将image2放在image1的右边&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大小先生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值