Ask Your Question

Apple-B's profile - activity

2016-02-10 08:06:55 -0600 commented question I have bug with real time IP camera.(when use Split Function)

Thank you very much. I already run real time. :)

2016-02-09 02:55:51 -0600 commented question I have bug with real time IP camera.(when use Split Function)

Thank you. my first time Ask Question.

2016-02-09 02:46:37 -0600 received badge  Editor (source)
2016-02-09 02:15:23 -0600 asked a question I have bug with real time IP camera.(when use Split Function)
int main()
{ 
    cv::VideoCapture vcap;
    cv::Mat image;

    // This works on a D-Link CDS-932L
    const std::string videoStreamAddress = "http://admin:[email protected]/video.cgi?.mjpg";

    //open the video stream and make sure it's opened
    if(!vcap.open(videoStreamAddress)) {
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    }
    int frame=0;
    while(1) {
        //cv::Mat image;
        if(!vcap.read(image)) {
            std::cout << "No frame" << std::endl;
            cv::waitKey();
        }
        cv::imshow("Camera Window", image);
        if(cv::waitKey(1) >= 0) break;
        printf("%d\n",frame);
        frame=frame+1;

    //Load the image
    //cv::Mat rgb_image = imread( "C:/Users/Yokkung/Desktop/project_combine/1201.png",CV_LOAD_IMAGE_COLOR);// test didnt connect camera
    cv::Mat rgb_image = image; //connect camera done
    int m = rgb_image.rows;
    int n = rgb_image.cols;
    cv::Size s = rgb_image.size();
    m = s.height;
    n = s.width;

    // Input Quadilateral or Image plane coordinates
    Point2f inputQuad[4]; 
    // Output Quadilateral or World plane coordinates
    Point2f outputQuad[4];
    // Lambda Matrix
    Mat lambda( 2, 4, CV_32FC1 );
    // Input and Output Image;
    Mat input, output;
    // Load the image
    input = rgb_image;

    // Set the lambda matrix the same type and size as input
    lambda = Mat::zeros( input.rows, input.cols, input.type());

    // The 4 points that select quadilateral on the input , from top-left in clockwise order
    // These four pts are the sides of the rect box used as input 
    inputQuad[0] = Point2f( 8.33,275.94);
    inputQuad[1] = Point2f( 359.36,193.1);
    inputQuad[2] = Point2f( 602.78,219.57);
    inputQuad[3] = Point2f( 361.07,433.1);  
    // The 4 points where the mapping is to be done , from top-left in clockwise order
    outputQuad[0] = Point2f( 100,400 );
    outputQuad[1] = Point2f( 100,75);
    outputQuad[2] = Point2f( 550,75);
    outputQuad[3] = Point2f( 550,400);

    // Get the Perspective Transform Matrix i.e. lambda 
    lambda = getPerspectiveTransform( inputQuad, outputQuad );
    // Apply the Perspective Transform just found to the src image
    warpPerspective(input,output,lambda,output.size() );
    rgb_image=output;
    Mat transformedII2 = (Mat_<double>(m,n)) ;
    transformedII2 = rgb_image;
    // Display input and output
    //imshow("Input",input);
    //imshow("Output",rgb_image); //USE rgb_image next section (Navigation and fire detection

    //Split HSV plane
    vector<Mat> channels;
    Mat hsv_image,h_image,s_image,v_image;
    cvtColor(rgb_image, hsv_image, CV_BGR2HSV); 
    split(hsv_image, channels); //channels[0], channels[1], channels[2] will contain your H, S, V respectively
 //   h_image = channels[0]; 
 //   s_image = channels[1];
    //v_image = channels[2];
    //imshow("V", v_image);
    //imshow("S", s_image);
    //imshow("H", h_image);
} //end capture every frame
}

Output debugger show below HEAP[testvs.exe]: Invalid address specified to RtlValidateHeap( 006F0000, 0455A358 ) testvs.exe has triggered a breakpoint.

The thread 0x110 has exited with code 0 (0x0).

The thread 0x12f8 has exited with code 0 (0x0).

The thread 0x16c4 has exited with code 0 (0x0).

The thread 0x16ec has exited with code 0 (0x0).

The thread 0x4fc has exited with code 0 (0x0).

The thread 0x1698 has exited with code 0 (0x0).

The thread 0xa1c has exited with code 0 (0x0).

The program '[3364] testvs.exe' has exited with code 0 (0x0).