Hi all,
I'm an Italian student and I was trying to implement within docstrum
ocropus for the analysis of layouts.
I am using the Eclipse CDT. On this page I found some examples
http://code.google.com/p/ocropus/wiki/CxxProgramming . The first
example about the use of components works well and i have tried to use
other interfaces too.
When i try to defining a new components i get this error
main_ocropus(argc,argv);
This is my code:
#include <colib/colib.h>
#include <iulib/iulib.h>
#include <ocropus/ocropus.h>
using namespace colib;
using namespace iulib;
using namespace ocropus;
struct MyThresholder : IBinarize {
const char *name() { return "MyThresholder"; }
const char *description() { return "performs thresholding based on
the mean"; }
MyThresholder() {
pdef("factor",1.0,"threshold is factor * mean");
}
void binarize(bytearray &out,floatarray &in) {
float factor = pgetf("factor");
float mean = sum(in)/in.length();
debugf("info","threshold=%g\n",mean);
int n = in.length();
out.makelike(in);
for(int i=0;i<n;i++)
out[i] = 255 * (in[i]>=factor*mean);
}
};
extern "C" {
void ocropus_init_dl();
}
void ocropus_init_dl() {
component_register<MyThresholder>("MyThresholder");
}
int main(int argc, const char* argv[]) {
component_register<MyThresholder>("MyThresholder");
\\try to use my new component
try {
// register all the internal OCRopus components so that
make_component works
init_ocropus_components();
autodel<IBinarize> binarizer;
make_component("MyThresholder",binarizer);
// read an input image
bytearray image;
read_image_gray(image,"mp00032c.tif");
// apply the binarizer
bytearray output;
binarizer->binarize(output,image);
// write the result
write_image_gray("test2.png",output);
} catch(const char *message) {
fprintf(stderr,"error: %s\n",message);
exit(1);
}
}
where i make the error?
Can you help me? thanks
--
You received this message because you are subscribed to the Google Groups
"ocropus" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/ocropus?hl=en.