Posso Usar OpenCV na linguagem Java

Gostaria de saber, se tem possibilidade de desenvolver um sistema em Java pra reconhecer placas de carros , através da placa ia ser a situação , que seria Paga ou Não Pago. Esse é para entrada no camping de minha cidade

https://opencv-java-tutorials.readthedocs.io/en/latest/02-first-java-application-with-opencv.html

Procura por openAlpr

pagar é brabo kkk

olha o github deles, tem o fonte lá, mas vc é responsavel por treinar as imagens

1 curtida

ah vou olhar, falando nisso olha que fiz de errado, não aparece a imagem, mas não da erro.

public class Reconhecimento extends javax.swing.JInternalFrame{

   private DaemonThread trend = null;
    int count = 0;
    VideoCapture webSource =null;
    Mat frame = new Mat();
    MatOfByte mem = new MatOfByte();
    
    
     public Reconhecimento() {
        
        initComponents();
     }
    
    class DaemonThread implements Runnable{
    
    protected volatile boolean runnable = false;

    @Override
   

    public  void run()
    {
        synchronized(this)
        {
            while(runnable)
            {
                if(webSource.grab())
                {
		    	try
                        {
                            webSource.retrieve(frame);
			Imgcodecs.imencode(".bmp", frame, mem);
			    Image im = ImageIO.read(new ByteArrayInputStream(mem.toArray()));

			    BufferedImage buff = (BufferedImage) im;
			    Graphics g=jPanel1.getGraphics();

			    if (g.drawImage(buff, 0, 0, getWidth(), getHeight() -150 , 0, 0, buff.getWidth(), buff.getHeight(), null))
			    
			    if(runnable == false)
                            {
			    	System.out.println("Going to wait()");
			    	this.wait();
			    }
			 }
			 catch(IOException | InterruptedException ex)
                         {
			    System.out.println("Error");
                         }
                }       }

Eu conheço esse código em kkkkkkkk

coloca assim:

if (g.drawImage(buff, 0, 0, 200, 200, 0, 0, buff.getWidth(), buff.getHeight(), null))

Eu postei o source no github, baixa o projeto e vai se guiando por ele

Vc criou o codigo? Tava seguindo um tutorial em inglês, e pede pra colocar um numero no webSource = new VideoCapture(); só que se coloco por Exemplo o (0) da erro.
identar texto pré-formatado por 4 espaços
webSource = new VideoCapture();

trend = new DaemonThread();

        Thread t = new Thread(trend);
        t.setDaemon(true);
        
        trend.runnable = true;
        t.start();
		 inicio.setEnabled(false);  //start button
        pause.setEnabled(true);  // stop button
}

Foi sim

Esse número é referente ao index de webcam, exemplo, se vc tem duas webcam no pc, e vc quer usar a segunda, vc pode colocar

webSource = new VideoCapture(1); //se vc colocar 0, vai colocar a camera default

Qual erro dá?

webSource = new VideoCapture(0); constructor videocapture in class videocapture cannot be applied to given type required no arguments found int
reason actual and formal arguments lists differ in length

vc criou uma classe chamada videocapture? Cara, se baseia no projeto que eu te passei

1 curtida

sim vou dar uma olhada

Vc nao pode criar uma classe chamada videocapture, pq esse é um metodo que vc vai usar, coloca só Capture

1 curtida

mas não criei a classe.

 public class Reconhecimento extends javax.swing.JInternalFrame{

   private DaemonThread trend = null;
int count = 0;
VideoCapture webSource= null ;
Mat frame = new Mat();
MatOfByte mem = new MatOfByte();


 public Reconhecimento() {

initComponents();
 }

class DaemonThread implements Runnable{

protected volatile boolean runnable = false;

@Override
   

public  void run()
{
synchronized(this)
{
while(runnable)
{
    if(webSource.grab())
    {
		    	try
            {
                webSource.retrieve(frame);
			Imgcodecs.imencode(".bmp", frame, mem);
			    Image im = ImageIO.read(new ByteArrayInputStream(mem.toArray()));

			    BufferedImage buff = (BufferedImage) im;
			    Graphics g=paneil.getGraphics();

			   if (g.drawImage(buff, 0, 0, 200, 200, 0, 0, buff.getWidth(), buff.getHeight(), null))
			    
			    if(runnable == false)
                {
			    	System.out.println("Going to wait()");
			    	this.wait();
			    }
			 }
			 catch(IOException | InterruptedException ex)
             {
			    System.out.println("Error");
             }
    }       }


Botao iniciar 

private void inicioActionPerformed(java.awt.event.ActionEvent evt) {                                       
// TODO add your handling code here:


  trend = new DaemonThread();
  
Thread t = new Thread(trend);
t.setDaemon(true);

trend.runnable = true;
t.start();
			 inicio.setEnabled(false);  //start button
pause.setEnabled(true);  // stop button
}

ué, vc disse “sim”…

mas é melhor dar uma olhada lá, assim por cima não da pra saber o que é exatamente

sim pro projeto que tu falou pra olhar kk

Ahhhh

quando der um tempo da uma olhada https://github.com/Alexandre05/Sistema_Praia_De_ManoelViana

Mas dar uma olhada no que?