Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- java
- multiwii
- atmega1280
- Bosch
- HMC5883L
- Digital Pressure Sensor
- atmega
- QuadricopterX
- ITG3200
- BMP085
- atmega168
- Barometer
- imu
- 멀티위
- capture
- BMA180
- AT91
- Honeywell
- Sebastian Madgwick
- 9DOF
- WinAVR
- AVR
- javacv
- WinARM
- Triple Axis Magnetometer
- Arduino 328p
- HMC5843
- FreeIMU
- xloader
- arduino
Archives
- Today
- Total
스나군 작업실
JavaCV: Capture/save/flip image and show live image on CanvasFrame from camera 본문
Java/라이브러리
JavaCV: Capture/save/flip image and show live image on CanvasFrame from camera
스나군 2012. 1. 4. 20:37원문 : http://ganeshtiwaridotcomdotnp.blogspot.com/2011/12/javacv-capture-save-flip-show-live.html
JAVA CODE:
import static com.googlecode.javacv.cpp.opencv_core.cvFlip;
import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage;
import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FrameGrabber;
import com.googlecode.javacv.VideoInputFrameGrabber;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
public class GrabberShow implements Runnable {
//final int INTERVAL=1000;///you may use interval
IplImage image;
CanvasFrame canvas = new CanvasFrame("Web Cam");
public GrabberShow() {
canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
}
@Override
public void run() {
FrameGrabber grabber = new VideoInputFrameGrabber(1);
int i=0;
try {
grabber.start();
IplImage img;
while (true) {
img = grabber.grab();
if (img != null) {
cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise
cvSaveImage((i++)+"-aa.jpg", img);
// show image on window
canvas.showImage(img);
}
//Thread.sleep(INTERVAL);
}
} catch (Exception e) {
}
}
}
Test: public class TestGrabber { public static void main(String[] args) { GrabberShow gs = new GrabberShow(); Thread th = new Thread(gs); th.start(); } }
Test: public class TestGrabber { public static void main(String[] args) { GrabberShow gs = new GrabberShow(); Thread th = new Thread(gs); th.start(); } }
'Java > 라이브러리' 카테고리의 다른 글
JavaCV : Capture Image from webcam (0) | 2012.01.04 |
---|---|
OpenCV-JavaCV : eclipse project configuration windows 7 (0) | 2012.01.04 |
Comments