public class OpenCVUtils extends Object
| 构造器和说明 |
|---|
OpenCVUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.opencv.core.Mat |
canny(org.opencv.core.Mat src)
canny算法,边缘检测
|
static void |
drawRectAndText(ai.djl.modality.cv.Image image,
DetectionInfo detectionInfo)
绘制矩形框和文字
|
static void |
drawRectAndText(ai.djl.modality.cv.Image image,
List<DetectionInfo> detectionInfoList)
绘制矩形框和文字
|
static void |
drawRectAndText(org.opencv.core.Mat mat,
int x,
int y,
int width,
int height,
org.opencv.core.Scalar color,
int thickness,
String text,
double fontScale,
org.opencv.core.Scalar textColor)
在Mat上绘制矩形框和文字
|
static org.opencv.core.Mat |
image2Mat(BufferedImage img)
BufferedImage to Mat
|
static org.opencv.core.Mat |
invertAffineTransform(org.opencv.core.Mat src)
变换矩阵的逆矩阵
|
static void |
line(org.opencv.core.Mat mat,
org.opencv.core.Point point1,
org.opencv.core.Point point2)
画线
|
static BufferedImage |
mat2Image(org.opencv.core.Mat mat)
Mat to BufferedImage
|
static org.opencv.core.Mat |
perspectiveTransform(org.opencv.core.Mat src,
org.opencv.core.Mat srcPoints,
org.opencv.core.Mat dstPoints)
透视变换
|
static org.opencv.core.Mat |
toOpenCVMat(double[][] points)
double[][] points array to Mat
|
static org.opencv.core.Mat |
toOpenCVMat(ai.djl.ndarray.NDManager manager,
ai.djl.ndarray.NDArray srcPoints,
ai.djl.ndarray.NDArray dstPoints)
NDArray to opencv_core.Mat
|
public static org.opencv.core.Mat canny(org.opencv.core.Mat src)
src - public static void line(org.opencv.core.Mat mat,
org.opencv.core.Point point1,
org.opencv.core.Point point2)
mat - point1 - point2 - public static org.opencv.core.Mat toOpenCVMat(ai.djl.ndarray.NDManager manager,
ai.djl.ndarray.NDArray srcPoints,
ai.djl.ndarray.NDArray dstPoints)
manager - srcPoints - dstPoints - public static org.opencv.core.Mat toOpenCVMat(double[][] points)
points - public static org.opencv.core.Mat invertAffineTransform(org.opencv.core.Mat src)
src - public static BufferedImage mat2Image(org.opencv.core.Mat mat)
mat - public static org.opencv.core.Mat image2Mat(BufferedImage img)
img - public static org.opencv.core.Mat perspectiveTransform(org.opencv.core.Mat src,
org.opencv.core.Mat srcPoints,
org.opencv.core.Mat dstPoints)
src - srcPoints - dstPoints - public static void drawRectAndText(ai.djl.modality.cv.Image image,
List<DetectionInfo> detectionInfoList)
image - detectionInfoList - public static void drawRectAndText(ai.djl.modality.cv.Image image,
DetectionInfo detectionInfo)
image - detectionInfo - public static void drawRectAndText(org.opencv.core.Mat mat,
int x,
int y,
int width,
int height,
org.opencv.core.Scalar color,
int thickness,
String text,
double fontScale,
org.opencv.core.Scalar textColor)
mat - 待绘制的Matx - 矩形左上角Xy - 矩形左上角Ywidth - 矩形宽度height - 矩形高度color - 框的颜色,例如 new Scalar(0, 255, 0) 绿色thickness - 框线宽度text - 需要绘制的文字,可以为null或空fontScale - 文字缩放比例textColor - 文字颜色Copyright © 2025. All rights reserved.