Olha, MediaLocator e CaptureDeviceInfo não são dispositivos de pintura nem buffers de bytes(imagens).
O primeiro procura dispositivos de captura no seu sistema e envia um vetor de dispositivos para CaptureDeviceInfo.
Se eu fosse você encerraria a idéia de usar jmf. Isso ae já devia ter sido extinto a milhares de anos, não sei como o pessoal do guj usa ainda, ou não pesquisou algo melhor.
[color=darkblue] O DSJ :lol: é muito bom, não conhecia, obrigado !
Na verdade o que eu preciso é algo que também não estou encontrando nele, queria editar a imagem de exibição da Webcam em tempo de captura.
Segue o código para captura com WebCan no DSJ - Java
[/color]
/**dsj demo code.You may use, modify and redistribute this code under the terms laid out in the header of the DSJDemo application.copyright 2005-10N.Petershumatic GmbHBerlin, Germany**/importde.humatic.dsj.*;publicclassSimpleCaptureimplementsjava.beans.PropertyChangeListener{privateDSCapturegraph;publicSimpleCapture(){}publicvoidcreateGraph(){javax.swing.JFramef=newjavax.swing.JFrame("dsj SimpleCapture");/** queryDevices returns video device infos in slot 0 / audio device infos in slot 1 **/DSFilterInfo[][]dsi=DSCapture.queryDevices();/** this sample only uses video **/graph=newDSCapture(DSFiltergraph.DD7,dsi[0][0],false,DSFilterInfo.doNotRender(),this);f.add(java.awt.BorderLayout.CENTER,graph.asComponent());f.add(java.awt.BorderLayout.SOUTH,newSwingMovieController(graph));finaljavax.swing.JButtontoFile=newjavax.swing.JButton("set capture file");toFile.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEvente){if(graph.getState()==DSCapture.PREVIEW){/* capture to a Windows Media file using the default profile */graph.setCaptureFile("captureTest.asf",DSFilterInfo.doNotRender(),DSFilterInfo.doNotRender(),true);toFile.setText("set preview");/* start recording right away. Outcomment to control this from GUI */graph.record();}else{graph.setPreview();toFile.setText("set capture file");}}});f.add(java.awt.BorderLayout.NORTH,toFile);f.pack();f.setVisible(true);javax.swing.JFramejf=newjavax.swing.JFrame("Device control");jf.setLayout(newjava.awt.GridLayout(0,1));if(graph.getActiveVideoDevice()!=null&&graph.getActiveVideoDevice().getControls()!=null){for(inti=CaptureDeviceControls.BRIGHTNESS;i<CaptureDeviceControls.LT_FINDFACE;i++)try{jf.add(graph.getActiveVideoDevice().getControls().getController(i,0,true));}catch(Exceptionex){}}if(graph.getActiveAudioDevice()!=null)for(inti=CaptureDeviceControls.MASTER_VOL;i<CaptureDeviceControls.TREBLE;i++)try{jf.add(graph.getActiveAudioDevice().getControls().getController(i,0,true));}catch(Exceptionex){}if(jf.getContentPane().getComponentCount()==0)return;jf.pack();jf.setVisible(true);/** Don't do this at home. This demo relies on dsj closing and disposing off filtergraphs when the JVM exits. This is OK for a "open graph, do something & exit" style demo, but real world applications should take care of calling dispose() on filtergraphs they're done with themselves. **/f.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);}publicvoidpropertyChange(java.beans.PropertyChangeEventpe){switch(DSJUtils.getEventType(pe)){}}publicstaticvoidmain(String[]args){newSimpleCapture().createGraph();}}
J
juliocbq
Metaleiro:
[color=darkblue] O DSI é muito bom, não conhecia, obrigado !
Na verdade o que eu preciso é algo que também não estou encontrando nele, queria editar a imagem de exibição da Webcam em tempo de captura.
Segue o código para captura com WebCan no DSI - Java
[/color]
“DSJ” - DirectShow Java
Para filtrar a imagem em tempo real precisa implementar “filtros” para a jmf. Funcionam como codecs(é um).
Se eu fosse você escrevia filtros em c++ com a api do directx/directshow, e posteriormente carregava-os com a dsj.
Se for utilizar jmf, aqui vai um tutorial, mas o desempenho é literalmente podre(Para filtrar em tempo real):