how to resolve (-215:Assertion failed) !_src.empty() in function 'cv::boxFilter'
Hello everyone, I am creating a system for object recognition, more precisely for license plates, it is for a control system for the beach in my city. I'm using Java and the latest version of OpenCv 4.3.0, I can open the camera without errors. The problem is in the code for plate recognition, it's giving errors, but it's about the version or something. I will leave the code of the classes, and the errors, I hope someone can help me. ENTRY CLASS
public class entrada {
public static void main(String[] args) {
try {
// carregando a biblioteca
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
System.out.println("começando");
int[] mm = { 10,100 };
int[] nn = { 10,100,300 };
int[] aa = { 1 };
int[] bb = { 5};
int[] cc = { 5,10,15 };
int[] dd = { 3 };
int[] ee = {200};
for (int m = 0; m < mm.length; m++) {
for (int n = 0; n < nn.length; n++) {
for (int a = 0; a < aa.length; a++) {
for (int b = 0; b < bb.length; b++) {
for (int c = 0; c < cc.length; c++) {
for (int d = 0; d < dd.length; d++) {
for(int e = 0; e < ee.length;e++){
// carregando a imagem original, ja em escala de cinza
Mat imageGray = Imgcodecs.imread("C:\\Users\\PC\\Desktop\\placa.jpg\"");
BufferedImage temp = reconhecimento.reconhecedorPlaca(imageGray,
mm[m], nn[n], aa[a], bb[b], cc[c], dd[d],ee[e]);
File outputfile = new File("final" + aa[a]
+ "x" + bb[b] + "x" + cc[c] + "x" + dd[d] + "x" +ee[e]
+"x"+ ".jpg");
ImageIO.write(temp, "jpg", outputfile);
}}}}}}}
} catch (IOException e) {
System.out.println("Error: " + e.getMessage());
}
}
CLASSE 2
public class reconhecimento {
public static int ver =0;
public static BufferedImage reconhecedorPlaca(Mat matrix,int m,int n,int a,int b,int c,int d,int e ) {
int cols = matrix.cols();
int rows = matrix.rows();
int elemSize = (int)matrix.elemSize();
byte[] data = new byte[cols * rows * elemSize];
int type;
Mat imagemResultanteCanny = new Mat(matrix.rows(),matrix.cols(),CvType.CV_8UC1);
Imgproc.blur(matrix, imagemResultanteCanny,new Size(3,3));
Imgproc.Canny(imagemResultanteCanny, imagemResultanteCanny, m, n, 3, true);
Imgcodecs.imwrite("canny"+m+"x"+n+"x3ver"+ver+".jpg", imagemResultanteCanny);
ver++;
Mat lines = new Mat();
Imgproc.HoughLinesP(imagemResultanteCanny, lines, 2, Math.PI/180, b, c, d);
System.out.println(lines.size());
for (int x = 0; x < lines.cols(); x++)
{
double[] vec = lines.get(0, x);
org.opencv.core.Point start = new org.opencv.core.Point();
start.x = (int) vec[0];
start.y = (int) vec[1];
org.opencv.core.Point end = new org.opencv.core.Point();
end.x = (int) vec[2];
end.y = (int) vec[3];
Imgproc.line(matrix, start, end, new Scalar(255,255,255), 2);
}
Mat imagemResultanteCorner = new Mat();
Imgproc.cornerHarris(imagemResultanteCanny, imagemResultanteCorner, 2, 3, 0.04, 1);
Mat n_norm = new Mat();
normalize(imagemResultanteCorner, n_norm,0,255,Core.compareTo(Core),CvType.CV_32FC1);
Mat s_norm = new Mat();
//Imgproc.conveScaleAbs(n_norm, s_norm);
Imgcodecs.imwrite("corner"+m+"x"+n+"x"+a+"x"+b+"x"+c+"x"+d+"x"+e+"ver"+ver+".jpg",s_norm ...
try again in english, please
also, please do not throw your whole app at us, but try to come up with a minimal reproducing example, thank you.
It is in english