Guest User

Untitled

a guest
Oct 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. webSource = new VideoCapture(0);
  2. myThread = new DaemonThread();
  3. Thread t = new Thread(myThread);
  4. t.setDaemon(true);
  5. myThread.runnable = true;
  6. t.start();
  7.  
  8. }
  9.  
  10. myThread.runnable = false;
  11. webSource.release();
  12.  
  13.  
  14.  
  15. JFileChooser jFileChooser1 = new JFileChooser("./images");
  16. int returnVal = jFileChooser1.showSaveDialog(this);
  17.  
  18. if(returnVal == JFileChooser.APPROVE_OPTION){
  19. File file = jFileChooser1.getSelectedFile().getAbsoluteFile();
  20. String path = jFileChooser1.getSelectedFile().getAbsolutePath();
  21. f = new File(file.toURI());
  22. Highgui.imwrite(file.getPath(), frame);
  23. }
  24.  
  25. FileInputStream fis;
  26. try {
  27. fis = new FileInputStream(f);
  28. ByteArrayOutputStream bos = new ByteArrayOutputStream();
  29. byte[] buf = new byte[1024];
  30. for(int readNum; (readNum = fis.read(buf)) != -1;){
  31. bos.write(buf, 0, readNum);
  32. }
  33. byte[] convict_image = bos.toByteArray();
  34. }catch (FileNotFoundException ex) {
  35. Logger.getLogger(cam.class.getName()).log(Level.SEVERE, null, ex);
  36. } catch (IOException ex) {
  37. Logger.getLogger(cam.class.getName()).log(Level.SEVERE, null, ex);
  38. }
Add Comment
Please, Sign In to add comment