#Region Project Attributes
#MainFormWidth: 100
#MainFormHeight: 100
#AdditionalJar: opencv-430
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private NativeMe As JavaObject
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
NativeMe = Me
Dim s As String = NativeMe.RunMethod("main", Null)
Log(s)
End Sub
#If JAVA
import org.opencv.core.Core;
import org.opencv.core.Core.MinMaxLocResult;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
public static String main() {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat source=null;
Mat template=null;
String filePath="C:\\meapague\\";
//Load image file
source=Imgcodecs.imread(filePath+"onde.jpg");
template=Imgcodecs.imread(filePath+"oque.png");
Mat outputImage=new Mat();
int machMethod=Imgproc.TM_CCOEFF;
//Template matching method
Imgproc.matchTemplate(source, template, outputImage, machMethod);
MinMaxLocResult mmr = Core.minMaxLoc(outputImage);
Point matchLoc=mmr.maxLoc;
//Draw rectangle on result image
Imgproc.rectangle(source, matchLoc, new Point(matchLoc.x + template.cols(),
matchLoc.y + template.rows()), new Scalar(255, 255, 255));
Imgcodecs.imwrite(filePath+"sonuc.jpg", source);
return "Completed.";
}
#End If