elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 [13] 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ... 41
121  Programación / Java / Re: Conectar java + web cam en: 17 Mayo 2012, 07:31 am
En sintesis parece que si funciona la modificacion que hize porque cuando le doy al navegador mi ip de mi pc y el puerto que uso (127.0.0.1:9889) se ven los fotogramas lo malo que tengo que estar actualizando ( F5) para que se vea el siguiente fotograma ;
no tienes algun software que me puedas recomendar para verlos mas fluidos.
122  Programación / Java / Re: Conectar java + web cam en: 17 Mayo 2012, 07:00 am
Si se puede tiene que salirme para publicarlo en el foro :D me dijeron que cambie este parametro YUVFormat lugar de RGBFormat,ayudame en esa parte me salen errores porfavor !!!!
Aparentemente parece que funciona porque se prende el foco de mi camara!!!
pero no se ve nada:S mi duda esta si esta bien lo que he hecho

Código
  1. private static Player createPlayer(int width, int height) {
  2.        try {
  3.            Vector<CaptureDeviceInfo> devices = CaptureDeviceManager.getDeviceList(null);
  4.            for (CaptureDeviceInfo info : devices) {
  5.  
  6.                Format[] formats = info.getFormats();
  7.                for (Format format : formats) {
  8.                    if (!(format instanceof YUVFormat)) {
  9.                        continue;
  10.                    }
  11.                    //RGBFormat rgb = (RGBFormat) format;
  12.  
  13.                    YUVFormat YUV = (YUVFormat)format;
  14.                    //Dimension size = rgb.getSize();
  15.  
  16.                    Dimension size =YUV.getSize();
  17.                    if (size.width != width || size.height != height) {
  18.                        continue;
  19.                    }
  20.                   // if(YUV.get)
  21.                   // if (rgb.getPixelStride() != 3) {
  22.                    //    continue;
  23.                   // }
  24.                   // if (rgb.getBitsPerPixel() != 24) {
  25.                     //   continue;
  26.                   // }
  27.                  //  if (rgb.getLineStride() != width * 3) {
  28.                    //    continue;
  29.                  //  }
  30.                    MediaLocator locator = info.getLocator();
  31.                    DataSource source = Manager.createDataSource(locator);
  32.                    source.connect();
  33.                    System.out.println("XD");
  34.                    ((CaptureDevice) source).getFormatControls()[0].setFormat(YUV);
  35.                    return Manager.createRealizedPlayer(source);
  36.                }
  37.            }
  38.        } catch (IOException e) {
  39.            e.printStackTrace();
  40.        } catch (NoPlayerException e) {
  41.            e.printStackTrace();
  42.        } catch (CannotRealizeException e) {
  43.            e.printStackTrace();
  44.        } catch (NoDataSourceException e) {
  45.            e.printStackTrace();
  46.        }
  47.        return null;
  48.    }
  49.  
  50.  
  51.  
123  Programación / Java / Conectar java + web cam en: 17 Mayo 2012, 06:19 am
Buenas señores estoy desarrollando en android una aplicacion que incluye manejo de camara para hacer los testeos esoty usando una clase que encontre en google en la que puedo enlazar la camara del emuladro de android con mi web cam de mi laptop pero lo malo que no me sale me tira siempre este error :

<Unable to find a suitable player>

aqui les dejo la clase que encontre a ver si me dan una manito porque sale eso

Código
  1. import java.awt.Dimension;
  2. import java.awt.image.BufferedImage;
  3. import java.io.BufferedOutputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import java.io.OutputStream;
  7. import java.net.ServerSocket;
  8. import java.net.Socket;
  9. import java.util.Vector;
  10.  
  11. import javax.imageio.ImageIO;
  12. import javax.media.Buffer;
  13. import javax.media.CannotRealizeException;
  14. import javax.media.CaptureDeviceInfo;
  15. import javax.media.CaptureDeviceManager;
  16. import javax.media.Format;
  17. import javax.media.Manager;
  18. import javax.media.MediaLocator;
  19. import javax.media.NoDataSourceException;
  20. import javax.media.NoPlayerException;
  21. import javax.media.Player;
  22. import javax.media.control.FrameGrabbingControl;
  23. import javax.media.format.RGBFormat;
  24. import javax.media.format.VideoFormat;
  25. import javax.media.protocol.CaptureDevice;
  26. import javax.media.protocol.DataSource;
  27. import javax.media.util.BufferToImage;
  28.  
  29. /**
  30.  * A disposable class that uses JMF to serve a still sequence captured from a
  31.  * webcam over a socket connection. It doesn't use TCP, it just blindly captures
  32.  * a still, JPEG compresses it, and pumps it out over any incoming socket
  33.  * connection.
  34.  *
  35.  * @author Tom Gibara
  36.  *
  37.  */
  38.  
  39. public class WebcamBroadcaster {
  40.  
  41.        public static boolean RAW = false;
  42.  
  43.        private static Player createPlayer(int width, int height) {
  44.                try {
  45.                        Vector<CaptureDeviceInfo> devices = CaptureDeviceManager.getDeviceList(null);
  46.                        for (CaptureDeviceInfo info : devices) {
  47.  
  48.                                Format[] formats = info.getFormats();
  49.                                for (Format format : formats) {
  50.                                        if (!(format instanceof RGBFormat))
  51.                                                continue;
  52.                                        RGBFormat rgb = (RGBFormat) format;
  53.                                        Dimension size = rgb.getSize();
  54.                                        if (size.width != width || size.height != height)
  55.                                                continue;
  56.                                        if (rgb.getPixelStride() != 3)
  57.                                                continue;
  58.                                        if (rgb.getBitsPerPixel() != 24)
  59.                                                continue;
  60.                                        if (rgb.getLineStride() != width * 3)
  61.                                                continue;
  62.                                        MediaLocator locator = info.getLocator();
  63.                                        DataSource source = Manager.createDataSource(locator);
  64.                                        source.connect();
  65.                                        System.out.println("Done");
  66.                                        ((CaptureDevice) source).getFormatControls()[0]
  67.                                                        .setFormat(rgb);
  68.                                        return Manager.createRealizedPlayer(source);
  69.                                }
  70.                        }
  71.                } catch (IOException e) {
  72.                        e.printStackTrace();
  73.                } catch (NoPlayerException e) {
  74.                        e.printStackTrace();
  75.                } catch (CannotRealizeException e) {
  76.                        e.printStackTrace();
  77.                } catch (NoDataSourceException e) {
  78.                        e.printStackTrace();
  79.                }
  80.                return null;
  81.        }
  82.  
  83.        public static void main(String[] args) {
  84.                int[] values = new int[args.length];
  85.                for (int i = 0; i < values.length; i++) {
  86.                        values[i] = Integer.parseInt(args[i]);
  87.                }
  88.  
  89.  
  90.  
  91.                WebcamBroadcaster wb;
  92.                if (values.length == 0) {
  93.                        wb = new WebcamBroadcaster();
  94.                } else if (values.length == 1) {
  95.                        wb = new WebcamBroadcaster(values[0]);
  96.                } else if (values.length == 2) {
  97.                        wb = new WebcamBroadcaster(values[0], values[1]);
  98.                } else {
  99.                        wb = new WebcamBroadcaster(values[0], values[1], values[2]);
  100.                }
  101.  
  102.                wb.start();
  103.        }
  104.  
  105.        public static final int DEFAULT_PORT = 9889;
  106.        public static final int DEFAULT_WIDTH = 320;
  107.        public static final int DEFAULT_HEIGHT = 240;
  108.  
  109.        private final Object lock = new Object();
  110.  
  111.        private final int width;
  112.        private final int height;
  113.        private final int port;
  114.  
  115.        private boolean running;
  116.  
  117.        private Player player;
  118.        private FrameGrabbingControl control;
  119.        private boolean stopping;
  120.        private Worker worker;
  121.  
  122.        public WebcamBroadcaster(int width, int height, int port) {
  123.                this.width = width;
  124.                this.height = height;
  125.                this.port = port;
  126.        }
  127.  
  128.        public WebcamBroadcaster(int width, int height) {
  129.                this(width, height, DEFAULT_PORT);
  130.        }
  131.  
  132.        public WebcamBroadcaster(int port) {
  133.                this(DEFAULT_WIDTH, DEFAULT_HEIGHT, port);
  134.        }
  135.  
  136.        public WebcamBroadcaster() {
  137.                this(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_PORT);
  138.        }
  139.  
  140.        public void start() {
  141.                synchronized (lock) {
  142.                        if (running)
  143.                                return;
  144.                        player = createPlayer(width, height);
  145.                        if (player == null) {
  146.                                System.err.println("Unable to find a suitable player");
  147.                                return;
  148.                        }
  149.                        player.start();
  150.                        control = (FrameGrabbingControl) player
  151.                                        .getControl("javax.media.control.FrameGrabbingControl");
  152.                        worker = new Worker();
  153.                        worker.start();
  154.                        running = true;
  155.                }
  156.        }
  157.  
  158.        public void stop() throws InterruptedException {
  159.                synchronized (lock) {
  160.                        if (!running)
  161.                                return;
  162.                        if (player != null) {
  163.                                control = null;
  164.                                player.stop();
  165.                                player = null;
  166.                        }
  167.                        stopping = true;
  168.                        running = false;
  169.                        worker = null;
  170.                }
  171.                try {
  172.                        worker.join();
  173.                } finally {
  174.                        stopping = false;
  175.                }
  176.        }
  177.  
  178.        private class Worker extends Thread {
  179.  
  180.                private final int[] data = new int[width * height];
  181.  
  182.                @Override
  183.                public void run() {
  184.                        ServerSocket ss;
  185.                        try {
  186.                                ss = new ServerSocket(port);
  187.  
  188.                        } catch (IOException e) {
  189.                                e.printStackTrace();
  190.                                return;
  191.                        }
  192.  
  193.                        while (true) {
  194.                                FrameGrabbingControl c;
  195.                                synchronized (lock) {
  196.                                        if (stopping)
  197.                                                break;
  198.                                        c = control;
  199.                                }
  200.                                Socket socket = null;
  201.                                try {
  202.                                        socket = ss.accept();
  203.  
  204.                                        Buffer buffer = c.grabFrame();
  205.                                        BufferToImage btoi = new BufferToImage((VideoFormat) buffer
  206.                                                        .getFormat());
  207.                                        BufferedImage image = (BufferedImage) btoi
  208.                                                        .createImage(buffer);
  209.  
  210.                                        if (image != null) {
  211.                                                OutputStream out = socket.getOutputStream();
  212.                                                if (RAW) {
  213.                                                        image.getWritableTile(0, 0).getDataElements(0, 0,
  214.                                                                        width, height, data);
  215.                                                        image.releaseWritableTile(0, 0);
  216.                                                        DataOutputStream dout = new DataOutputStream(
  217.                                                                        new BufferedOutputStream(out));
  218.                                                        for (int i = 0; i < data.length; i++) {
  219.                                                                dout.writeInt(data[i]);
  220.                                                        }
  221.                                                        dout.close();
  222.                                                } else {
  223.                                                        ImageIO.write(image, "JPEG", out);
  224.                                                }
  225.                                        }
  226.  
  227.                                        socket.close();
  228.                                        socket = null;
  229.                                } catch (IOException e) {
  230.                                        e.printStackTrace();
  231.                                } finally {
  232.                                        if (socket != null)
  233.                                                try {
  234.                                                        socket.close();
  235.                                                } catch (IOException e) {
  236.                                                        /* ignore */
  237.                                                }
  238.                                }
  239.  
  240.                        }
  241.  
  242.                        try {
  243.                                ss.close();
  244.                        } catch (IOException e) {
  245.                                /* ignore */
  246.                        }
  247.                }
  248.  
  249.        }
  250.  
  251. }
  252.  
124  Programación / Java / Problemas con javax en: 16 Mayo 2012, 01:48 am
Buenas señores del foro esa ves estoy por aca por una pequeña duda me sale una serie de errores y hace referencia a la libreria javax.

import javax.imageio.ImageIO;
import javax.media.Buffer;
import javax.media.CannotRealizeException;
import javax.media.CaptureDeviceInfo;
import javax.media.CaptureDeviceManager;
import javax.media.Format;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoDataSourceException;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.control.FrameGrabbingControl;
import javax.media.format.RGBFormat;
import javax.media.format.VideoFormat;
import javax.media.protocol.CaptureDevice;
import javax.media.protocol.DataSource;
import javax.media.util.BufferToImage;

en todos esos paquetes me dicen que falta esa libreria ,mi pregunta es como poder integrarlos gracias
125  Programación / Java / Re: Estilos en Java en: 14 Mayo 2012, 07:10 am
Googleando me encontre con una librearia muy interesante  " Edisoncor " aca les dejo el link :
http://www.edisoncor.org/demos-edisoncorsx/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Edisoncor+%28Edisoncor+Weblog%29

Me parece bastante interesante,algo asi desearia poder desarrollar......alguna idea por donde empezar
126  Programación / Java / Re: Estilos en Java en: 14 Mayo 2012, 06:18 am
Me parece interesante lo que menciona jhonatanAsm se podra hacer eso :S ... seria interesante poder empotrar Jquerry
127  Programación / Java / Re: Estilos en Java en: 14 Mayo 2012, 00:58 am
Pero a la hora de dar la animaciones en los objetos que van dentro de mi Jframe,como mencionaba arriba ,asi como las animaciones que se puede dar con css3..... no se podria verdad ,entones cual seria la salida que me dan.
128  Programación / Java / Re: Estilos en Java en: 14 Mayo 2012, 00:53 am
Pero mi pregunta es si se puede empotrar codigo css3 en una aplicacion de escritorio Java.......
129  Programación / Java / Estilos en Java en: 13 Mayo 2012, 20:36 pm
Buenas señores del foro,quisiera que me disipen una duda :
-¿Se podra agregar codigo Css3 a un Jbutton en java para agregar algun estilo asi como cuando se pasa el mouse por el que se incline o que gire ?
-¿Si es posible me podrian ayudar con algunos link?
Fuera de todo esto cual esel codigo fuente de los botones,paneles,frames,etc...y si esque se puede modificar alguna de sus propiedaddes .

Gracias.............
130  Programación / Scripting / Problemas IDE Ruby en: 31 Marzo 2012, 08:18 am
Holas gente me podrian sugerir algun ide para programar en ruby :D me descarge aptana pero no me familiarizo mucho :S.... gracias
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 [13] 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ... 41
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines