Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

problems with running OpenCV code

Hello, I train the cascade classifier to detect letters, here is the code I'm running:

#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"

#include <iostream>
#include <stdio.h>

using namespace std;
using namespace cv;

/** Function Headers */
void detectAndDisplay(Mat frame);

/** Global variables */
String letter_cascade_name = "C:\\opencv\\sources\\data\\haarcascades_GPU\\letters_cascade.xml";
CascadeClassifier letter_cascade;
String window_name = "Capture - letter detection";

/** @function main */
int main(void)
{
    VideoCapture capture;
    Mat frame;

    //-- 1. Load the cascades
    if (!letter_cascade.load(letter_cascade_name)) { printf("--(!)Error loading face cascade\n"); return -1; };

    //-- 2. Read the video stream
    capture.open(0);
    if (!capture.isOpened()) { printf("--(!)Error opening video capture\n"); return -1; }

    while (capture.read(frame))
    {
        if (frame.empty())
        {
            printf(" --(!) No captured frame -- Break!");
            break;
        }

        //-- 3. Apply the classifier to the frame
        detectAndDisplay(frame);


        int c = waitKey(10);
        if ((char)c == 27) { break; } // escape
    }
    return 0;
}

/** @function detectAndDisplay */
void detectAndDisplay(Mat frame)
{
    std::vector<Rect> letters;
    Mat frame_gray;

    cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
    equalizeHist(frame_gray, frame_gray);

    //-- Detect faces
    letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

    for (size_t i = 0; i < letters.size(); i++)
    {
        Point center(letters[i].x + letters[i].width / 2, letters[i].y + letters[i].height / 2);
        ellipse(frame, center, Size(letters[i].width / 2, letters[i].height / 2), 0, 0, 360, Scalar(255, 0, 255), 4, 8, 0);

    }
    //-- Show what you got
    imshow(window_name, frame);
}

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV code

Hello, I train the cascade classifier to detect letters, here is the traffic lights, I used this code I'm running:for detection.

#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"

#include <iostream>
#include <stdio.h>

using namespace std;
using namespace cv;

/** Function Headers */
void detectAndDisplay(Mat frame);

/** Global variables */
String letter_cascade_name = "C:\\opencv\\sources\\data\\haarcascades_GPU\\letters_cascade.xml";
CascadeClassifier letter_cascade;
String window_name = "Capture - letter detection";

/** @function main */
int main(void)
{
    VideoCapture capture;
    Mat frame;

    //-- 1. Load the cascades
    if (!letter_cascade.load(letter_cascade_name)) { printf("--(!)Error loading face cascade\n"); return -1; };

    //-- 2. Read the video stream
    capture.open(0);
    if (!capture.isOpened()) { printf("--(!)Error opening video capture\n"); return -1; }

    while (capture.read(frame))
    {
        if (frame.empty())
        {
            printf(" --(!) No captured frame -- Break!");
            break;
        }

        //-- 3. Apply the classifier to the frame
        detectAndDisplay(frame);


        int c = waitKey(10);
        if ((char)c == 27) { break; } // escape
    }
    return 0;
}

/** @function detectAndDisplay */
void detectAndDisplay(Mat frame)
{
    std::vector<Rect> letters;
    Mat frame_gray;

    cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
    equalizeHist(frame_gray, frame_gray);

    //-- Detect faces
    letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

    for (size_t i = 0; i < letters.size(); i++)
    {
        Point center(letters[i].x + letters[i].width / 2, letters[i].y + letters[i].height / 2);
        ellipse(frame, center, Size(letters[i].width / 2, letters[i].height / 2), 0, 0, 360, Scalar(255, 0, 255), 4, 8, 0);

    }
    //-- Show what you got
    imshow(window_name, frame);
}

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV code

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

the .xml file:

> <?xml version="1.0"?> <opencv_storage>
> <cascade>  
> <stageType>BOOST</stageType>  
> <featureType>LBP</featureType>  
> <height>40</height>  
> <width>40</width>   <stageParams>
>     <boostType>GAB</boostType>
>     <minHitRate>9.9900001287460327e-001</minHitRate>
>     <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
>     <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
>     <maxDepth>1</maxDepth>
>     <maxWeakCount>100</maxWeakCount></stageParams>
> <featureParams>
>     <maxCatCount>256</maxCatCount>
>     <featSize>1</featSize></featureParams>
> <stageNum>2</stageNum>   <stages>
>     <!-- stage 0 -->
>     <_>
>       <maxWeakCount>2</maxWeakCount>
>       <stageThreshold>2.5567623972892761e-001</stageThreshold>
>       <weakClassifiers>
>         <_>
>           <internalNodes>
>             0 -1 6 788479807 774897467 -17 1857748791 1203896595
>             -536870913 -855679627 217374068</internalNodes>
>           <leafValues>
>             -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
>         <_>
>           <internalNodes>
>             0 -1 4 109981231 -1376784577 1862266791 -151061524
>             -1879130355 256884607 1962271808 -990392459</internalNodes>
>           <leafValues>
>             -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
>     <!-- stage 1 -->
>     <_>
>       <maxWeakCount>5</maxWeakCount>
>       <stageThreshold>-1.0292038321495056e-001</stageThreshold>
>       <weakClassifiers>
>         <_>
>           <internalNodes>
>             0 -1 0 251399973 774799159 -285212674 606650218 1610579828
>             268402507 -536907915 69478212</internalNodes>
>           <leafValues>
>             -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
>         <_>
>           <internalNodes>
>             0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
>             -1073709056 0 -1056391039</internalNodes>
>           <leafValues>
>             -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
>         <_>
>           <internalNodes>
>             0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050
> -1
>             -318800395 -51052684</internalNodes>
>           <leafValues>
>             -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
>         <_>
>           <internalNodes>
>             0 -1 1 -2147303149 168055808 1073942848 -2013134328
> 4211337
>             -2013265920 -2012604288 -2147467264</internalNodes>
>           <leafValues>
>             -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
>         <_>
>           <internalNodes>
>             0 -1 2 -597948342 978168568 -1350572209 -1342722332
>             -2015550848 1878867828 -2867328 -1949349230</internalNodes>
>           <leafValues>
>             -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
> <features>
>     <_>
>       <rect>
>         15 14 1 1</rect></_>
>     <_>
>       <rect>
>         15 30 1 1</rect></_>
>     <_>
>       <rect>
>         16 0 3 7</rect></_>
>     <_>
>       <rect>
>         16 18 3 7</rect></_>
>     <_>
>       <rect>
>         17 23 2 2</rect></_>
>     <_>
>       <rect>
>         37 0 1 1</rect></_>
>     <_>
>       <rect>
>         37 37 1 1</rect></_></features></cascade>
> </opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV code

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

the .xml file:

> <?xml version="1.0"?> version="1.0"?>
<opencv_storage>
> <cascade>  
> <stageType>BOOST</stageType>  
> <featureType>LBP</featureType>  
> <height>40</height>  
> <width>40</width> <cascade>
  <stageType>BOOST</stageType>
  <featureType>LBP</featureType>
  <height>40</height>
  <width>40</width>
  <stageParams>
>     <boostType>GAB</boostType>
>     <minHitRate>9.9900001287460327e-001</minHitRate>
>     <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
>     <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
>     <maxDepth>1</maxDepth>
>     <maxWeakCount>100</maxWeakCount></stageParams>
>  <featureParams>
>     <maxCatCount>256</maxCatCount>
>     <featSize>1</featSize></featureParams>
> <stageNum>2</stageNum>   <stageNum>2</stageNum>
  <stages>
>     <!-- stage 0 -->
>     <_>
>     <_>
      <maxWeakCount>2</maxWeakCount>
>       <stageThreshold>2.5567623972892761e-001</stageThreshold>
>       <weakClassifiers>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 6 788479807 774897467 -17 1857748791 1203896595
>             -536870913 -855679627 217374068</internalNodes>
>           <leafValues>
>             -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 4 109981231 -1376784577 1862266791 -151061524
>             -1879130355 256884607 1962271808 -990392459</internalNodes>
>           <leafValues>
>             -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
>     <!-- stage 1 -->
>     <_>
>     <_>
      <maxWeakCount>5</maxWeakCount>
>       <stageThreshold>-1.0292038321495056e-001</stageThreshold>
>       <weakClassifiers>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 0 251399973 774799159 -285212674 606650218 1610579828
>             268402507 -536907915 69478212</internalNodes>
>           <leafValues>
>             -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
>             -1073709056 0 -1056391039</internalNodes>
>           <leafValues>
>             -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050
> -1895867050 -1
>             -318800395 -51052684</internalNodes>
>           <leafValues>
>             -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 1 -2147303149 168055808 1073942848 -2013134328
> -2013134328 4211337
>             -2013265920 -2012604288 -2147467264</internalNodes>
>           <leafValues>
>             -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
>         <_>
>         <_>
          <internalNodes>
>             0 -1 2 -597948342 978168568 -1350572209 -1342722332
>             -2015550848 1878867828 -2867328 -1949349230</internalNodes>
>           <leafValues>
>             -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
>  <features>
>     <_>
>     <_>
      <rect>
>         15 14 1 1</rect></_>
>     <_>
>     <_>
      <rect>
>         15 30 1 1</rect></_>
>     <_>
>     <_>
      <rect>
>         16 0 3 7</rect></_>
>     <_>
>     <_>
      <rect>
>         16 18 3 7</rect></_>
>     <_>
>     <_>
      <rect>
>         17 23 2 2</rect></_>
>     <_>
>     <_>
      <rect>
>         37 0 1 1</rect></_>
>     <_>
>     <_>
      <rect>
>         37 37 1 1</rect></_></features></cascade>
> </opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV codecode please help!

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

the .xml file:

<?xml version="1.0"?>
<opencv_storage>
<cascade>
  <stageType>BOOST</stageType>
  <featureType>LBP</featureType>
  <height>40</height>
  <width>40</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9900001287460327e-001</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
    <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>256</maxCatCount>
    <featSize>1</featSize></featureParams>
  <stageNum>2</stageNum>
  <stages>
    <!-- stage 0 -->
    <_>
      <maxWeakCount>2</maxWeakCount>
      <stageThreshold>2.5567623972892761e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 6 788479807 774897467 -17 1857748791 1203896595
            -536870913 -855679627 217374068</internalNodes>
          <leafValues>
            -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 4 109981231 -1376784577 1862266791 -151061524
            -1879130355 256884607 1962271808 -990392459</internalNodes>
          <leafValues>
            -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
    <!-- stage 1 -->
    <_>
      <maxWeakCount>5</maxWeakCount>
      <stageThreshold>-1.0292038321495056e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 0 251399973 774799159 -285212674 606650218 1610579828
            268402507 -536907915 69478212</internalNodes>
          <leafValues>
            -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
            -1073709056 0 -1056391039</internalNodes>
          <leafValues>
            -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050 -1
            -318800395 -51052684</internalNodes>
          <leafValues>
            -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 1 -2147303149 168055808 1073942848 -2013134328 4211337
            -2013265920 -2012604288 -2147467264</internalNodes>
          <leafValues>
            -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 2 -597948342 978168568 -1350572209 -1342722332
            -2015550848 1878867828 -2867328 -1949349230</internalNodes>
          <leafValues>
            -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
  <features>
    <_>
      <rect>
        15 14 1 1</rect></_>
    <_>
      <rect>
        15 30 1 1</rect></_>
    <_>
      <rect>
        16 0 3 7</rect></_>
    <_>
      <rect>
        16 18 3 7</rect></_>
    <_>
      <rect>
        17 23 2 2</rect></_>
    <_>
      <rect>
        37 0 1 1</rect></_>
    <_>
      <rect>
        37 37 1 1</rect></_></features></cascade>
</opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV code please help!

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

the .xml file:

<?xml version="1.0"?>
<opencv_storage>
<cascade>
  <stageType>BOOST</stageType>
  <featureType>LBP</featureType>
  <height>40</height>
  <width>40</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9900001287460327e-001</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
    <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>256</maxCatCount>
    <featSize>1</featSize></featureParams>
  <stageNum>2</stageNum>
  <stages>
    <!-- stage 0 -->
    <_>
      <maxWeakCount>2</maxWeakCount>
      <stageThreshold>2.5567623972892761e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 6 788479807 774897467 -17 1857748791 1203896595
            -536870913 -855679627 217374068</internalNodes>
          <leafValues>
            -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 4 109981231 -1376784577 1862266791 -151061524
            -1879130355 256884607 1962271808 -990392459</internalNodes>
          <leafValues>
            -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
    <!-- stage 1 -->
    <_>
      <maxWeakCount>5</maxWeakCount>
      <stageThreshold>-1.0292038321495056e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 0 251399973 774799159 -285212674 606650218 1610579828
            268402507 -536907915 69478212</internalNodes>
          <leafValues>
            -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
            -1073709056 0 -1056391039</internalNodes>
          <leafValues>
            -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050 -1
            -318800395 -51052684</internalNodes>
          <leafValues>
            -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 1 -2147303149 168055808 1073942848 -2013134328 4211337
            -2013265920 -2012604288 -2147467264</internalNodes>
          <leafValues>
            -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 2 -597948342 978168568 -1350572209 -1342722332
            -2015550848 1878867828 -2867328 -1949349230</internalNodes>
          <leafValues>
            -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
  <features>
    <_>
      <rect>
        15 14 1 1</rect></_>
    <_>
      <rect>
        15 30 1 1</rect></_>
    <_>
      <rect>
        16 0 3 7</rect></_>
    <_>
      <rect>
        16 18 3 7</rect></_>
    <_>
      <rect>
        17 23 2 2</rect></_>
    <_>
      <rect>
        37 0 1 1</rect></_>
    <_>
      <rect>
        37 37 1 1</rect></_></features></cascade>
</opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV code please help!**please help!**

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

the .xml file:

<?xml version="1.0"?>
<opencv_storage>
<cascade>
  <stageType>BOOST</stageType>
  <featureType>LBP</featureType>
  <height>40</height>
  <width>40</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9900001287460327e-001</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
    <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>256</maxCatCount>
    <featSize>1</featSize></featureParams>
  <stageNum>2</stageNum>
  <stages>
    <!-- stage 0 -->
    <_>
      <maxWeakCount>2</maxWeakCount>
      <stageThreshold>2.5567623972892761e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 6 788479807 774897467 -17 1857748791 1203896595
            -536870913 -855679627 217374068</internalNodes>
          <leafValues>
            -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 4 109981231 -1376784577 1862266791 -151061524
            -1879130355 256884607 1962271808 -990392459</internalNodes>
          <leafValues>
            -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
    <!-- stage 1 -->
    <_>
      <maxWeakCount>5</maxWeakCount>
      <stageThreshold>-1.0292038321495056e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 0 251399973 774799159 -285212674 606650218 1610579828
            268402507 -536907915 69478212</internalNodes>
          <leafValues>
            -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
            -1073709056 0 -1056391039</internalNodes>
          <leafValues>
            -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050 -1
            -318800395 -51052684</internalNodes>
          <leafValues>
            -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 1 -2147303149 168055808 1073942848 -2013134328 4211337
            -2013265920 -2012604288 -2147467264</internalNodes>
          <leafValues>
            -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 2 -597948342 978168568 -1350572209 -1342722332
            -2015550848 1878867828 -2867328 -1949349230</internalNodes>
          <leafValues>
            -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
  <features>
    <_>
      <rect>
        15 14 1 1</rect></_>
    <_>
      <rect>
        15 30 1 1</rect></_>
    <_>
      <rect>
        16 0 3 7</rect></_>
    <_>
      <rect>
        16 18 3 7</rect></_>
    <_>
      <rect>
        17 23 2 2</rect></_>
    <_>
      <rect>
        37 0 1 1</rect></_>
    <_>
      <rect>
        37 37 1 1</rect></_></features></cascade>
</opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

problems with running OpenCV code algorithm freezes **please help!**

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

the .xml file:

<?xml version="1.0"?>
<opencv_storage>
<cascade>
  <stageType>BOOST</stageType>
  <featureType>LBP</featureType>
  <height>40</height>
  <width>40</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9900001287460327e-001</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
    <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>256</maxCatCount>
    <featSize>1</featSize></featureParams>
  <stageNum>2</stageNum>
  <stages>
    <!-- stage 0 -->
    <_>
      <maxWeakCount>2</maxWeakCount>
      <stageThreshold>2.5567623972892761e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 6 788479807 774897467 -17 1857748791 1203896595
            -536870913 -855679627 217374068</internalNodes>
          <leafValues>
            -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 4 109981231 -1376784577 1862266791 -151061524
            -1879130355 256884607 1962271808 -990392459</internalNodes>
          <leafValues>
            -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
    <!-- stage 1 -->
    <_>
      <maxWeakCount>5</maxWeakCount>
      <stageThreshold>-1.0292038321495056e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 0 251399973 774799159 -285212674 606650218 1610579828
            268402507 -536907915 69478212</internalNodes>
          <leafValues>
            -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
            -1073709056 0 -1056391039</internalNodes>
          <leafValues>
            -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050 -1
            -318800395 -51052684</internalNodes>
          <leafValues>
            -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 1 -2147303149 168055808 1073942848 -2013134328 4211337
            -2013265920 -2012604288 -2147467264</internalNodes>
          <leafValues>
            -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 2 -597948342 978168568 -1350572209 -1342722332
            -2015550848 1878867828 -2867328 -1949349230</internalNodes>
          <leafValues>
            -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
  <features>
    <_>
      <rect>
        15 14 1 1</rect></_>
    <_>
      <rect>
        15 30 1 1</rect></_>
    <_>
      <rect>
        16 0 3 7</rect></_>
    <_>
      <rect>
        16 18 3 7</rect></_>
    <_>
      <rect>
        17 23 2 2</rect></_>
    <_>
      <rect>
        37 0 1 1</rect></_>
    <_>
      <rect>
        37 37 1 1</rect></_></features></cascade>
</opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

OpenCV algorithm freezes **please help!**

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

letter_cascade.detectMultiScale(frame_gray, letters, tl_cascade.detectMultiScale(frame_gray, tls, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

this is the .xml file:file.

<?xml version="1.0"?>
<opencv_storage>
<cascade>
  <stageType>BOOST</stageType>
  <featureType>LBP</featureType>
  <height>40</height>
  <width>40</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9900001287460327e-001</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-001</maxFalseAlarm>
    <weightTrimRate>9.4999999999999996e-001</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>256</maxCatCount>
    <featSize>1</featSize></featureParams>
  <stageNum>2</stageNum>
  <stages>
    <!-- stage 0 -->
    <_>
      <maxWeakCount>2</maxWeakCount>
      <stageThreshold>2.5567623972892761e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 6 788479807 774897467 -17 1857748791 1203896595
            -536870913 -855679627 217374068</internalNodes>
          <leafValues>
            -6.7901235818862915e-001 9.3035906553268433e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 4 109981231 -1376784577 1862266791 -151061524
            -1879130355 256884607 1962271808 -990392459</internalNodes>
          <leafValues>
            -5.5237072706222534e-001 9.3468856811523438e-001</leafValues></_></weakClassifiers></_>
    <!-- stage 1 -->
    <_>
      <maxWeakCount>5</maxWeakCount>
      <stageThreshold>-1.0292038321495056e-001</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 0 251399973 774799159 -285212674 606650218 1610579828
            268402507 -536907915 69478212</internalNodes>
          <leafValues>
            -7.0149254798889160e-001 9.0782421827316284e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 3 1073783298 -1073676288 81920 -805273583 -2147303424
            -1073709056 0 -1056391039</internalNodes>
          <leafValues>
            -5.3642070293426514e-001 9.1164815425872803e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 5 -1342226625 800784247 -129 -1439498248 -1895867050 -1
            -318800395 -51052684</internalNodes>
          <leafValues>
            -6.3142895698547363e-001 8.9295756816864014e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 1 -2147303149 168055808 1073942848 -2013134328 4211337
            -2013265920 -2012604288 -2147467264</internalNodes>
          <leafValues>
            -7.1963709592819214e-001 8.3202546834945679e-001</leafValues></_>
        <_>
          <internalNodes>
            0 -1 2 -597948342 978168568 -1350572209 -1342722332
            -2015550848 1878867828 -2867328 -1949349230</internalNodes>
          <leafValues>
            -6.7492038011550903e-001 8.9548099040985107e-001</leafValues></_></weakClassifiers></_></stages>
  <features>
    <_>
      <rect>
        15 14 1 1</rect></_>
    <_>
      <rect>
        15 30 1 1</rect></_>
    <_>
      <rect>
        16 0 3 7</rect></_>
    <_>
      <rect>
        16 18 3 7</rect></_>
    <_>
      <rect>
        17 23 2 2</rect></_>
    <_>
      <rect>
        37 0 1 1</rect></_>
    <_>
      <rect>
        37 37 1 1</rect></_></features></cascade>
</opencv_storage>

What should I do to make it show the captured frames and start detecting?

Thank you.

OpenCV algorithm freezes **please help!****PLEASE HELP!**

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

tl_cascade.detectMultiScale(frame_gray, tls, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

this is the .xml file.

What should I do to make it show the captured frames and start detecting?

Thank you.

OpenCV algorithm freezes **PLEASE HELP!**HELP**

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

tl_cascade.detectMultiScale(frame_gray, tls, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

this is the .xml file.

What should I do to make it show the captured frames and start detecting?

Thank you.

OpenCV algorithm freezes **PLEASE HELP**HELP** [unsolved]

Hello, I train the cascade classifier to detect traffic lights, I used this code for detection.

When I start the program, it opens my web cam but doesn't show the image (frames) and the detection but just a single blank window.

I noticed this line causes the problem:

tl_cascade.detectMultiScale(frame_gray, tls, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));

this is the .xml file.

What should I do to make it show the captured frames and start detecting?

Thank you.