图像深度中Java中的OpenCv出错?

时间:2018-03-29 12:08:13

标签: java opencv opencv3.0

import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.*;
import com.googlecode.javacv.cpp.*;
import com.googlecode.javacv.cpp.opencv_core.CvPoint;
import com.googlecode.javacv.cpp.opencv_core.CvScalar;
import com.googlecode.javacv.cpp.opencv_core.CvSeq;
import static com.googlecode.javacv.cpp.opencv_highgui.CvCapture;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_core.*;
import com.googlecode.javacv.cpp.opencv_imgproc.*;
import com.googlecode.javacv.cpp.opencv_calib3d.*;
import com.googlecode.javacv.cpp.opencv_objdetect.*;
import static com.googlecode.javacv.cpp.opencv_core.cvGetSize;
import static com.googlecode.javacv.cpp.opencv_highgui.*;

public class main {
public static void main(String[] args) {
    // TODO Auto-generated method stub

    IplImage img = cvLoadImage("images.png");
    IplImage hsvimg = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,3);
    IplImage grayimg = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,1);

    cvCvtColor(img,hsvimg,CV_BGR2HSV);
    cvCvtColor(img,grayimg,CV_BGR2GRAY);

    cvShowImage("Original", img);
    cvShowImage("HSV", hsvimg);
    cvShowImage("GRAY", grayimg);
    cvWaitKey();

    cvSaveImage("Original.jpg",img);

}

}

我的" IPL_DEPTH_8U,CV_BGR2HSV"我没有工作,我从YOUTUBE这个教程中获取了这段代码,我尝试了很多次,但这不起作用请帮助我。

0 个答案:

没有答案