![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
カメラ
main.cpp@0:8399d5434f4f, 2011-11-17 (annotated)
- Committer:
- yamaguch
- Date:
- Thu Nov 17 14:00:47 2011 +0000
- Revision:
- 0:8399d5434f4f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yamaguch | 0:8399d5434f4f | 1 | #include "mbed.h" |
yamaguch | 0:8399d5434f4f | 2 | #include "JPEGCamera.h" |
yamaguch | 0:8399d5434f4f | 3 | |
yamaguch | 0:8399d5434f4f | 4 | int main() { |
yamaguch | 0:8399d5434f4f | 5 | JPEGCamera camera(p28, p27); // TX, RX |
yamaguch | 0:8399d5434f4f | 6 | LocalFileSystem local("local"); |
yamaguch | 0:8399d5434f4f | 7 | Timer timer; |
yamaguch | 0:8399d5434f4f | 8 | timer.start(); |
yamaguch | 0:8399d5434f4f | 9 | camera.setPictureSize(JPEGCamera::SIZE320x240); |
yamaguch | 0:8399d5434f4f | 10 | |
yamaguch | 0:8399d5434f4f | 11 | for (int i = 0; i < 10; i++) { |
yamaguch | 0:8399d5434f4f | 12 | if (camera.isReady()) { |
yamaguch | 0:8399d5434f4f | 13 | char filename[32]; |
yamaguch | 0:8399d5434f4f | 14 | sprintf(filename, "/local/pict%03d.jpg", i); |
yamaguch | 0:8399d5434f4f | 15 | printf("Picture: %s ", filename); |
yamaguch | 0:8399d5434f4f | 16 | if (camera.takePicture(filename)) { |
yamaguch | 0:8399d5434f4f | 17 | while (camera.isProcessing()) { |
yamaguch | 0:8399d5434f4f | 18 | camera.processPicture(); |
yamaguch | 0:8399d5434f4f | 19 | } |
yamaguch | 0:8399d5434f4f | 20 | } else { |
yamaguch | 0:8399d5434f4f | 21 | printf("take picture failed\n"); |
yamaguch | 0:8399d5434f4f | 22 | } |
yamaguch | 0:8399d5434f4f | 23 | } else { |
yamaguch | 0:8399d5434f4f | 24 | printf("camera is not ready\n"); |
yamaguch | 0:8399d5434f4f | 25 | } |
yamaguch | 0:8399d5434f4f | 26 | } |
yamaguch | 0:8399d5434f4f | 27 | printf("time = %f\n", timer.read()); |
yamaguch | 0:8399d5434f4f | 28 | } |