You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.0 KiB
75 lines
2.0 KiB
#include "basicImageAux.h"
|
|
/*
|
|
|
|
SSID:DIRECT - JUQ0 : DSC - QX10
|
|
Password : 9vQC7o5m
|
|
|
|
*/
|
|
|
|
cortexImage *copy_image(cortexImage *p){
|
|
cortexImage *RetVal, *RetVal2;
|
|
RetVal = new cortexImage( p );
|
|
RetVal->data = (float*)calloc(p->h*p->w*p->c, sizeof(float));
|
|
if( RetVal->data != NULL ) {
|
|
RetVal->h = p->h;
|
|
RetVal->c = p->c;
|
|
RetVal->w = p->w;
|
|
memcpy( RetVal->data, p->data, p->h*p->w*p->c*sizeof(float));
|
|
};
|
|
RetVal2 = RetVal;
|
|
return RetVal2;
|
|
};
|
|
|
|
cortexImageList **loadAlphabet(char *PathTemplate){
|
|
cortexImageList **RetVal;
|
|
RetVal = (cortexImageList**)calloc(8, sizeof(cortexImageList*));
|
|
if (RetVal != NULL) {
|
|
int i, j;
|
|
for (j = 0; j < 8; ++j){
|
|
RetVal[j] = new cortexImageList();
|
|
for( i = 32; i < 127; ++i ){
|
|
char buff[256];
|
|
cortexImage *tVal;
|
|
sprintf(buff, ((PathTemplate == NULL) ? "data/labels/%d_%d.png" : PathTemplate), i, j);
|
|
tVal = new cortexImage();
|
|
tVal->fillFromFile( buff, 0, 0, 3 );
|
|
RetVal[j]->push_back(tVal);
|
|
};
|
|
};
|
|
};
|
|
return RetVal;
|
|
};
|
|
|
|
cortexImage *createLabel(cortexImageList *Alphabet, char *string, int size){
|
|
cortexImage *RetVal=NULL;
|
|
if( size > 7 ) size = 7;
|
|
while( *string != (char)0 ){
|
|
cortexImage *tVal = Alphabet[size][((int)*string) - 32];
|
|
RetVal = tileImages(tVal, RetVal, -size - 1 + (size + 1) / 2);
|
|
delete(tVal);
|
|
tVal = RetVal;
|
|
++string;
|
|
};
|
|
RetVal->drawBoxWEX(0, 0, RetVal->w, RetVal->h, (int)(RetVal->h*.25), 0.f, 1.f, 0.f);
|
|
return RetVal;
|
|
};
|
|
|
|
cortexImage *tileImages(cortexImage *a, cortexImage *b, int dx){
|
|
cortexImage *RetVal = NULL;
|
|
if( a!= NULL && b!=NULL )
|
|
if( a->w == 0 ){
|
|
RetVal = new cortexImage(b);
|
|
} else if( b->w == 0 ){
|
|
RetVal = new cortexImage(a);
|
|
} else {
|
|
RetVal = new cortexImage();
|
|
if (RetVal != NULL){
|
|
RetVal->makeEmpty(a->w + b->w + dx, (a->h > b->h) ? a->h : b->h, (a->c > b->c) ? a->c : b->c);
|
|
//RetVal->fill_cpu(RetVal->w*RetVal->h*RetVal->c, 1, RetVal->data, 1);//??
|
|
RetVal->embed( a, 0, 0 );
|
|
RetVal->composite( b, a->w + dx, 0 );
|
|
};
|
|
};
|
|
return RetVal;
|
|
};
|
|
|