Skip to content

Commit

Permalink
Revert back to unpatched version of org.openpnp:opencv
Browse files Browse the repository at this point in the history
  • Loading branch information
Jotschi committed Jan 24, 2023
1 parent 3c3f857 commit 53544fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>4.6.0-0-contrib</version>
<version>4.6.0-0</version>
</dependency>
<dependency>
<groupId>org.imgscalr</groupId>
Expand Down
27 changes: 24 additions & 3 deletions src/main/java/io/metaloom/video4j/opencv/CVUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Point3;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
Expand All @@ -28,7 +29,7 @@
import io.metaloom.video4j.VideoFrame;
import io.metaloom.video4j.impl.MatProvider;

public class CVUtils {
public final class CVUtils {

private static final double BLACK_FRAME_THRESHOLD = 10.0f;

Expand Down Expand Up @@ -486,9 +487,9 @@ public static void normalize(Mat step1, Mat step2, int clamp, int max) {
* @param fontScale
* @param color
* @param thickness
* @return
* @return Fluent API
*/
public static VideoFrame drawText(VideoFrame frame, String text, Point pos, double fontScale, Scalar color, int thickness) {
public static <T extends VideoFrame> T drawText(T frame, String text, Point pos, double fontScale, Scalar color, int thickness) {
Imgproc.putText(frame.mat(), text, pos, Imgproc.FONT_HERSHEY_PLAIN, fontScale, color, thickness);
return frame;
}
Expand Down Expand Up @@ -562,4 +563,24 @@ public static BufferedImage mat2BufferedImage(Mat mat) {
return matToBufferedImage(mat);
}

/**
* Convert a {@link Point} back into {@link org.opencv.core.Point}
*
* @param awtPoint
* @return
*/
public static org.opencv.core.Point toCVPoint(java.awt.Point awtPoint) {
return new org.opencv.core.Point(awtPoint.getX(), awtPoint.getY());
}

/**
* Convert an OpenCV {@link Point} back to {@link java.awt.Point}n
*
* @param cvPoint
* @return
*/
public static java.awt.Point toAWTPoint(Point cvPoint) {
return new java.awt.Point((int) cvPoint.x, (int) cvPoint.y);
}

}

0 comments on commit 53544fd

Please sign in to comment.