00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "RAWLoader.h"
00013
#include <OpenCAL/Image.h>
00014
using namespace OpenCAL::Utils;
00015
00016
#include <fstream>
00017
using namespace std;
00018
00019
00020
00021
00022
00023
00024 RAWLoader::RAWLoader()
00025 {
00026 }
00027
00028 RAWLoader::~RAWLoader()
00029 {
00030 }
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 void RAWLoader::loadImage(
Image *image,
const string &filename)
00043 {
00044
static const unsigned int width = 256;
00045
static const unsigned int height = 256;
00046
static const unsigned int depth = 3;
00047
00048
00049 ifstream file(filename.c_str());
00050
if(!file)
00051 {
00053 cerr <<
"The file couldn't be opened" << endl;
00054
return;
00055 }
00056
00057
00058 image->
resize(width, height, depth);
00059
00060 file.read((
char *) image->
getData(), width * height * depth);
00061 file.close();
00062 }
00063
00064
00065
00066
00067