Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have code to detect stamops on the envelop. but i cant send x y codinate to the arduino via serial communication. this is my code. com port open normally by the softwer. but not transmite the x y cordinates. this is my code

C#
cv::RotatedRect boundingBox = cv::minAreaRect(contours[biggestContourIdx]);
    cv::Point2f corners[4];
    boundingBox.points(corners);
    cv::line(drawing, corners[0], corners[1], cv::Scalar(255,255,255));

    cv::line(drawing, corners[1], corners[2], cv::Scalar(255,255,255));
    cv::line(drawing, corners[2], corners[3], cv::Scalar(255,255,255));
    cv::line(drawing, corners[3], corners[0], cv::Scalar(255,255,255));

     int w=0;
     int h=0;
     int area;

    //area=abs(corners[0].x-corners[1].x);
    w=(corners[0].x-corners[1].x);
    h=(corners[0].y-corners[1].y);
    area=h*w;

    cout<<w;
    cout<<"\t";
    cout<<h;
    cout<<"\t";
    cout<<area;
    cout<<"\t";


    cout<<boundingBox.size;
    cout<<"\n";

    char test[32];
    sprintf(test,"%dx\n%dy\n", (int)w, (int)h);

     imshow("MyVideo1", drawing);




       cv::namedWindow("Canny");
    cv::imshow("Canny",canny_output);


    cv::namedWindow("Fill");
    cv::imshow("Fill",drawing);
Posted
Updated 15-Jun-15 11:38am
v2
Comments
[no name] 15-Jun-15 20:58pm    
There is nothing about serial comms here at all. Forget opencv - write a test program to confirm that you are able to communicate with arduino then go from there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900