Ask Your Question

gunner's profile - activity

2018-02-25 06:57:26 -0600 asked a question Haar vs LBP detection

Haar vs LBP detection Hello! i would like if someone can tell me differences between Haar and LBP considering false posi

2018-01-28 11:38:30 -0600 commented question detection works with video but fails to detect with static images

All my images are 400x300. So I specify Size(10, 100) and now it is working ok. Not really sure why this size works and

2018-01-28 11:28:48 -0600 commented question detection works with video but fails to detect with static images

Yes sir, you are right! So fast and so smart answer. Thank you very much for your help, I really appreciate it :D

2018-01-28 10:48:01 -0600 asked a question detection works with video but fails to detect with static images

detection works with video but fails to detect with static images Hello everybody. I made a project with OpenCV in c++ u

2017-06-20 14:15:45 -0600 commented question False positive (FP) decreasing methods

@berak I tried to train haar cascade. After 22 hours it was on stage 2 (I guess one reason is big number of samples..?) So i gave up on it. I will please you one more time about time filtering because i want to implement it and it was my first question in this post.

2017-06-17 06:32:47 -0600 commented question False positive (FP) decreasing methods

yeah i made the minNeigbours number so big (30) so it gives me the smallest number of FP. But it isn't so bad really, it works with 3 minnegbours too. But i need to decrease the number of FP as much as possible. Anyways can you explain me time filtering or give me some link about that, i searched google and found nothing..?

2017-06-16 20:22:04 -0600 asked a question False positive (FP) decreasing methods

Hello Everyone! I made object detection for fire extinguisher usinng LBP cascade training. Have 5000 positives (1000 initial) and 5000 negatives. Everything works fine but i have one problem. I get a little bit too much FP. Yes i took about 500 pictures of environment and also downloaded from internet pictures that are best for my example (walls, tiles,etc..) and put it all in negatives folder. But it still doesn't do it. I am thinking about implementing some kind of algorithm in my code that will help me to decrease FP. My idea is some kind of "time filter" that will eliminate positives that last less than x frames (for example 4 frames --> x=4). Is it good idea and is it doable?

Here is my .cpp detector code:

#include <highgui.h>
#include <iostream>
#include <stdio.h>
#include <cv.h>
#include<string>

using namespace std;
using namespace cv;
using namespace std;

int main() {
    cvNamedWindow("fire_extinguisher detecting camera", 1);
    // Capture images from any camera connected to the system
    CvCapture* capture = cvCaptureFromAVI("/home/painkiller/Desktop/video/13.mp4");

    // Load the trained model
    CascadeClassifier fire_extinguisherDetector;
    fire_extinguisherDetector.load("src/fire_extinguisher.xml");

    if (fire_extinguisherDetector.empty()) {
        printf("Empty model.");
        return 0;
    }

    char key;
    while (true) {
        // Get a frame from the camera
        Mat frame = cvQueryFrame( capture );

        stringstream x,y;
        std::vector<Rect> fire_extinguishers;

        // Detect fire_extinguisher
        fire_extinguisherDetector.detectMultiScale(frame, fire_extinguishers, 1.1, 30,
                0 | CV_HAAR_SCALE_IMAGE, Size(250, 700));

        for (int i = 0; i < (int) fire_extinguishers.size(); i++) {
            Point pt1(fire_extinguishers[i].x, fire_extinguishers[i].y);
            Point pt2(fire_extinguishers[i].x + fire_extinguishers[i].width,
                    fire_extinguishers[i].y + fire_extinguishers[i].width);

            x << fire_extinguishers[i].x;
            string strx = x.str();

            y << fire_extinguishers[i].x;
            string stry = y.str();

            // Draw a rectangle around the detected fire_extinguisher
            rectangle(frame, pt1, pt2, Scalar(0, 0, 255), 2);
            putText(frame, strx + " is x and " + stry + " is y", pt1, FONT_HERSHEY_PLAIN, 1.0,
                    Scalar(255, 0, 0), 2.0);

        }

        // Show the transformed frame
        if (!frame.empty())
        imshow("fire_extinguisher detecting camera", frame);

        // Read keystrokes, exit after ESC pressed
        key = cvWaitKey(10);
        if (char(key) == 27) {
            break;
        }
    }

    return 0;
}
2017-05-28 15:29:35 -0600 commented question Object detection not working

@berak, I made negatives folder, took positive pictures, etc.. one more thing to ask. Can you please confirm if this is ok for my fire extinguisher:

1) my postives will be resized to 300X400 before finding bounding rectangles coordinates

2) in my opencv_createsamples command width will be 60 and heigt will be 140 (are these ok sizes for fire extinguisher?)

2017-05-25 14:09:13 -0600 received badge  Enthusiast
2017-05-23 08:57:07 -0600 commented question Object detection not working

OK Berak thank you, you helped me a lot till this moment. I hope it's gonna work with fire extinguisher and that this was my last question for you. Also I'm looking forward to upgrading you, so if there is any way just write me here.

2017-05-22 19:20:25 -0600 commented question Object detection not working

Berak, i didn't succeed with bananas so i have to pick a new object to detect it with this type of training I used for banana detection. I have been thinking a lot and i decided to pick a fire extinguisher. Can you please tell my did I make the right choice and your opinion will detection work after this type of training...

2017-05-20 04:52:54 -0600 commented question Object detection not working

I tried your suggestions but it did't help. I'm slowly facing the reality of not making it :/... Can you please explain me what it takes for object to be good for detection. I Guess from fruits, strawberry would be a good choice since it has texture and no pose problems are involved. Also you said: for bananas there's only the shape, to hook into. what else can opencv hook into and how? Do i make LBP training like this time with all arguments and opencv does it by itself or there are some different techniques..?

2017-05-19 08:04:05 -0600 commented question Object detection not working

Berak, I appreciate your answer, but also you don't have to be so aggressive/rude. I am doing my best, I understand every line of code written in my project and I have made various changes in my program before asking here for help. SO, I please you to stop writing guesses about anyone not knowing the code they write when you know nothing about it. Secondly, I made 204 positives by my camera and used batch processes to blur them, change the brightness, convert them upside down.. So from 204 images i get 1400. If I need to make more positives by camera, that is not problem for me. If it will help, I can make it. But i highly doubt the problem is in that since detector can't detect anything and 204 initial positives and 1400 total is not really a small number..

2017-05-19 07:51:53 -0600 commented question Object detection not working

Der Luftmensch, Before using images I applied greyscale on all of them. All my images are 8-bit. My detector doesn't show any error, it just can't recognize bananas. It put Rectangle showing bananas in wrong places when i run the video with bananas. My posiitive images size are 80x60. I edited my post by adding BananaDetector.cpp file.

2017-05-19 06:04:49 -0600 received badge  Editor (source)
2017-05-18 19:47:03 -0600 asked a question Object detection not working

Hello everybody! I Am working on my masters degree. My first task is to do bananadetector by following this tutorial:

http://technobium.com/object-detectio... Did whole tutorial but in the end, detector doesn't work. It shows red rectangle saying "banana" in the wrong places, it doesn't recognize bananas. Total disaster. I have been trying to make it work for more than 10 days, but nothing helped. For training I made 1400 positives and 3000 negatives and used next commands to train model:

opencv_createsamples -info positives.txt -num 1200 -w 60 -h 80 -vec training.vec

opencv_traincascade -data data -vec training.vec -bg negatives.txt -numPos 1000 -numNeg 1000 -numStages 10 -nsplits 2 -w 60 -h 80 -featureType LBP -minhitrate 0.999 -maxfalsealarm 0.5

Here is my BananaDetector.cpp file

include <highgui.h>

include <iostream>

include <stdio.h>

include <cv.h>

using namespace std; using namespace cv; using namespace std;

int main() {

cvNamedWindow("Banana detecting camera", 1);
// Capture images from any camera connected to the system
CvCapture* capture = cvCaptureFromAVI("/home/painkiller/Desktop/banana.mp4");



// Load the trained model
CascadeClassifier bananaDetector;
bananaDetector.load("src/banana.xml");

if (bananaDetector.empty()) {
    printf("Empty model.");
    return 0;
}

char key;
while (true) {

    // Get a frame from the camera

    Mat frame = cvQueryFrame( capture );

    std::vector<Rect> bananas;

    // Detect banana
    bananaDetector.detectMultiScale(frame, bananas, 1.1, 30,
            0 | CV_HAAR_SCALE_IMAGE, Size(100,440));

    for (int i = 0; i < (int) bananas.size(); i++) {
        Point pt1(bananas[i].x, bananas[i].y);
        Point pt2(bananas[i].x + bananas[i].width,
                bananas[i].y + bananas[i].width);

        // Draw a rectangle around the detected banana
        rectangle(frame, pt1, pt2, Scalar(0, 0, 255), 2);
        putText(frame, "Banana", pt1, FONT_HERSHEY_PLAIN, 1.0,
                Scalar(255, 0, 0), 2.0);

    }

    // Show the transformed frame
    if (!frame.empty())
    imshow("Banana detecting camera", frame);

    // Read keystrokes, exit after ESC pressed
    key = cvWaitKey(10);
    if (char(key) == 27) {
        break;
    }
}

return 0;

}

I have 3 more days to solve this till monday...