영상 캡쳐 소스 질문이요~

curajc의 이미지

제가 직접 작성한 소스는 아니구요--
처음 하는 거라, 구해서 나름대로 분석해 보았는데, 잘 이해가 안되는 부분이 있어서요
캡쳐하는 것 까진 알겠는데 그 다음, ppm파일로 저장을 시키는 것 같은데 ppm파일은 어디에 저장이 되는 건가요??;;;;

실행시키면 일정 숫자만 한 일분동안 쫙~ 나오다 끝나는데...
설마 이렇게 데이터 출력하고 끝나는 건가요? 저장 하는 부분이 어딘지 잘 모르긴 하겠지만;;;;

컴파일시킬때 pnmtojpeg -quality=100 img0.ppm>img0.jpg
요런 부분이 있는데 그러면 img0.jpg는 있어야 하는게 아닌가요?
도와주세요ㅠㅠ

관련 부분 소스 올립니다----
/* Map the address space for device to the address space for this process */
map = (char *)mmap(0, m_buf.size, PROT_READ, MAP_SHARED, fd, 0);
if(map == MAP_FAILED)
perror("mmap");

/* Set image parameters for mapped memory area */
v_map.frame = 0;
v_map.height = img_h;
v_map.width = img_w;
// v_map.format = VIDEO_PALETTE_RGB24;
pic.palette = VIDEO_PALETTE_YUV420P;

/* Capture a frame. The data will be present in the mapped user space */
if( (ret = ioctl(fd, VIDIOCMCAPTURE, &v_map)) < 0 ) {
fprintf(stderr,"ioctl on VIDIOCMCAPTURE failed\n");
exit(1);
}

/* Wait for end of frame */
if( (ret = ioctl(fd, VIDIOCSYNC, &v_map)) < 0 ) {
fprintf(stderr,"ioctl on VIDIOCSYNC failed\n");
exit(1);
}

map1=(char *)malloc(img_w*img_h*(img_d/8));
yuv2rgb_init();
yuv2rgb(map1,map,img_w*3,img_w,img_h);

/* print out RGB values for pixels of the frame to the standard output */
/* values are initially stored in memory in the BGR format */
// p = map;
p = map1;
printf("P3\n%d %d\n255", img_w, img_h);

for(i = 0; i < img_h; i++) {
for(j = 0; j < img_w; j++) {
if( (3*j%15) == 0 )
printf("\n");
printf("%d %d %d ", *(p+2), *(p+1), *p);
p = p + 3;
}
printf("\n");
}

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.