java opencv识别_在Java中使用OpenCV进行面部识别

java opencv识别

by Manish Bansal

通过Manish Bansal

在Java中使用OpenCV进行面部识别 (Facial recognition using OpenCV in Java)

Ever since the Artificial Intelligence boom began — or the iPhone X advertisement featuring the face unlock feature hit TV screens — I’ve wanted to try this technology. However, once I started googling about it, I typically only found code examples in Python. And being a Java enthusiast for seven years, I got demotivated seeing that. Therefore, I finally decided to hunt for Java open source libraries for this.

自从人工智能热潮开始-或具有面部解锁功能的iPhone X广告投放电视屏幕以来-我一直想尝试这种技术。 但是,一旦开始搜索它,我通常只会在Python中找到代码示例。 成为Java爱好者已有7年了,对此我感到无比激动。 因此,我最终决定为此寻找Java开源库。

Currently, there are various Java libraries out there. But the most popular one I found was OpenCV.

当前,有各种Java库。 但是我发现最受欢迎的是OpenCV

OpenCV is an open source computer vision library that has tons of modules like object detection, face recognition, and augmented reality. Although this library is written in C++, it also offers battle-tested Java bindings.

OpenCV是一个开放源代码的计算机视觉库,具有大量的模块,例如对象检测,面部识别和增强现实。 尽管该库是用C ++编写的,但它也提供了经过实践检验的Java绑定。

However, there is one issue. As part of its software release, it offers only a few modules (with Java bindings) out of the box — and facial recognition is not one of them. Therefore, to use it, you need to manually build it.

但是,有一个问题。 作为其软件版本的一部分,它仅提供了一些现成的模块(带有Java绑定),而面部识别并不是其中之一。 因此,要使用它,您需要手动构建它。

Wait! What? Why?

等待! 什么? 为什么?

Yes — the reason cited by the OpenCV community is that the modules are not completely stable. Therefore, they are not bundled along with the standard release. Hence, they maintain them in a separate repository here.

是的-OpenCV社区引用的原因是模块并不完全稳定。 因此,它们未与标准版本捆绑在一起。 因此,他们将它们维护在此处的单独存储库中。

If you have no or very little C++ experience (like me), you must have already started to feel dizzy about building a C++ library yourself. But don’t worry, I am here to hold your hand and walk you through this tedious process. So let’s begin, shall we?

如果您没有或只有很少的C ++经验(像我一样),那么您一定已经开始对自己构建C ++库感到头晕。 但是不用担心,我在这里牵着你的手,引导您完成这个繁琐的过程。 那么,让我们开始吧?

从零开始为Java构建OpenCV (Building OpenCV for Java from scratch)

You can find various resources for step by step instructions like this, this, and this. However, none of them worked perfectly for me, as one thing or another was missing. The closest I found, which helped me, is this one. However, you do not need to refer to it. You can follow below steps and you will be good.

您可以找到各种资源,以获取有关步骤的逐步说明。 但是,它们都不适合我,因为缺少一件事或另一件事。 这让我我发现的最接近,是一个。 但是,您无需引用它。 您可以按照以下步骤操作,这会很好。

First, you need to have the below software on your PC. Here, I am building a 64-bit version of the library as I own a 64 bit PC. But you can build it for 32-bit as well.

首先,您需要在计算机上安装以下软件。 在这里,我拥有一台64位PC,因此正在构建该库的64位版本。 但是您也可以将其构建为32位。

The required software is:

所需的软件是:

  1. Cmake (I used 3.6.0 rc-4 version).

    Cmake (我使用的是3.6.0 rc-4版本)。

  2. Ant (used internally for building JAR)

    蚂蚁 (内部用于构建JAR)

  3. MinGW — W64 GCC-8.1.0

    MinGW — W64 GCC-8.1.0
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值