Ask Your Question

Precious Roy's profile - activity

2016-04-28 14:55:51 -0600 received badge  Student (source)
2015-08-22 03:21:03 -0600 received badge  Enthusiast
2015-08-21 15:29:02 -0600 received badge  Editor (source)
2015-08-21 15:22:48 -0600 asked a question Train cascade classifier train error

Hello,

I am currently having problems training my own classifier.

I have created :

Negative.txt Positive.vec I can open and view my vec file just fine.

and start training with opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages 30 -w 55 -h 55 -featureType LBP

when i start the training it does the first stage just fine but when it gets to the second one i get

===== TRAINING 1-stage ===== BEGIN OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of
samples in given vec-file. ) in CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12-
shared\opencv\apps\traincascade\imagestorage.cpp, line 157

can any one tell me why i am getting this error

Edit: Output:

opencv_createsamples.exe -info Positive.info -num 1988 -w 55 -h 55 -vec Positive.vec -num 1988
Info file name: Positive.info
Img file name: (NULL)
Vec file name: Positive.vec
BG  file name: (NULL)
Num: 1988
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 55
Height: 55
Create training samples from images collection...
Positive.info(1988) : parse errorDone. Created 1987 samples

output 2

opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -        
numStages 2 -w 55 -h 55 -featureType LBP
PARAMETERS:
cascadeDirName: data/
vecFileName: Positive.vec
bgFileName: negative.txt
numPos: 1987
numNeg: 3000
numStages: 2
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: LBP
sampleWidth: 55
sampleHeight: 55
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100

===== TRAINING 0-stage =====
BEGIN
POS count : consumed   1987 : 1987
NEG count : acceptanceRatio    3000 : 1
Precalculation time: 9.501
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2| 0.996477|0.0776667|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 4 minutes 8 seconds.

===== TRAINING 1-stage =====
BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of     
samples in given vec-file.
) in CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12-    
shared\opencv\apps\traincascade\imagestorage.cpp, line 157
2015-07-08 06:41:35 -0600 asked a question Missing files In OpenCV 3.0

Hello,

I have been going though the documentation for BasicFaceRecognizer

found here: http://docs.opencv.org/master/db/d7c/...

and here: http://docs.opencv.org/master/da/d60/...

now i have a problem I cant find the files "opencv2/face.hpp"

I was wondering why is it not included in the 3.0 when i am looking at the documentation for 3.0.

2015-06-08 17:37:13 -0600 commented question detectMultiScale detects insane amount of faces

Yea i was using the vc12\lib folder. it compiled just fine

2015-06-08 11:53:16 -0600 commented question detectMultiScale detects insane amount of faces

Well i just managed to rebuild 3.0 my self in visual studio changed the lib location and everything worked fine. so i am stumped why the pre-built libs doe not work with visual studio 2013. but i guess my problem is solved. i don't know if this is a but or not and don't really know if i need to report it.

2015-06-07 17:18:11 -0600 commented question detectMultiScale detects insane amount of faces

yes good idea

here is the image i am using = http://www.r-junk.com/Data/OpenCV/Tes...

here is the VS debug view = http://www.r-junk.com/Data/OpenCV/out...

when using my webcam i was getting the same results

2015-06-07 13:07:20 -0600 asked a question detectMultiScale detects insane amount of faces

Hi,

This is my first attempt to detect faces with OpenCV but i am getting strange results. I am using the newest OpenCV files. but something is not right and i am getting detectMultiScale to fill the faces vector with 265290877 unusable entries. where most of them look like this [0] = {x=0 y=0 width=-1414812757 height = -1414812757}. so does any one know what i am doing wrong?

#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

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

using namespace std;
using namespace cv;

int main(int argc, const char** argv)
{
//create the cascade classifier object used for the face detection
CascadeClassifier face_cascade;
//use the haarcascade_frontalface_alt.xml library
if (!face_cascade.load("haarcascade_frontalface_alt.xml"))
{
    printf("Unable to load classifier XML");
    return 0;
}

//setup video capture device and link it to the first capture device
//VideoCapture captureDevice;
//captureDevice.open(0);

//setup image files used in the capture process
Mat captureFrame;
Mat grayscaleFrame;

captureFrame = imread("Test.png", IMREAD_COLOR);

if (captureFrame.empty()) // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl;
    return 0;
}

//create a window to present the results
namedWindow("outputCapture", 1);

//create a loop to capture and find faces
while (true)
{
    //capture a new image frame
    //captureDevice >> captureFrame;

    //convert captured image to gray scale and equalize
    cvtColor(captureFrame, grayscaleFrame, CV_BGR2GRAY);
    equalizeHist(grayscaleFrame, grayscaleFrame);

    //create a vector array to store the face found
    std::vector<Rect> faces;

    //find faces and store them in the vector array
    face_cascade.detectMultiScale(grayscaleFrame, faces, 1.1, 3, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));

    ////draw a rectangle for all found faces in the vector array on the original image
    //for (int i = 0; i < faces.size(); i++)
    //{
    //  Point pt1(faces[i].x + faces[i].width, faces[i].y + faces[i].height);
    //  Point pt2(faces[i].x, faces[i].y);

    //  rectangle(captureFrame, pt1, pt2, cvScalar(0, 255, 0, 0), 1, 8, 0);
    //}

    //print the output
    imshow("outputCapture", captureFrame);

    //pause for 33ms
    waitKey(33);
}

return 0;
}