Ask Your Question

trav's profile - activity

2018-04-25 02:33:54 -0500 received badge  Popular Question (source)
2017-01-27 12:20:09 -0500 commented question Cascade Classifer Is Very Slow

Slow as in noticeably delayed time when processing the camera feed in context of the haarcascades. I was experimenting and researched a little and found this to be a common complaint in context of speed of executions so I used lbpcascades and the lag has drastically decreased. If you have any suggestions regarding that code though or how one could make it faster I would be interested in hearing your opinion, thanks.

2017-01-26 13:09:26 -0500 commented question Cascade Classifer Is Very Slow

Hmm, I would like to think my 2013 mac air can keep up with the demands. Would have to do further investigating but good suggestion.

2017-01-26 01:46:48 -0500 asked a question Cascade Classifer Is Very Slow

Hello, I'm trying to make my code more efficent in context of faster FPS but seems I am getting around 35 fps or so... very slow indeed. Can someone please tell me what I have done wrong with this code that is bottlenecking it? I don't have much experience with OpenCV any help appreciated. Code will compile and execution below is from top to bottom, thanks.

//

 called in main class first func
void start_camera::load_face_files(){
    // Load the cascades will trip if path is not correct
    if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading face cascade from open cv file\n");
  cout<<" \n ERROR: FILE PATH"<<face_cascade_name<<" \n NOT FOUND!"<<endl; // print error if face does not load
    };

    entry_func();
}


void start_camera::entry_func(){
  cap.open(0);

              // 0 = open default camera
    int apiID = cv::CAP_ANY;      // 0 = autodetect default API
    // open selected camera using selected APi
    cap.open(0,apiID);
    // check if we succeeded

    if (!cap.isOpened()) {
        cerr << "ERROR! Unable to open camera\n";

    }
    cout << "Start grabbing" << endl
    << "Press any key to terminate" << endl;

    while(cap.read(frame)){

        if (frame.empty()) {
           cerr << "ERROR! blank frame grabbed\n";
        break;
       }

        imshow("live",frame);

        cam_start(frame);

        if (waitKey(1) >= 0)
            //break;
            cout<<"";
    }

}



void start_camera::cam_start(Mat frame){
     std::vector<Rect> faces;
    Mat frame_gray;
    cvtColor(frame, frame_gray, COLOR_BGR2GRAY);  // Convert to gray scale
    equalizeHist(frame_gray, frame_gray);       // Equalize histogram

    // Detect faces
    face_cascade.detectMultiScale(frame_gray, faces, 1.1, 3, 0|CASCADE_SCALE_IMAGE, Size(30, 30));

    // Iterate over all of the faces
    for( size_t i = 0; i < faces.size(); i++ ) {

        // Find center of faces
        Point center(faces[i].x + faces[i].width/2, faces[i].y + faces[i].height/2);

        // Draw ellipse around face
        ellipse(frame, center, Size(faces[i].width/2, faces[i].height/2),
                0, 0, 360, Scalar( 255, 0, 0 ), 4, 8, 0 );
    }

    imshow(window_name, frame);  // Display frame
}
2016-07-06 00:48:46 -0500 answered a question install contrib_master modules in openCV 3.1.0

Travis's easy as pie method to keep your hair enact..

Re-install up to date openCV main folder via zip etc..

download the opencv_contrib_master ( 3rd party )

create build folder inside openCV main

copy all modules from contrib folder and paste them into our main openCV

run Cmake as per normal (GUI WAY) have source code of main openCV and create build binaries in our build folder we created

Finished, breath

This seems to work if I encounter any problems I will update this answer but as of now its working, this was way more complicated then it should have ever been or made to seem, this is blatantly simple don't overthink it like I did please

2016-07-04 23:55:04 -0500 commented question install contrib_master modules in openCV 3.1.0

UPDATE:

I have added the modules via copy and paste from the opencv_contrib_master to the openCv 3.1.0 original photo but when I go into opencv/build/lib folder and look at all my modules I don't see any of my modules I want from opencv_contrib_master this is essentially all I need to figure out and everything will be working fine, if someone can kindly explain how to get these extra modules in here clearly and clean that'll be great and I'm sure ill be on my way just going in circles here with this

2016-07-04 23:51:52 -0500 commented answer install contrib_master modules in openCV 3.1.0

Hey thanks for your input. I understand the logic behind this and yes they are very similar with slight differences but that major problem I am having is a clear defined way how to add extra modules that are not the standard modules with openCV 3.1.0 rather I want the opencv contrib_master which is different in the sense of adding modules to the actual opencv

2016-07-03 22:40:46 -0500 commented question install contrib_master modules in openCV 3.1.0

@jmbapps I'm using Qt, I have Cmake etc

Alright thanks guys I'm still pluging away at this reading etc.

2016-07-02 00:55:38 -0500 asked a question install contrib_master modules in openCV 3.1.0

I am looking for clear instructions from someone how to configure this properly and with success. I have the master_contrib folder on my desktop and the standard openCV 3.1.0 located on my desktop as well. How do I successfully add the master_contrib modules to the standard openCV folder? I am using Mac OSX

2016-07-02 00:49:24 -0500 commented answer 3.1.0 Face Recognition Algorithm? c++

Thanks Steve will have to read that this weekend!

2016-07-02 00:48:55 -0500 commented answer 3.1.0 Face Recognition Algorithm? c++

Thanks, I have got the folder now, makes a lot more sense. I have a little side-question for you... Im using mac OS X lets say i have the openCV 3.1 folder on my desktop where everything has been successfully configured previously and I now have the opencv_contrib_master on my desktop how would I add these modules and create this effect successfully via command line or GUI I ask because I do not want to mess anything up as it has took a long time to get anywhere due to the documentation, thanks a lot

2016-06-27 14:28:56 -0500 asked a question 3.1.0 Face Recognition Algorithm? c++

I have code which recognizes the face and eyes draws circles on my live webcam feed accordingly I have been reading the documentation and have realized that the old methods are no longer supported for the facial recognition what I would like to do is use something similar to the Eigenfaces.. I have the Yale database downloaded on my desktop. Essentially I'm just wondering how to do this in 2016 with C++ as the documentation can sometimes be confusing and harder to find for the version 3.1, thanks for your help in advance.

2016-06-19 10:08:41 -0500 received badge  Editor (source)
2016-06-19 10:07:33 -0500 asked a question Face Detection Error OpenCV 3.1.0

I am trying to get started in opneCv and get learning but am running into problems in regards to face detection the code I have should detect faces I believe my linkages are fine can someone please help me understand what I'm doing wrong? full code in both main.cpp and project.pro file is provided below

App Output:

starting /Users/admin/Desktop/build-Origin-Desktop_Qt_5_6_0_clang_64bit-Debug/Origin.app/Contents/MacOS/Origin... OpenCV Error: Assertion failed (!empty()) in detectMultiScale, file /Users/admin/Desktop/opencv-3.1.0/modules/objdetect/src/cascadedetect.cpp, line 1639 Cleaned up camera. Unable to initiate camera /Users/admin/Desktop/build-Origin-Desktop_Qt_5_6_0_clang_64bit-Debug/Origin.app/Contents/MacOS/Origin exited with code 0

Compile Output:

10:46:41: Running steps for project Origin... 10:46:41: Configuration unchanged, skipping qmake step. 10:46:41: Starting: "/usr/bin/make" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../Origin -I. -I/usr/local/include -I../../Qt/5.6/clang_64/lib/QtWidgets.framework/Headers -I../../Qt/5.6/clang_64/lib/QtGui.framework/Headers -I../../Qt/5.6/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../Qt/5.6/clang_64/mkspecs/macx-clang -F/Users/admin/Qt/5.6/clang_64/lib -o main.o ../Origin/main.cpp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/Users/travishaycock/Qt/5.6/clang_64/lib -o Origin.app/Contents/MacOS/Origin main.o mainwindow.o moc_mainwindow.o -F/Users/admin/Qt/5.6/clang_64/lib -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_videoio -lopencv_imgproc -lopencv_objdetect -framework QtWidgets -framework QtGui -framework QtCore -framework OpenGL -framework AGL 10:46:43: The process "/usr/bin/make" exited normally. 10:46:43: Elapsed time: 00:02.

Main.cpp File

  #include "mainwindow.h"
#include <QApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/videoio/videoio.hpp>
#include<opencv2/objdetect/objdetect.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<vector>
#include<string>

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

using namespace cv;
using namespace std;





CascadeClassifier face_cascade, eyes_cascade;
String window_name = "Face Detection";

/**
 * Detects faces 
 */
void detectFaces(Mat frame) {

  std::vector<Rect> faces;
  Mat frame_gray;
  cvtColor(frame, frame_gray, COLOR_BGR2GRAY);  // Convert to gray scale
  equalizeHist(frame_gray, frame_gray);         // Equalize histogram

  // Detect faces
  face_cascade.detectMultiScale(frame_gray, faces, 1.1, 3,
                0|CASCADE_SCALE_IMAGE, Size(30, 30));

  // Iterate over all of the faces
  for(size_t i = 0; i < faces.size(); i++) {

    // Find center of faces
    Point center(faces[i].x + faces[i].width/2, faces[i].y + faces[i].height ...
(more)
2016-06-09 15:25:58 -0500 commented question Face Detection/ Recognition [OpenCV 3.1.0 With Qt]

Hello,

Errors in this code? No; This code works I'm asking how to implement this to detect faces.. the code to detect faces is absent and am requesting if someone knows how to combine this code and the code that detects faces... this code only opens local camera on a machine , thanks

2016-06-08 14:50:59 -0500 asked a question Face Detection/ Recognition [OpenCV 3.1.0 With Qt]

Im having a bit of a slow start with openCV and have had some difficulties setting it up and integrating with Qt but am finally in the clear . I would like to know how to detect face in openCV using the code as per provided below; I have been trying to integrate other code and create my own with no prevail not really sure what I'm doing wrong can someone point me in the right direction? here is my code; this code open the camera only and captures frames.

    #include "mainwindow.h"
#include <QApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/videoio/videoio.hpp>
#include<opencv2/objdetect/objdetect.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<vector>
#include <iostream>
#include<stdio.h>
using namespace cv;
using namespace std;



class openCam{

public:

 void initiateCamera(){



         VideoCapture capture(0);
         if (!capture.isOpened()){
           std::cout << "Could not open VideoCapture" << std::endl;
 }

             Mat imgRead;

             for (;;){
               // capture a frame
               capture >> imgRead;
               imshow("Cam Interface", imgRead);
               // close if key pressed
               if(waitKey(27) > 0)
                   break;
             }

             capture.release();
             destroyAllWindows();


  }

};


// ************************************************************** MAIN

int main(int argc, char *argv[]){
    QApplication a(argc, argv);
    MainWindow w;
 // cam code
try{
  openCam cam;
   cam.initiateCamera();

}catch(Exception ex){
cout << "Unable to initiate camera" << std::endl;
    }


 w.show();
return a.exec();
}
2016-06-07 01:09:05 -0500 asked a question facial detection/recognition

Im having a bit of a slow start with openCV and have had some difficulties setting it up and integrating with Qt but am finally in the clear . I would like to know how to detect face in openCV using the code as per provided below; I have been trying to integrate other code and create my own with no prevail not really sure what I'm doing wrong can someone point me in the right direction? here is my code; this code open the camera only and captures frames.

#include "mainwindow.h"
#include <QApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/videoio/videoio.hpp>
#include<opencv2/objdetect/objdetect.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<vector>
#include <iostream>
#include<stdio.h>
using namespace cv;
using namespace std;



class openCam{

public:

 void initiateCamera(){



         VideoCapture capture(0);
         if (!capture.isOpened()){
           std::cout << "Could not open VideoCapture" << std::endl;
 }

             Mat imgRead;

             for (;;){
               // capture a frame
               capture >> imgRead;
               imshow("Cam Interface", imgRead);
               // close if key pressed
               if(waitKey(27) > 0)
                   break;
             }

             capture.release();
             destroyAllWindows();


  }

};


// ************************************************************** MAIN

int main(int argc, char *argv[]){
    QApplication a(argc, argv);
    MainWindow w;
 // cam code
try{
  openCam cam;
   cam.initiateCamera();

}catch(Exception ex){
cout << "Unable to initiate camera" << std::endl;
    }


 w.show();
return a.exec();
}
2016-05-25 00:45:16 -0500 received badge  Scholar (source)
2016-05-25 00:45:15 -0500 received badge  Supporter (source)
2016-05-24 22:24:48 -0500 commented answer How To Obtain Live Webcam Feed

Hey it actually works :) thanks so much I can finally play around now and get the hang of it, just needed the first initial intro and housekeeping stuff, thanks again

2016-05-24 13:31:17 -0500 commented answer How To Obtain Live Webcam Feed

Sure, worth noting I'm using Mac OSX; I had a problem before with the project file and this was the original that actually worked in the end, unless this is wrong again.. thanks again

  #-------------------------------------------------
#
# Project created by QtCreator 2016-05-21T11:35:02
#
#-------------------------------------------------

QT  += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = trabajo
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

LIBS += \
    -L/usr/local/lib \
    -lopencv_core \
    -lopencv_highgui

INCLUDEPATH += \
    /usr/local/include



HEADERS  += mainwindow.h

FORMS    += mainwindow.ui
2016-05-24 10:45:24 -0500 commented answer How To Obtain Live Webcam Feed

Hey Amal,

Thanks for the reply unfortunately this code or example is not working for me. I am getting 2 issues. symbol(s) not found for architecture x86_64 linker command failed with exit code1 (use -v to see invocation)

2016-05-23 22:22:17 -0500 asked a question How To Obtain Live Webcam Feed

Im new to CV and have been reading on the documentation and find some stuff clear and other things not, this is one thing thats not really clear and am failing to take off and understand this; I am using Qt I have openCV properly installed I have created a Qt widget application in my project.pro file i have the sources and libs for openCV my question is where do I actually put the openCV code and why isn't this working? I putting all the openCV code in my main method in my main.cpp at the moment. All I would like to do at the moment is open the webcam and get live feed from my local cam, How can I accomplish this and where do I need to put the openCV code if I'm not already putting this in the correct file, thanks in advance.

What I have tried main.cpp

#include "mainwindow.h"
#include <QApplication>
#include <opencv2/opencv.hpp>
#include<opencv2/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <QTextStream>
#include <stdio.h>

using namespace cv;
using namespace std;





int main(int argc, char *argv[]){



    // disable buffer useless with GUI app
   //setbuf(stdout, NULL);
       QApplication a(argc, argv);
       MainWindow w;
       w.show();
      return a.exec();



   VideoCapture stream1(0);   //0 is the id of video device.0 if you have only one camera.

   if (!stream1.isOpened()) { //check if video device has been initialised
   cout << "cannot open camera";
   }

   //unconditional loop
   while (true) {
   Mat cameraFrame;
   stream1.read(cameraFrame);
   imshow("cam", cameraFrame);
   if (waitKey(30) >= 0)
   break;
   }
   return 0;
   }
2016-05-22 13:24:10 -0500 received badge  Enthusiast
2016-05-21 20:13:59 -0500 answered a question OpenCV integration with Qt

Hey, thanks for your help I actually got it and have reproduced the desired outcome... essentially what happened because I am new to Qt & OpenCV etc. It seems I have placed the code before Sources' in the project.pro file which produced the errors... I did this before as well I don't quite understand why it decides to work now but did not before? but essentially I'm good :) thanks for support

2016-05-19 21:44:13 -0500 commented question OpenCV integration with Qt

I did have this first installed on Xcode on my mac... and then switched to Qt hence why you see Xcode in the output. Sorry for the long response as well

2016-05-19 21:42:57 -0500 commented question OpenCV integration with Qt

22:41:46: Starting: "/usr/bin/make" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../CV -I. -I../../Qt/5.6/clang_64/lib/QtWidgets.framework/Headers -I../../Qt/5.6/clang_64/lib/QtGui.framework/Headers -I../../Qt/5.6/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framewor

2016-05-19 00:44:21 -0500 asked a question OpenCV integration with Qt

Version: opencv-3.1.0 Language : C++

Hello everyone,

I have been having a reoccurring problem that is really slowing me down.. I'm new to C++ and really want to learn and get into openCV . I have successfully integrated this with Xcode on my mac but am unable to do this with Qt .. Here what I have done so far (below) I have added this to my project but keep getting an error saying 'libraries/openCV not found'

-------------------------------------------------

#

Project created by QtCreator 2016-05-15T23:16:25

#

-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = cam TEMPLATE = app

// new QT += core QT -= gui

TARGET = RP_openCV_01 CONFIG += console CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp\ mainwindow.cpp

LIBS += -L/opt/local/lib \ -lopencv_highgui.3.1.0 \ -lopencv_core.3.1.0

INCLUDEPATH += /opt/local/include

HEADERS += mainwindow.h

FORMS += mainwindow.ui