samwellwang

samwellwang

coder
twitter

OpenCV

The full name of OpenCV is Open Source Computer Vision Library, which is a cross-platform computer vision library.

2019-01-08

The full name of OpenCV is Open Source Computer Vision Library, which is a cross-platform computer vision library. OpenCV was initiated and developed by Intel Corporation and is released under the BSD license, allowing free use in commercial and research fields. OpenCV can be used to develop real-time image processing, computer vision, and pattern recognition programs. The library can also be accelerated using Intel's IPP.

OpenCV can be used to solve problems in the following areas:

Augmented Reality
Face Recognition
Gesture Recognition
Human-Computer Interaction
Action Recognition
Motion Tracking
Object Recognition
Image Segmentation
Robotics

OpenCV is written in C++, and its main interface is also in C++, but it still retains a large number of C language interfaces. The library also has a large number of interfaces for Python, Java, and MATLAB/OCTAVE (version 2.5). The API interface functions for these languages can be accessed through online documentation. Support for C#, Ch, and Ruby is also now provided.

All new developments and algorithms are done using the C++ interface. A GPU interface using CUDA was also implemented starting in September 2010.
The above content is excerpted from the Wikipedia entry on OpenCV.

The following code implements a simple image rotation function using OpenCV (the idea of configuring Open really is a pitfall...)

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.imgproc.Imgproc;
import org.opencv.imgcodecs.Imgcodecs;

import static org.opencv.highgui.HighGui.imshow;
import static org.opencv.highgui.HighGui.waitKey;

public class ImageRotateDemo {
	
	public static Mat rotate(Mat src, double angele) {
	    Mat dst = src.clone();
	    Point center = new Point(src.width() / 2.0, src.height() / 2.0);
	    Mat affineTrans = Imgproc.getRotationMatrix2D(center, angele, 1.0);
	    Imgproc.warpAffine(src, dst, affineTrans, dst.size(), Imgproc.INTER_NEAREST);
	    return dst;
	}
	public static void main(String[] args){
		System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
		Mat src=Imgcodecs.imread("E:/opencv/project/YCY.jpg");
        src= rotate(src,90.0);
		imshow("Display Image", src);
		waitKey();
		// Imgcodecs.imwrite("E:/opencv/project/YCYrotate.jpg", src);
	}
}
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.