当前位置: 首页>>代码示例>>Java>>正文


Java Imgproc.putText方法代码示例

本文整理汇总了Java中org.opencv.imgproc.Imgproc.putText方法的典型用法代码示例。如果您正苦于以下问题:Java Imgproc.putText方法的具体用法?Java Imgproc.putText怎么用?Java Imgproc.putText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opencv.imgproc.Imgproc的用法示例。


在下文中一共展示了Imgproc.putText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: displayResults

import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
public Mat displayResults(Mat frame) {
	//draw boxes and centroids
    if (tracks != null) {	
		for (int i=0; i<tracks.length; i++) {
    		if (tracks[i].totalVisibleCount > 20) {
    			Imgproc.rectangle(frame, new Point(tracks[i].bbox.x, tracks[i].bbox.y), 
    					new Point(tracks[i].bbox.x + tracks[i].bbox.width, tracks[i].bbox.y + tracks[i].bbox.height), new Scalar(255, 0, 0));
    			Imgproc.putText(frame, Integer.toString(tracks[i].id), 
    					new Point(tracks[i].bbox.x, tracks[i].bbox.y), 
    					Core.FONT_HERSHEY_PLAIN, 1.0, new Scalar(255,0,0));
    			Imgproc.circle(frame, new Point(tracks[i].kalmanPredict()[0], tracks[i].kalmanPredict()[1]), 4, new Scalar(255,100,100));
    		}
    	}
    }
    
    return frame;
}
 
开发者ID:TheoreticallyNick,项目名称:Face-Detection-and-Tracking,代码行数:18,代码来源:FaceTrackMain.java

示例2: drawNumbers

import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
public static void drawNumbers(Mat img, int[][] emptyGrid, int[][] filledGrid, Mat positions, Scalar color){
	if(positions.height() == 81) {
		double fontscale = positions.get(0, 3)[0] / 20;
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++) {
				if (emptyGrid[i][j] == 0) {
					//if the box is empty then ...
					String k = "" + filledGrid[i][j]; //the value of this box in te filled grid
					//the position of each box is localized on "positions" by i*9+j
					double x = positions.get(i * 9 + j, 0)[0] + positions.get(i * 9 + j, 2)[0] / 3;
					double y = positions.get(i * 9 + j, 1)[0] + 3 * positions.get(i * 9 + j, 3)[0] / 4;
					Point pt = new Point(x, y);
					Imgproc.putText(img, k, pt, Core.FONT_HERSHEY_PLAIN, fontscale, color, 2);
				}
			}
		}
	}
}
 
开发者ID:Sanahm,项目名称:SudoCAM-Ku,代码行数:19,代码来源:Processing.java

示例3: drawMatches

import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
static Mat drawMatches(Mat img1, MatOfKeyPoint key1, Mat img2, MatOfKeyPoint key2, MatOfDMatch matches, boolean imageOnly){
    //https://github.com/mustafaakin/image-matcher/tree/master/src/in/mustafaak/imagematcher
    Mat out = new Mat();
    Mat im1 = new Mat();
    Mat im2 = new Mat();
    Imgproc.cvtColor(img1, im1, Imgproc.COLOR_GRAY2RGB);
    Imgproc.cvtColor(img2, im2, Imgproc.COLOR_GRAY2RGB);
    if ( imageOnly){
        MatOfDMatch emptyMatch = new MatOfDMatch();
        MatOfKeyPoint emptyKey1 = new MatOfKeyPoint();
        MatOfKeyPoint emptyKey2 = new MatOfKeyPoint();
        Features2d.drawMatches(im1, emptyKey1, im2, emptyKey2, emptyMatch, out);
    } else {
        Features2d.drawMatches(im1, key1, im2, key2, matches, out);
    }
    //Bitmap bmp = Bitmap.createBitmap(out.cols(), out.rows(), Bitmap.Config.ARGB_8888);
    Imgproc.cvtColor(out, out, Imgproc.COLOR_BGR2RGB);
    Imgproc.putText(out, "Frame", new Point(img1.width() / 2,30), Core.FONT_HERSHEY_PLAIN, 2, new Scalar(0,255,255),3);
    Imgproc.putText(out, "Match", new Point(img1.width() + img2.width() / 2,30), Core.FONT_HERSHEY_PLAIN, 2, new Scalar(255,0,0),3);
    return out;
}
 
开发者ID:johnhany,项目名称:MOAAP,代码行数:22,代码来源:MainActivity.java

示例4: drawText

import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
public static void drawText(Mat img, String text, Point origin, float scale, Color color, Anchor locationOnImage) {
    if (locationOnImage == Anchor.BOTTOMLEFT)
        Transform.flip(img, Transform.FlipType.FLIP_ACROSS_Y);
    Imgproc.putText(img, text, origin, Core.FONT_HERSHEY_SIMPLEX, scale, color.getScalarRGBA(), 2, Core.LINE_8,
            (locationOnImage == Anchor.BOTTOMLEFT || locationOnImage == Anchor.BOTTOMLEFT_UNFLIPPED_Y));
    if (locationOnImage == Anchor.BOTTOMLEFT)
        Transform.flip(img, Transform.FlipType.FLIP_ACROSS_Y);
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:9,代码来源:Drawing.java

示例5: onCameraFrame

import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {

        //Get image size and draw a rectangle on the image for reference
        Mat temp = inputFrame.rgba();
        Imgproc.rectangle(temp, new Point(temp.cols()/2 - 200, temp.rows() / 2 - 200), new Point(temp.cols() / 2 + 200, temp.rows() / 2 + 200), new Scalar(255,255,255),1);
        Mat digit = temp.submat(temp.rows()/2 - 180, temp.rows() / 2 + 180, temp.cols() / 2 - 180, temp.cols() / 2 + 180).clone();
        Core.transpose(digit,digit);
        int predict_result = mnist.FindMatch(digit);
        Imgproc.putText(temp, Integer.toString(predict_result), new Point(50, 150), FONT_HERSHEY_SIMPLEX, 3.0, new Scalar(0, 0, 255), 5);

        return temp;
    }
 
开发者ID:johnhany,项目名称:MOAAP,代码行数:13,代码来源:MainActivity.java


注:本文中的org.opencv.imgproc.Imgproc.putText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。