编程语言
首页 > 编程语言> > Java OpenCV-4.0.0 图像处理26.0 HOG特征提取

Java OpenCV-4.0.0 图像处理26.0 HOG特征提取

作者:互联网

package com.xu.opencv.ml;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDouble;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.HOGDescriptor;

/**
 * HOGDescriptor 特征提取
 * @ClassName: HOG   
 * @Description: TODO   
 * @author: hyacinth
 * @date: 2019年8月4日 上午10:10:53     
 * @Copyright: hyacinth
 */
public class HOG {

	static {
		System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
	}

	public static void main(String[] args) {
		runner();
	}
	
	/**
	 * OpenCV-4.1.0 HOGDescriptor 特征提取
	 * @return: void  
	 * @date: 2019年8月4日10:09:58
	 */
	public static void hog() {
		Mat src=Imgcodecs.imread("C:\\Users\\hyacinth\\Pictures\\1.jpg");
		Mat gary=new Mat();
		Imgproc.cvtColor(src, gary, Imgproc.COLOR_BGR2GRAY);
		Imgproc.resize(gary, gary, new Size(64,128));
		HOGDescriptor hog=new HOGDescriptor(new Size(64,128), new Size(16,16), new Size(8,8), new Size(8,8), 9);
		MatOfFloat descriptors=new MatOfFloat();
		hog.compute(gary, descriptors,new Size(0,0),new Size(0,0));
		System.out.println(descriptors.size());
	}
	
}

标签:HOG,Java,4.0,core,new,opencv,org,import,Size
来源: https://blog.csdn.net/qq_34814092/article/details/98473875