Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- webSource = new VideoCapture(0);
- myThread = new DaemonThread();
- Thread t = new Thread(myThread);
- t.setDaemon(true);
- myThread.runnable = true;
- t.start();
- }
- myThread.runnable = false;
- webSource.release();
- JFileChooser jFileChooser1 = new JFileChooser("./images");
- int returnVal = jFileChooser1.showSaveDialog(this);
- if(returnVal == JFileChooser.APPROVE_OPTION){
- File file = jFileChooser1.getSelectedFile().getAbsoluteFile();
- String path = jFileChooser1.getSelectedFile().getAbsolutePath();
- f = new File(file.toURI());
- Highgui.imwrite(file.getPath(), frame);
- }
- FileInputStream fis;
- try {
- fis = new FileInputStream(f);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- for(int readNum; (readNum = fis.read(buf)) != -1;){
- bos.write(buf, 0, readNum);
- }
- byte[] convict_image = bos.toByteArray();
- }catch (FileNotFoundException ex) {
- Logger.getLogger(cam.class.getName()).log(Level.SEVERE, null, ex);
- } catch (IOException ex) {
- Logger.getLogger(cam.class.getName()).log(Level.SEVERE, null, ex);
- }
Add Comment
Please, Sign In to add comment