Question: The problem it is about opencv Java. I have no idea how to fix this error. Because it works normally if i call this two

The problem it is about opencv Java. I have no idea how to fix this error. Because it works normally if i call this two method one by one but it's error when it is in the same method.

the link of java code and error picture is below

when i call method Threshold with bluecircle it will turn bluecircle to be the same as maskbluecircle is and then i just put them into matchtemplate.object method.

I will show you below how it works when i call method one by one:

The problem it is about opencv Java. I have no idea how

object.png

to fix this error. Because it works normally if i call this

then i call matchtemplate with object.png and maskbluecircle(actually it is the same)

two method one by one but it's error when it is in

So as I said it works when they are seperated. SO HOW TO COMBINE THEM IN THE SAME METHOD WITH OUT ANY ERRORS .If you produce me the sample code it would be really appreciate. THANK YOU.

Threshold.java

https://s3.amazonaws.com/iedu-attachments-message/733314d08c0a1d45ac340f5136a73eb3_3a05ea7619e5f3b28d59725963fdf180.java

Matchteplate.java

https://s3.amazonaws.com/iedu-attachments-message/79779bfa58ef24ac09d06494b416b3f5_288bc6d4177f1ac8541c1b7fd88fe836.java

Controltable.java(main)

https://s3.amazonaws.com/iedu-attachments-message/b9a8dfd3b5a48eeca95d5d364681d52d_31f0328c404c0bbd24cb3faca8da7e38.java

Error.png

https://s3.amazonaws.com/iedu-attachments-message/8059cf1c7dfa0422e17d0817d02094b9_07a9722aa2fef9aa4f28632b2d376381.png

bluecircle.png

the same method. the link of java code and error picture is

maskbluecircle.png

below when i call method Threshold with bluecircle it will turn bluecircle

Problems Javadoc GDeclaration Console mainnew.lava D copytotest.java 1 package checktable: ?testtest2Java g testtest.Java 6) testtest3java maintrajava timgcodecs.class terminated> controitable llava Applicationj CAProgram Files\lavarel.R0-161binjavaw.exe (1 ?.?. 256 done 3 import org.opencv.core.Core; iport org.opencv.core.CvType: 5 import org. opencv.core.Mat: 6 import org.opencv.irgcodecs. Imgcodecs 7 import org.opencv.imgproc.1mgproc; 9 public class contraltable t 10 private static Mat source: private atatic Mat tmplate: 12 public atatic void rain (String args[) 13 System.loadLibrary(Core. NATIVE_LIBRARY NAME); source-Tmgcodecs-im read("blu circle. png" ) ; 15 16 17 18 //template-Imgcodecs.imread ("maskbluecircle.png" /template.convertTo (template, CType.CV BUC1) Mat abject-checktable.Threshold.thresholanue (source, 120, 20, B5, 30) 20 /int matchMethodImgproc. TM_CcOEFF_NORMED: Mat result-new Mat / Mat blue- matchtemplate.object (source, source, result, matchMethod) 22 23 24 25 26 27 1 28 Tmgcadecs.imrite("object.png", object; System.out.printin("done") Problems Javadoc GDeclaration Console mainnew.lava D copytotest.java 1 package checktable: ?testtest2Java g testtest.Java 6) testtest3java maintrajava timgcodecs.class terminated> controitable llava Applicationj CAProgram Files\lavarel.R0-161binjavaw.exe (1 ?.?. 256 done 3 import org.opencv.core.Core; iport org.opencv.core.CvType: 5 import org. opencv.core.Mat: 6 import org.opencv.irgcodecs. Imgcodecs 7 import org.opencv.imgproc.1mgproc; 9 public class contraltable t 10 private static Mat source: private atatic Mat tmplate: 12 public atatic void rain (String args[) 13 System.loadLibrary(Core. NATIVE_LIBRARY NAME); source-Tmgcodecs-im read("blu circle. png" ) ; 15 16 17 18 //template-Imgcodecs.imread ("maskbluecircle.png" /template.convertTo (template, CType.CV BUC1) Mat abject-checktable.Threshold.thresholanue (source, 120, 20, B5, 30) 20 /int matchMethodImgproc. TM_CcOEFF_NORMED: Mat result-new Mat / Mat blue- matchtemplate.object (source, source, result, matchMethod) 22 23 24 25 26 27 1 28 Tmgcadecs.imrite("object.png", object; System.out.printin("done")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!