Ask Your Question

viren's profile - activity

2018-08-05 06:47:17 -0600 received badge  Popular Question (source)
2014-05-24 02:20:44 -0600 commented question error while sending data over serial com port

with above code i get output like ERROR!!!, in console window

2014-05-24 02:18:54 -0600 asked a question error while sending data over serial com port

i want to send data over particular COM port, that is selected by track-bar, once its selected, data have to transmit over that COM port only. while doing this i am not getting proper output, please help me... thanks in advance!!!

find below code!!! /----------------------------main.cpp---------------------/

include "opencv2/opencv.hpp"

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/highgui/highgui.hpp"

using namespace std; using namespace cv;

include <iostream>

include <stdio.h>

include <tchar.h>

include <string>

include "SerialClass.h"

char COM[4]; unsigned char dataLength=1; //Serial* SP = new Serial (COM);

void CallBackFunc (int event, int x,int y, int flags,void* userdata) { Serial* SP = new Serial (COM); //Serial* SP = new Serial ("COM7"); //bool WriteData(char buffer, unsigned int nbChar);

if (event == EVENT_LBUTTONDOWN)

{
            if ( x > 230 and x < 365 and y < 132 and y > 40)
                {
                  cout << "FORWARD" << endl;
                  //char send[2] = "F";
                  SP->WriteData("F",dataLength);
                  //SP->WriteData('F',dataLength);
                }

            else if ( x > 230 and x < 365 and y < 380 and y > 290)
                {
                  cout << "BACKWARD" << endl;
                  //char send[2] = "B";
                  SP->WriteData("B",dataLength);
                  //SP->WriteData('B',dataLength);
                }

            else if ( x > 40 and x < 175 and y < 260 and y > 165)
                {
                  cout << "LEFT" << endl;
                  //char send[2] = "L";
                  SP->WriteData("L",dataLength);
                  //SP->WriteData('L',dataLength);
                }

            else if ( x > 425 and x < 560 and y < 260 and y > 165)
                {
                  cout << "RIGHT" << endl;
                  //char send[2] = "R";
                  SP->WriteData("R",dataLength);
                  //SP->WriteData('R',dataLength);
                }
            else if ( x > 230 and x < 365 and y < 260 and y > 165)
                {
                  cout << "STOP" << endl;
                  //char send[2] = "S";
                  SP->WriteData("S",dataLength);
                  //SP->WriteData('S',dataLength);
                }
            else
                {
                 cout << "STOP" << endl;
                 //char send[2] = "S";
                 SP->WriteData("S",dataLength);
                 //SP->WriteData('S',dataLength);
                }
        }

}

int main(int argc, char** argv) { int i=0; int Selected_COM; char COM[5];

namedWindow("COM Selection",1);
resizeWindow("COM Selection",400,45);
createTrackbar("COM","COM Selection",&i,20);

if (waitKey(0))
{
Selected_COM = getTrackbarPos("COM","COM Selection");
//printf("%d",Selected_COM);
    if (Selected_COM == 1)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='1';
        COM[4]='\0';
    }
    else if (Selected_COM == 2)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='2';
        COM[4]='\0';
    }
    else if (Selected_COM == 3)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='3';
        COM[4]='\0';
    }
    else if (Selected_COM == 4)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='4';
        COM[4]='\0';
    }
    else if (Selected_COM == 5)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='5';
        COM[4]='\0';
    }
    else if (Selected_COM == 6)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='6';
        COM[4]='\0';
    }
    else if (Selected_COM == 7)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='7';
        COM[4]='\0';
    }
    else if (Selected_COM == 8)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='8';
        COM[4]='\0';
    }
    else if (Selected_COM == 9)
    {
        COM[0]='C';
        COM[1]='O';
        COM[2]='M';
        COM[3]='9';
        COM[4]='\0';
    }

    Serial* SP = new Serial (COM);

    /*if (SP->IsConnected())
    {
        printf("We'r connected ...
(more)
2014-04-29 03:38:56 -0600 asked a question error in CascadeClassifier with haarcascade

whats the meaning of following errors in opencv2.4.5

undefined reference to `cv::CascadeClassifier::CascadeClassifier()'
undefined reference to `cv::CascadeClassifier::load(std::string const&)'
undefined reference to `cv::CascadeClassifier::detectMultiScale(cv::Mat const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)'

thanks in advance!!!!