• 大小: 12.44MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-08
  • 语言: Java
  • 标签: javacv  

资源简介

javacv-0.6-bin配合opencv2.4.6.0

资源截图

代码片段和文件信息

import com.googlecode.javacv.Blobs;
import com.googlecode.javacv.Canvasframe;

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;

///////////////////////////////////////////////////////////////////
//*                                                             *//
//* As the author of this code I place all of this code into   *//
//* the public domain. Users can use it for any legal purpose.  *//
//*                                                             *//
//*             - Dave Grossman                                 *//
//*                                                             *//
///////////////////////////////////////////////////////////////////
public class BlobDemo
{
    public static void main(String[] args)
    {
        System.out.println(“STARTING...\n“);
        demo();
        System.out.println(“ALL DONE“);
    }

    public static void demo()
    {
        int MinArea = 6;
        int ErodeCount =0;
        int DilateCount = 0;
        
        IplImage RawImage = null;

        // Read an image.
        for(int k = 0; k < 7; k++)
        {
            if(k == 0) { RawImage = cvLoadImage(“Images/BlackBalls.jpg“); MinArea = 250; ErodeCount = 0; DilateCount = 1; }
            else if(k == 1) { RawImage = cvLoadImage(“Images/Shapes1.jpg“); MinArea = 6; ErodeCount = 0; DilateCount = 1; }
            else if(k == 2) { RawImage = cvLoadImage(“Images/Shapes2.jpg“); MinArea = 250; ErodeCount = 0; DilateCount = 1; }
            else if(k == 3) { RawImage = cvLoadImage(“Images/Blob1.jpg“); MinArea = 2800; ErodeCount = 1; DilateCount = 1; }
            else if(k == 4) { RawImage = cvLoadImage(“Images/Blob2.jpg“); MinArea = 2800; ErodeCount = 1; DilateCount = 1; }
            else if(k == 5) { RawImage = cvLoadImage(“Images/Blob3.jpg“); MinArea = 2800; ErodeCount = 1; DilateCount = 1; }
            else if(k == 6) { RawImage = cvLoadImage(“Images/Rice.jpg“); MinArea = 30; ErodeCount = 2; DilateCount = 1; }       
            //ShowImage(RawImage “RawImage“ 512);
        
            IplImage GrayImage = cvCreateImage(cvGetSize(RawImage) IPL_DEPTH_8U 1);     
            cvCvtColor(RawImage GrayImage CV_BGR2GRAY);
            //ShowImage(GrayImage “GrayImage“ 512);

            IplImage BWImage = cvCreateImage(cvGetSize(GrayImage) IPL_DEPTH_8U 1); 
            cvThreshold(GrayImage BWImage 127 255 CV_THRESH_BINARY);
            //ShowImage(BWImage “BWImage“);
            
            IplImage WorkingImage = cvCreateImage(cvGetSize(BWImage) IPL_DEPTH_8U 1);     
            cvErode(BWImage WorkingImage null ErodeCount);    
            cvDilate(WorkingImage WorkingImage null DilateCount);
            //ShowImage(WorkingImage “WorkingImage“ 512);
        
            //cvSaveImage(“Images/Working.jpg“ WorkingImage);
            //PrintGrayImage(WorkingImage “WorkingImage“);
            

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-09-16 11:14  javacv-bin\
     文件       49527  2013-09-16 11:13  javacv-bin\README.txt
     文件       19355  2012-04-15 14:48  javacv-bin\LICENSE.txt
     目录           0  2013-09-16 11:14  javacv-bin\samples\
     文件        9358  2012-10-06 16:51  javacv-bin\samples\BlackBalls.jpg
     文件        5275  2012-10-28 17:27  javacv-bin\samples\HoughLines.java
     文件       74611  2012-10-06 16:51  javacv-bin\samples\Rice.jpg
     文件       27267  2013-01-26 16:37  javacv-bin\samples\FaceRecognition.java
     文件        3494  2012-04-15 14:48  javacv-bin\samples\OpticalFlowTracker.java
     文件       11082  2012-08-22 20:57  javacv-bin\samples\FacePreview.java
     文件       16047  2013-05-19 13:17  javacv-bin\samples\RecordActivity.java
     文件       13160  2012-04-15 14:48  javacv-bin\samples\pic1.png
     文件       26766  2012-10-06 16:51  javacv-bin\samples\Shapes1.jpg
     文件        9047  2012-10-06 16:51  javacv-bin\samples\Blob2.jpg
     文件         340  2012-04-15 14:48  javacv-bin\samples\image1.png
     文件        4731  2012-10-06 16:51  javacv-bin\samples\Blob1.jpg
     文件       14481  2012-10-06 16:51  javacv-bin\samples\Blob3.jpg
     文件         341  2012-04-15 14:48  javacv-bin\samples\image0.png
     文件         478  2012-05-26 00:22  javacv-bin\samples\Faceapplet.jnlp
     文件        4320  2012-04-15 14:48  javacv-bin\samples\MotionDetector.java
     文件        5228  2012-05-30 22:27  javacv-bin\samples\Faceapplet.java
     文件         677  2012-05-25 23:44  javacv-bin\samples\Faceapplet.html
     文件       11370  2012-10-11 22:29  javacv-bin\samples\BlobDemo.java
     文件       17920  2012-10-06 16:51  javacv-bin\samples\Shapes2.jpg
     文件     1892728  2013-09-16 11:14  javacv-bin\javacv-linux-x86_64.jar
     文件     1799377  2013-09-16 11:05  javacv-bin\javacv-windows-x86_64.jar
     文件      145277  2013-09-15 21:39  javacv-bin\javacpp.jar
     文件     1345391  2013-09-16 11:08  javacv-bin\javacv-windows-x86.jar
     文件     1146787  2013-09-16 11:14  javacv-bin\javacv.jar
     文件     1789730  2013-09-16 11:11  javacv-bin\javacv-linux-x86.jar
     文件     3132042  2013-09-16 10:58  javacv-bin\javacv-android-arm.jar
............此处省略1个文件信息

评论

共有 条评论