List of usage examples for java.awt.image ConvolveOp ConvolveOp
public ConvolveOp(Kernel kernel)
From source file:view.FramePrincipal.java
private void applyKernelJava(Kernel kernel, String DescricaoKernel) { long before = 0; long after = 0; double durationMS = 0; String message = null;/*from w w w . j a va 2 s . c om*/ BufferedImageOp bop = new ConvolveOp(kernel); before = System.nanoTime(); outputImage = bop.filter(inputImage, outputImage); after = System.nanoTime(); durationMS = (after - before) / 1e6; message = "Java: " + String.format("%.2f", durationMS) + " ms" + " Descrio : " + truncate(DescricaoKernel, 13); DadosEstatisticos dadosEstatisticos = new DadosEstatisticos(truncate(DescricaoKernel, 13), kernel.getWidth(), kernel.getHeight(), (float) durationMS); listaDadosEstatisticosJava.add(dadosEstatisticos); setInfoProcesso(dadosEstatisticos); System.out.println(message); }
From source file:view.FramePrincipal.java
private void applyKernelJavaThread(final Kernel kernel, final String DescricaoKernel) { new Thread(new Runnable() { @Override//from w w w . j a va2s . com public void run() { long before = 0; long after = 0; double durationMS = 0; String message = null; BufferedImageOp bop = new ConvolveOp(kernel); before = System.nanoTime(); outputImage = bop.filter(inputImage, outputImage); after = System.nanoTime(); durationMS = (after - before) / 1e6; message = "Java ThRead: " + String.format("%.2f", durationMS) + " ms" + " Descrio : " + truncate(DescricaoKernel, 13); DadosEstatisticos dadosEstatisticos = new DadosEstatisticos(truncate(DescricaoKernel, 13), kernel.getWidth(), kernel.getHeight(), (float) durationMS); listaDadosEstatisticosJavaTHREAD.add(dadosEstatisticos); setInfoProcesso(dadosEstatisticos); System.out.println(message); } }).start(); }
From source file:paintbasico2d.VentanaPrincipal.java
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed int index = jComboBox2.getSelectedIndex(); Kernel k;/* w ww.j a v a 2s .co m*/ VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame()); if (vi != null) { BufferedImage ImgSource = vi.getLienzo().getImage(); if (ImgSource != null) { try { switch (index) { case 0: k = KernelProducer.createKernel(KernelProducer.TYPE_MEDIA_3x3); break; case 1: k = KernelProducer.createKernel(KernelProducer.TYPE_BINOMIAL_3x3); break; case 2: k = KernelProducer.createKernel(KernelProducer.TYPE_ENFOQUE_3x3); break; case 3: k = KernelProducer.createKernel(KernelProducer.TYPE_RELIEVE_3x3); break; case 4: k = KernelProducer.createKernel(KernelProducer.TYPE_LAPLACIANA_3x3); break; default: k = null; } ConvolveOp cop = new ConvolveOp(k); BufferedImage imgdest = cop.filter(ImgSource, null); vi.getLienzo().setImage(imgdest); vi.getLienzo().repaint(); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); } } } }