static void node_composit_exec_cvNegative(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { int i,j; IplImage *image, *negative_img; CvScalar s; CV_FUNCNAME( "cvNegative" ); if(out[0]->hasoutput==0) return; cvSetErrMode(1); //Parent mode error __CV_BEGIN__; if(in[0]->data){ CV_CALL(image = in[0]->data); negative_img= cvCreateImage(cvSize(image->width,image->height),image->depth,image->nChannels); //NEGATIVO for(i=1; i<image->height-1; i++) for(j=1; j<image->width-1; j++){ CV_CALL(s=cvGet2D(image,i,j)); s.val[0]= 255 - s.val[0]; s.val[1]= 255 - s.val[1]; s.val[2]= 255 - s.val[2]; CV_CALL(cvSet2D(negative_img,i,j,s)); } CV_CALL(out[0]->data= negative_img); } __CV_END__; }
static void node_composit_exec_cvMult(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { CvArr* dst; CvArr* src1; CvArr* src2; CV_FUNCNAME( "cvMult" ); if(out[0]->hasoutput==0) return; cvSetErrMode(1); //Parent mode error __CV_BEGIN__; if((in[0]->data)&&(in[1]->data)){ CV_CALL(src1 = in[0]->data); CV_CALL(src2 = in[1]->data); if(!BOCV_checkAreSameType(src1, src2)) CV_ERROR( CV_StsBadArg,"The source inputs are differents" ); CV_CALL(dst=BOCV_CreateArrFrom(src2)); if(dst) { CV_CALL(cvMul(src1, src2, dst, 1.0)); CV_CALL(out[0]->data= dst); } } __CV_END__; }
static void node_composit_exec_cvSmooth(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { //TODO: Use atach buffers int w,h; int p1, p2; float p3,p4; int type; CV_FUNCNAME( "cvSmooth" ); if(out[0]->hasoutput==0) return; cvSetErrMode(1); //Parent mode error __CV_BEGIN__; if(in[0]->data){ IplImage *img, *smth; CV_CALL(img = in[0]->data); w=img->width; h=img->height; CV_CALL(p1= (int)in[1]->vec[0]); if((p1%2)==0){ p1--; } CV_CALL(p2= (int)in[2]->vec[0]); if((p2%2)==0) p2--; CV_CALL(p3= in[3]->vec[0]); CV_CALL(p4= in[4]->vec[0]); smth = cvCreateImage(cvSize(w,h), img->depth, img->nChannels); switch(node->custom1) { case 0: type=CV_BLUR_NO_SCALE; break; case 1: type=CV_BLUR; break; case 2: type=CV_GAUSSIAN; break; case 3://Must change image to 8U with 1 3 or 4 channels type=CV_MEDIAN; break; case 4://Must change image to 8U with 1 or 3 channels type=CV_BILATERAL; break; } CV_CALL(cvSmooth(img, smth, type, p1, p2, p3, p4 )); CV_CALL(out[0]->data= smth); } __CV_END__; }
static void node_composit_exec_CvPoint(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { //TODO: Use atach buffers CvPoint p; /* stack order out: Image */ CV_FUNCNAME( "cvPoint" ); if(out[0]->hasoutput==0) return; cvSetErrMode(1); //Parent mode error __CV_BEGIN__; p= cvPoint((int)in[0]->vec[0],(int)in[1]->vec[0]); CV_CALL(out[0]->vec[0]=p.x); CV_CALL(out[0]->vec[1]=p.y); printf("Point x:%d vectorX:%d \n",&p.x,out[0]->vec[0]); __CV_END__; }
static void node_composit_exec_cvResize(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { //TODO: Use atach buffers int w,h; IplImage *image, *dst; CV_FUNCNAME( "cvResize" ); if(out[0]->hasoutput==0) return; cvSetErrMode(1); //Parent mode error __CV_BEGIN__; CV_CALL(image = in[0]->data); CV_CALL(w=(int)in[1]->vec[0]); CV_CALL(h=(int)in[2]->vec[0]); dst= cvCreateImage(cvSize(w,h),image->depth,image->nChannels); if(in[0]->data){ cvResize(image,dst,CV_INTER_LINEAR); out[0]->data= dst; } __CV_END__; }
JNIEXPORT void JNICALL Java_io_card_payment_CardScanner_nSetup(JNIEnv *env, jobject thiz, jboolean shouldOnlyDetectCard, jfloat jMinFocusScore) { dmz_debug_log("Java_io_card_payment_CardScanner_nSetup"); dmz_trace_log("dmz trace enabled"); detectOnly = shouldOnlyDetectCard; minFocusScore = jMinFocusScore; flipped = false; lastFrameWasUsable = false; if (dmz == NULL) { dmz = dmz_context_create(); scanner_initialize(&scannerState); } else { scanner_reset(&scannerState); } dmz_refcount++; cvSetErrMode(CV_ErrModeParent); }
static void node_composit_exec_cvLaplace(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { IplImage *image, *laplace_img, *img_grey; int aperture; CV_FUNCNAME( "cvLaplace" ); if(out[0]->hasoutput==0) return; cvSetErrMode(1); //Parent mode error __CV_BEGIN__; if(in[0]->data){ switch(node->custom1){ case 0: CV_CALL(aperture=3); break; case 1: CV_CALL(aperture=1); break; case 2: CV_CALL(aperture=5); break; case 3: CV_CALL(aperture=7); break; case 4: CV_CALL(aperture=9); break; } CV_CALL(image = in[0]->data); laplace_img= cvCreateImage(cvSize(image->width,image->height),32,1); img_grey= cvCreateImage(cvSize(image->width,image->height),IPL_DEPTH_8U,1); CV_CALL(cvCvtColor(image,img_grey, CV_BGR2GRAY)); CV_CALL(cvLaplace(img_grey,laplace_img,aperture)); CV_CALL(out[0]->data= laplace_img); } __CV_END__; }
int cveSetErrMode(int mode) { return cvSetErrMode(mode); }