1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      java代碼人臉屬性 java實(shí)現(xiàn)人臉識別

      java 人臉識別 問題!

      no jniopencv_objdetect in java.library.path

      創(chuàng)新互聯(lián)建站專注于博羅網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供博羅營銷型網(wǎng)站建設(shè),博羅網(wǎng)站制作、博羅網(wǎng)頁設(shè)計、博羅網(wǎng)站官網(wǎng)定制、小程序定制開發(fā)服務(wù),打造博羅網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供博羅網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

      opencv的相應(yīng)的dll,沒有放到環(huán)境變量PATH 所指的目錄

      用Java畫人臉

      完整代碼如下:

      import java.awt.Dimension;

      import java.awt.Graphics;

      import java.awt.Toolkit;

      import javax.swing.JFrame;

      public class Face extends JFrame ?{

      /**

      *

      */

      private static final long serialVersionUID = 1L;

      public Face(){

      setSize(500, 500);

      setResizable(false);

      setDefaultCloseOperation(EXIT_ON_CLOSE);

      Dimension screenSize = Toolkit.getDefaultToolkit()

      .getScreenSize();

      Dimension frameSize = getSize();

      setLocation((screenSize.width - frameSize.width) / 2,

      (screenSize.height - frameSize.height) / 2);

      setVisible(true);

      }

      //下面的是關(guān)鍵的繪圖代碼

      public void paint(Graphics g){

      //畫頭

      g.drawOval(100, 50, 300, 400);

      //畫眼睛

      g.drawOval(140, 150, 100, 50);

      g.drawOval(260, 150, 100, 50);

      //畫鼻子

      g.drawArc(140, 150, 100, 150, -90, 90);

      g.drawArc(260, 150, 100, 150, 180, 90);

      //畫嘴巴

      g.drawOval(170, 320, 150, 50);

      }

      public static void main(String args[]){

      new Face();

      }

      }

      主要是用了幾個java的畫圖函數(shù),如果有用的話,希望采納

      如何開發(fā)Java動態(tài)人臉識別

      1.環(huán)境搭建

      整個項(xiàng)目的結(jié)構(gòu)圖

      2.編寫DetectFaceDemo.java,代碼如下:

      [java] view plaincopy

      package com.njupt.zhb.test;

      import org.opencv.core.Core;

      import org.opencv.core.Mat;

      import org.opencv.core.MatOfRect;

      import org.opencv.core.Point;

      import org.opencv.core.Rect;

      import org.opencv.core.Scalar;

      import org.opencv.highgui.Highgui;

      import org.opencv.objdetect.CascadeClassifier;

      //

      // Detects faces in an image, draws boxes around them, and writes the results

      // to "faceDetection.png".

      //

      public class DetectFaceDemo {

      public void run() {

      System.out.println("\nRunning DetectFaceDemo");

      System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());

      // Create a face detector from the cascade file in the resources

      // directory.

      //CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());

      //Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());

      //注意:源程序的路徑會多打印一個‘/’,因此總是出現(xiàn)如下錯誤

      /*

      * Detected 0 faces Writing faceDetection.png libpng warning: Image

      * width is zero in IHDR libpng warning: Image height is zero in IHDR

      * libpng error: Invalid IHDR data

      */

      //因此,我們將第一個字符去掉

      String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);

      CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);

      Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));

      // 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 = "faceDetection.png";

      System.out.println(String.format("Writing %s", filename));

      Highgui.imwrite(filename, image);

      }

      }

      3.編寫測試類:

      [java] view plaincopy

      package com.njupt.zhb.test;

      public class TestMain {

      public static void main(String[] args) {

      System.out.println("Hello, OpenCV");

      // Load the native library.

      System.loadLibrary("opencv_java246");

      new DetectFaceDemo().run();

      }

      }

      //運(yùn)行結(jié)果:

      //Hello, OpenCV

      //

      //Running DetectFaceDemo

      ///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml

      //Detected 8 faces

      //Writing faceDetection.png


      新聞標(biāo)題:java代碼人臉屬性 java實(shí)現(xiàn)人臉識別
      URL網(wǎng)址:http://ef60e0e.cn/article/dodsoji.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        什邡市| 大丰市| 淳化县| 伊金霍洛旗| 华阴市| 阿荣旗| 湖南省| 商河县| 娄烦县| 图木舒克市| 仁化县| 龙陵县| 湘潭县| 江西省| 南召县| 罗源县| 沧州市| 邢台市| 南昌县| 西昌市| 巴彦淖尔市| 龙川县| 永仁县| 广德县| 固始县| 陕西省| 朝阳区| 牡丹江市| 扎赉特旗| 象山县| 肥城市| 彭州市| 东安县| 普定县| 万荣县| 大同县| 美姑县| 隆德县| 芮城县| 许昌县| 荆州市|