Main Page
Namespaces
Classes
Files
File List
File Members
3rdParty
ARToolKitPlus
tools
CameraCalib
src
arFileGrabber.cpp
Go to the documentation of this file.
1
2
3
#include "
arFileGrabber.h
"
4
5
#include <windows.h>
6
#include <stdio.h>
7
#include <stdlib.h>
8
9
10
ARFileGrabber::ARFileGrabber
(
const
char
* nFileName,
int
nWidth,
int
nHeight,
int
nByterPerComp)
11
{
12
width
=nWidth;
13
height
=nHeight;
14
bufferlen
= nByterPerComp*
width
*
height
;
15
buffer
=
new
unsigned
char
[
bufferlen
];
16
17
filename
=
new
char
[strlen(nFileName)+1];
18
strcpy(
filename
, nFileName);
19
20
fileIdx
= 0;
21
oldIdx
= -1;
22
showedWarning
=
false
;
23
}
24
25
26
ARFileGrabber::~ARFileGrabber
()
27
{
28
delete
buffer
;
29
}
30
31
32
void
33
ARFileGrabber::GrabFrame
()
34
{
35
char
fname[
MAX_PATH
];
36
37
sprintf(fname,
filename
,
fileIdx
);
38
39
FILE* fp = fopen(fname,
"rb"
);
40
41
if
(!fp)
42
{
43
if
(!
showedWarning
)
44
printf(
"ERROR: can not load file: '%s'\n"
, fname);
45
showedWarning
=
true
;
46
return
;
47
}
48
49
fread(
buffer
, 1,
bufferlen
, fp);
50
fclose(fp);
51
52
if
(
fileIdx
!=
oldIdx
)
53
{
54
printf(
"reading file %s\n"
, fname);
55
oldIdx
=
fileIdx
;
56
}
57
}
58
59
60
void
61
ARFileGrabber::NextFile
()
62
{
63
fileIdx
++;
64
//printf("setting fileIdx to %d\n", fileIdx);
65
showedWarning
=
false
;
66
}
ARFileGrabber::showedWarning
bool showedWarning
Definition:
arFileGrabber.h:35
ARFileGrabber::width
int width
Definition:
arFileGrabber.h:32
ARFileGrabber::buffer
unsigned char * buffer
Definition:
arFileGrabber.h:33
ARFileGrabber::height
int height
Definition:
arFileGrabber.h:32
ARFileGrabber::NextFile
void NextFile()
Definition:
arFileGrabber.cpp:61
ARFileGrabber::fileIdx
int fileIdx
Definition:
arFileGrabber.h:39
ARFileGrabber::oldIdx
int oldIdx
Definition:
arFileGrabber.h:39
arFileGrabber.h
ARFileGrabber::ARFileGrabber
ARFileGrabber(const char *nFileName, int nWidth=320, int nHeight=240, int nByterPerComp=4)
Definition:
arFileGrabber.cpp:10
MAX_PATH
#define MAX_PATH
Definition:
config.h:224
ARFileGrabber::GrabFrame
void GrabFrame()
Definition:
arFileGrabber.cpp:33
ARFileGrabber::~ARFileGrabber
virtual ~ARFileGrabber()
Definition:
arFileGrabber.cpp:26
ARFileGrabber::filename
char * filename
Definition:
arFileGrabber.h:37
ARFileGrabber::bufferlen
int bufferlen
Definition:
arFileGrabber.h:34
tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun Sep 4 2016 03:24:33