java opencv在图片上绘制 矩形

java opencv在图片上绘制 矩形

 

package com.vfsd.core;

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.HighGui;
import org.opencv.imgproc.Imgproc;

public class Test3 {
    public static void main( String[] args )
    {
        System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
        Scalar scalar1  = new Scalar(0,0,0);
        
        
        
        Mat img1 = new Mat(360,640,CvType.CV_8UC3,scalar1);
        
        Scalar scalar2  = new Scalar(0,0,255);
        Rect  rect1 = new Rect(new Point(50,50),new Point(70,70));
        Imgproc.rectangle(img1,rect1 , scalar2);
        
        
        
        
        HighGui.imshow("win1", img1);
        HighGui.waitKey();
        
    }
    
    
    
}

 

 

###################

posted @ 2023-08-13 18:05  西北逍遥  阅读(141)  评论(0编辑  收藏  举报