// 색1 색2 색1 색2 색1 색2 void Take_Copter(Mat Cam, Mat Cam2, Copter& cop) { pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; Mat YUV_PIC3; Mat Pic2_col1(cop.Picture3.rows,cop.Picture3.cols,CV_8UC1); Mat Pic2_col2(cop.Picture3.rows,cop.Picture3.cols,CV_8UC1); Mat temp3(cop.Picture3.rows,cop.Picture3.cols,CV_8UC1); Mat temp4(cop.Picture3.rows,cop.Picture3.cols,CV_8UC1); Mat temp5(cop.Picture3.rows,cop.Picture3.cols,CV_8UC1); Mat temp6(cop.Picture3.rows,cop.Picture3.cols,CV_8UC1); cvtColor(cop.Picture3,YUV_PIC3,CV_RGB2YCrCb); vector<Mat> yuv; Mat Corr_1_1;//색1 Mat Corr_1_2;//색1 Mat Corr_2_1;//색2 Mat Corr_2_2;//색2 int corr_size_X =0; int corr_size_Y =0; Mat Result; double min,max; Point Copter_point; for(int i=0; i<V_BUFFER_SIZE; i++) { cop.prev_cx[i] = -5000; cop.prev_cy[i] = -5000; } if(cop.find_mode == true){ cop.find_mode = false; matchTemplate(Cam,cop.Pic_Binary1,Corr_1_1,CV_TM_CCOEFF_NORMED); matchTemplate(Cam2,cop.Pic_Binary2,Corr_1_2,CV_TM_CCOEFF_NORMED); if(Corr_1_1.rows<Corr_1_2.rows) { corr_size_Y = Corr_1_1.rows; } else { corr_size_Y = Corr_1_2.rows; } if(Corr_1_1.cols<Corr_1_2.cols) { corr_size_X = Corr_1_1.cols; } else { corr_size_X = Corr_1_2.cols; } resize(Corr_1_1,Corr_1_1,Size(corr_size_X,corr_size_Y),0,0,INTER_CUBIC); resize(Corr_1_2,Corr_1_2,Size(corr_size_X,corr_size_Y),0,0,INTER_CUBIC); Result = (0.6*Corr_1_1)+(0.6*Corr_1_2); } else { cop.find_mode = true; split(YUV_PIC3,yuv); threshold(yuv[0],yuv[0],cop.Y_MAX,255,THRESH_TOZERO_INV); threshold(yuv[0],Pic2_col1,cop.Y_MIN,255,THRESH_BINARY); threshold(yuv[1],yuv[1],cop.Cb_MAX,255,THRESH_TOZERO_INV); threshold(yuv[1],temp3,cop.Cb_MIN,255,THRESH_BINARY); threshold(yuv[2],yuv[2],cop.Cr_MAX,255,THRESH_TOZERO_INV); threshold(yuv[2],temp4,cop.Cr_MIN,255,THRESH_BINARY); bitwise_and(Pic2_col1,temp3,temp3); bitwise_and(temp3,temp4,Pic2_col1); split(YUV_PIC3,yuv); threshold(yuv[0],yuv[0],cop.Y_MAX2,255,THRESH_TOZERO_INV); threshold(yuv[0],Pic2_col2,cop.Y_MIN2,255,THRESH_BINARY); threshold(yuv[1],yuv[1],cop.Cb_MAX2,255,THRESH_TOZERO_INV); threshold(yuv[1],temp5,cop.Cb_MIN2,255,THRESH_BINARY); threshold(yuv[2],yuv[2],cop.Cr_MAX2,255,THRESH_TOZERO_INV); threshold(yuv[2],temp6,cop.Cr_MIN2,255,THRESH_BINARY); bitwise_and(Pic2_col2,temp5,temp5); bitwise_and(temp5,temp6,Pic2_col2); matchTemplate(Cam,Pic2_col1,Corr_2_1,CV_TM_CCOEFF_NORMED); matchTemplate(Cam2,Pic2_col2,Corr_2_2,CV_TM_CCOEFF_NORMED); if(Corr_2_1.rows<Corr_2_2.rows) { corr_size_Y = Corr_2_1.rows; } else { corr_size_Y = Corr_2_2.rows; } if(Corr_2_1.cols<Corr_2_2.cols) { corr_size_X = Corr_2_1.cols; } else { corr_size_X = Corr_2_2.cols; } resize(Corr_2_1,Corr_2_1,Size(corr_size_X,corr_size_Y),0,0,INTER_CUBIC); resize(Corr_2_2,Corr_2_2,Size(corr_size_X,corr_size_Y),0,0,INTER_CUBIC); Result = (0.6*Corr_2_1)+(0.6*Corr_2_2); } // imshow("3",Pic2_col2); // imshow("2",Pic2_col1); // imshow("1",Result); minMaxLoc(Result,&min,&max,NULL,&Copter_point); cop.width = 3*(cop.Pic_Binary2.cols); cop.height =3*(cop.Pic_Binary2.rows); cop.x = Copter_point.x-(cop.width/3); cop.y = Copter_point.y-(cop.height/3); Reposition_minus(cop); pthread_mutex_lock(&mutex);// =========* resize(cop.Copter_Layer,cop.Copter_Layer,Size(cop.width,cop.height),0,0,INTER_NEAREST); if(cop.number == 1) cop.Copter_Layer = Cam_Image(Rect(cop.x , cop.y , cop.width , cop.height ) ); else if(cop.number == 2) cop.Copter_Layer = Cam_Image(Rect(cop.x,cop.y,cop.width,cop.height)); pthread_mutex_unlock(&mutex);// ==========* }
//write relation TEST(ParserAttList, ParAttList) { //CREATE TABLE species (kind VARCHAR(10)) PRIMARY KEY (kind); Token temp(Token::KEYWORD); temp.content = "CREATE"; tokens.push_back(temp); Token temp1(Token::KEYWORD); temp.content = "TABLE"; tokens.push_back(temp1); Token temp2(Token::VARIABLE); temp.content = "species"; tokens.push_back(temp2); Token temp3(Token::OPENPAREN); temp.content = "("; tokens.push_back(temp3); Token temp4(Token::VARIABLE); temp.content = "kind"; tokens.push_back(temp4); Token temp5(Token::KEYWORD); temp.content = "VARCHAR"; tokens.push_back(temp5); Token temp6(Token::OPENPAREN); temp.content = "("; tokens.push_back(temp6); Token temp7(Token::LITERAL); temp.content = "10"; tokens.push_back(temp7); Token temp8(Token::CLOSEPAREN); temp.content = ")"; tokens.push_back(temp8); Token temp9(Token::CLOSEPAREN); temp.content = ")"; tokens.push_back(temp9); Token temp10(Token::KEYWORD); temp.content = "PRIMARY"; tokens.push_back(temp10); Token temp11(Token::KEYWORD); temp.content = "KEY"; tokens.push_back(temp11); Token temp12(Token::OPENPAREN); temp.content = "("; tokens.push_back(temp12); Token temp13(Token::VARIABLE); temp.content = "kind"; tokens.push_back(temp13); Token temp14(Token::CLOSEPAREN); temp.content = ")"; tokens.push_back(temp14); pars.command(tokens); }
void Board::Initialise() { float zbase = 400; // Variable to store how deep in the z axis the object is based. Vector4 temp1(-600, 800, 1200 + zbase, 1); Vector4 temp2(600, 800, 1200 + zbase, 1); Vector4 temp3(600, 800, 0 + zbase, 1); Vector4 temp4(-600,800,0 + zbase,1); top.Initialise(temp1, temp2, temp3, temp4); // Set individual vertex locations for the top face of the board Vector4 col1(70,50,4,1); Vector4 col2(92,67,5,1); Vector4 col3(102,75,6,1); Vector4 col4(119,77,0,1); Vector4 col5(69, 25, 18, 1); top.SetColours(col1, col2, col2, col3); // Set individual colour values of each of those vertices Vector4 temp5(-600, 800, 0 + zbase, 1); Vector4 temp6(600, 800, 0 + zbase, 1); Vector4 temp7(600, 1000, 0 + zbase, 1); Vector4 temp8(-600,1000, 0 + zbase,1); // Individual vertices for the front face Vector4 temp9(-800, 1000, 1200 + zbase + 300, 1); Vector4 temp10(800, 1000, 1200 + zbase + 300, 1); Vector4 temp11(800, 1000, 100, 1); Vector4 temp12(-800, 1000, 100,1); // Individual vertices for the base face table.Initialise(temp9, temp10, temp11, temp12); table.SetColours(col5, col5, col5, col5); // Set to one mat colour, no shading. Vector4 temp13(-600, 800, 1200 + zbase, 1); Vector4 temp14(-600, 800, 0 + zbase, 1); Vector4 temp15(-600, 1000, 0 + zbase, 1); Vector4 temp16(-600, 1000, 1200 + zbase, 1); // Set individual vertices for the left face Vector4 temp17(600, 800, 0 + zbase, 1); Vector4 temp18(600, 800, 1200 + zbase, 1); Vector4 temp19(600, 1000, 1200 + zbase, 1); Vector4 temp20(600, 1000, 0 + zbase, 1); // Set individual vertices for the right face sides[0].Initialise(temp5, temp6, temp7, temp8); sides[1].Initialise(temp13, temp14, temp15, temp16); sides[2].Initialise(temp17, temp18, temp19, temp20); sides[3].Initialise(temp2, temp1, temp16, temp19); // Use known vertices to initialise the side faces sides[0].SetColours(col3, col4, col4, col2); sides[1].SetColours(col1, col2, col2, col1); sides[2].SetColours(col2, col1, col1, col2); sides[3].SetColours(col4, col4, col4, col4); // Then set the colours float positionLocations[24][2] = {{-450, 1050 + zbase}, //1 An array holding the centre locations {-300, 900 + zbase}, //2 of each of the positions where pieces {-150, 750 + zbase}, //3 can be placed. { 0 , 750 + zbase}, //4 { 150, 750 + zbase}, //5 { 300, 900 + zbase}, //6 { 450, 1050 + zbase}, //7 { 0 , 900 + zbase}, //8 { 0 , 1050 + zbase}, //9 {-450, 600 + zbase}, //10 {-300, 600 + zbase}, //11 {-150, 600 + zbase}, //12 {-450, 150 + zbase}, //13 {-300, 300 + zbase}, //14 {-150, 450 + zbase}, //15 { 0 , 150 + zbase}, //16 { 0 , 300 + zbase}, //17 { 0 , 450 + zbase}, //18 { 450, 150 + zbase}, //19 { 300, 300 + zbase}, //20 { 150, 450 + zbase}, //21 { 450, 600 + zbase}, //22 { 300, 600 + zbase}, //23 { 150, 600 + zbase}}; //24 for (int i = 0; i < 24; i++) { boardpositions[i].Initialise(positionLocations[i][0], positionLocations[i][1]); // Create the individual graphical representations } // (class Position) and put in array for easy drawing. InitialiseLines(); // Ugly function to draw each and every line on the // board with individual hand-placed vertices. SetupMills(); // Set up the mills (groups of three) with pointers to the positions // as alternate referencing option }
CFX_PtrArray* CBC_ReedSolomonDecoder::RunEuclideanAlgorithm( CBC_ReedSolomonGF256Poly* a, CBC_ReedSolomonGF256Poly* b, int32_t R, int32_t& e) { if (a->GetDegree() < b->GetDegree()) { CBC_ReedSolomonGF256Poly* temp = a; a = b; b = temp; } CBC_ReedSolomonGF256Poly* rsg1 = a->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> rLast(rsg1); CBC_ReedSolomonGF256Poly* rsg2 = b->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> r(rsg2); CBC_ReedSolomonGF256Poly* rsg3 = m_field->GetOne()->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> sLast(rsg3); CBC_ReedSolomonGF256Poly* rsg4 = m_field->GetZero()->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> s(rsg4); CBC_ReedSolomonGF256Poly* rsg5 = m_field->GetZero()->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> tLast(rsg5); CBC_ReedSolomonGF256Poly* rsg6 = m_field->GetOne()->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> t(rsg6); while (r->GetDegree() >= R / 2) { CBC_AutoPtr<CBC_ReedSolomonGF256Poly> rLastLast = rLast; CBC_AutoPtr<CBC_ReedSolomonGF256Poly> sLastLast = sLast; CBC_AutoPtr<CBC_ReedSolomonGF256Poly> tLastlast = tLast; rLast = r; sLast = s; tLast = t; if (rLast->IsZero()) { e = BCExceptionR_I_1IsZero; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } CBC_ReedSolomonGF256Poly* rsg7 = rLastLast->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> rTemp(rsg7); r = rTemp; CBC_ReedSolomonGF256Poly* rsg8 = m_field->GetZero()->Clone(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> q(rsg8); int32_t denominatorLeadingTerm = rLast->GetCoefficients(rLast->GetDegree()); int32_t dltInverse = m_field->Inverse(denominatorLeadingTerm, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); while (r->GetDegree() >= rLast->GetDegree() && !(r->IsZero())) { int32_t degreeDiff = r->GetDegree() - rLast->GetDegree(); int32_t scale = m_field->Multiply(r->GetCoefficients(r->GetDegree()), dltInverse); CBC_ReedSolomonGF256Poly* rsgp1 = m_field->BuildMonomial(degreeDiff, scale, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> build(rsgp1); CBC_ReedSolomonGF256Poly* rsgp2 = q->AddOrSubtract(build.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp(rsgp2); q = temp; CBC_ReedSolomonGF256Poly* rsgp3 = rLast->MultiplyByMonomial(degreeDiff, scale, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> multiply(rsgp3); CBC_ReedSolomonGF256Poly* rsgp4 = r->AddOrSubtract(multiply.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp3(rsgp4); r = temp3; } CBC_ReedSolomonGF256Poly* rsg9 = q->Multiply(sLast.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp1(rsg9); CBC_ReedSolomonGF256Poly* rsg10 = temp1->AddOrSubtract(sLastLast.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp2(rsg10); s = temp2; CBC_ReedSolomonGF256Poly* rsg11 = q->Multiply(tLast.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp5(rsg11); CBC_ReedSolomonGF256Poly* rsg12 = temp5->AddOrSubtract(tLastlast.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp6(rsg12); t = temp6; } int32_t sigmaTildeAtZero = t->GetCoefficients(0); if (sigmaTildeAtZero == 0) { e = BCExceptionIsZero; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } int32_t inverse = m_field->Inverse(sigmaTildeAtZero, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_ReedSolomonGF256Poly* rsg13 = t->Multiply(inverse, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> sigma(rsg13); CBC_ReedSolomonGF256Poly* rsg14 = r->Multiply(inverse, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_AutoPtr<CBC_ReedSolomonGF256Poly> omega(rsg14); CFX_PtrArray* temp = new CFX_PtrArray; temp->Add(sigma.release()); temp->Add(omega.release()); return temp; }