Ask Your Question

Nimble_Ninja's profile - activity

2018-03-19 05:37:30 -0600 received badge  Popular Question (source)
2014-11-12 05:58:27 -0600 received badge  Self-Learner (source)
2014-11-11 21:19:41 -0600 answered a question Capture Window has strange ASCII characters?!!

Thanks for the response!! It was indeed the cv files... I had the files input in the global sheet and not in the individual property sheets for the debug and release. Thank you so much for point me to it!!

2014-11-10 02:10:26 -0600 received badge  Student (source)
2014-11-08 12:52:37 -0600 asked a question OpenCV Guide Books

Hello, I wanted to ask around for a good book recommendation for learning more about CV and openCV. I have already read the reviews on Amazon and have narrowed it down to three books that are mentioned on opencv:

  1. A Practical Introduction to Computer Vision with OpenCV
  2. OpenCV Essentials
  3. Learning OpenCV Computer Vision in C++ with the OpenCV Library

I am new to programming (ordered a beginners guide to C++) and CV so I am really looking for some project ideas from the book and a step by step explanation of the code. The more basic the better. I am not looking for any deep explanation behind the math (I am a Chem E and have had enough of that already). I have already created some projects from reading the tutorials on opencv and some on youtube and it seems fun so far. With that said please let me know which book I should purchase if you have used one of them. BTW, I am doing this as a hobby...

2014-11-08 10:23:01 -0600 commented answer Stereo Camera Code: Both are on but only one capture window

looks like I had lib files in a global property sheet instead of a local one... code runs!!! thanks for all the help!

2014-11-08 10:21:55 -0600 received badge  Scholar (source)
2014-11-08 10:21:42 -0600 received badge  Supporter (source)
2014-11-08 10:21:29 -0600 commented answer Trying to Detect Face

Ok...got it past load errors!!! Thank you fedor, it was the lib files... I added them to a global property sheet and not on an individual one for the debug. Code still not finding the face however...but I can figure this part out by reading some more... Thank you ALL for helping me get opencv running!!!

2014-11-08 10:14:22 -0600 commented question Stereo Camera Code: Both are on but only one capture window

yes you are right berak... I added the files to a global property sheet and not to the debug sheet... have fixed issue and works perfect... Thank you for getting me pointed in the right direction!!!!

2014-11-08 10:04:08 -0600 commented question Capture Window has strange ASCII characters?!!

Thanks for the response!! It was indeed the cv files... I had the files input in the global sheet and not in the individual property sheets for the debug and release. Thank you so much for point me to it!!

2014-11-07 20:49:51 -0600 asked a question Capture Window has strange ASCII characters?!!

When I use imshow() the image is shown for 1 camera, but there are strange ascii characters along the top bar instead of the window name...anybody else have this issue? I am using Opencv249, VS2013, Win 8.1 and running 64 bit app

image description

trying stereo camera as well...here is code:

#include "opencv\cv.h";
#include "opencv2\highgui\highgui.hpp";
#include "opencv2\imgproc\imgproc.hpp";

#include <iostream>;

using namespace cv;
using namespace std;



int main()
{
    VideoCapture stream1(0); //camera 1
    VideoCapture stream2(1); // camera 2

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

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




//  if (!stream1.isOpened()) return 1;
//  if (!stream2.isOpened()) return 1;




    for (;;){
//  while (true){
        Mat cameraFrame1;
        Mat cameraFrame2;

        stream1.read(cameraFrame1);
        stream2.read(cameraFrame2);

        namedWindow("RedCamera", WINDOW_AUTOSIZE);
        imshow("RedCamera", cameraFrame1);

        namedWindow("BlackCamera", WINDOW_AUTOSIZE);
        imshow("BlackCamera", cameraFrame2);

        if (waitKey(30) >= 0) break;
            }

    return 0;

}

Any help is appreciated!!

BTW...this is what showed up in debug build window(): 1>------ Build started: Project: StereoCapture, Configuration: Debug x64 ------ 1> Source.cpp 1>Source.cpp(1): warning C4067: unexpected tokens following preprocessor directive - expected a newline 1>Source.cpp(2): warning C4067: unexpected tokens following preprocessor directive - expected a newline 1>Source.cpp(3): warning C4067: unexpected tokens following preprocessor directive - expected a newline 1>Source.cpp(5): warning C4067: unexpected tokens following preprocessor directive - expected a newline 1> StereoCapture.vcxproj -> C:\Users\User\documents\visual studio 2013\Projects\StereoCapture\x64\Debug\StereoCapture.exe ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I don't know if the unexpected tokens is causing this...I have no idea what those lines mean...

2014-11-07 17:46:47 -0600 commented answer Stereo Camera Code: Both are on but only one capture window

Thanks for the response... I tried the code you posted and it did not work. A small blank screen did appear and then another one with the stream from camera2. It seems like it dumps the image from camera 1 and does not hold on to it. BTW the name on the window was gibberish and has been that way for all my applications...

2014-11-07 16:28:16 -0600 asked a question Stereo Camera Code: Both are on but only one capture window

Hello, I am trying out some projects to learn how to program and in addition gain some knowledge about computer vision. I am currently in the stage of setting up the stereo vision but am only getting one capture window... the code is below. I want two windows open with a recording from the different camera. Any help is appreciated!!

#include "opencv\cv.h";
#include "opencv2\highgui\highgui.hpp";
#include "opencv2\imgproc\imgproc.hpp";

#include <iostream>;

using namespace cv;
using namespace std;



int main()
{
    VideoCapture stream1(0); //camera 1
    VideoCapture stream2(1); // camera 2

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

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


    for (;;){
        Mat cameraFrame1;
        Mat cameraFrame2;

        stream1.read(cameraFrame1);
        stream2.read(cameraFrame2);

        imshow("RedCamera 1", cameraFrame1);
        imshow("BlackCamera 2", cameraFrame2);

        if (waitKey(30) >= 0) break;

    }
    return 0;

}
2014-11-07 15:50:02 -0600 commented answer Trying to Detect Face

"use release lib with release in VS (or debug with debug), then reinstall OpenCV"... not sure I understand what this means. I have run other applications using opencv files and they have worked, but never anything from the cascade files. BTW, I am a ChemE and not a programmer so please excuse me if I am stating something that makes no sense. I did try the path you mentioned and then pasted a copy of the two xml files in the folder containing the application file(the .exe file). But that did not work either.

2014-11-07 11:57:37 -0600 commented answer Trying to Detect Face

Thanks for the response!

I tried the correct path and it did not work as well... below is the code I changed: String face_cascade_name = "C:\OpenCV\sources\data\haarcascades\haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "C:\OpenCV\sources\data\haarcascades\haarcascade_eye_tree_eyeglasses.xml";

The error I get is in the command window and is the text from the code where it states "Error loading" for the face cascade

2014-11-06 19:44:05 -0600 received badge  Editor (source)
2014-11-06 17:14:21 -0600 asked a question Trying to Detect Face

I am trying to detect faces but cascade file will not load: I have set path correctly and in addition added files to all folders related to C++ program I also tried adding the files in Visual Studio but that did not work either... I am running windows 8.1, VS2013, OpenCV249 and 64bit configuration. Code:(copied from http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier)

#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;

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

 /** Global variables */
 String face_cascade_name = "haarcascade_frontalface_alt.xml";
 String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses.xml";
 CascadeClassifier face_cascade;
 CascadeClassifier eyes_cascade;
 string window_name = "Capture - Face detection";
 RNG rng(12345);

 /** @function main */
 int main( int argc, const char** argv )
 {
   CvCapture* capture;
   Mat frame;

   //-- 1. Load the cascades
   if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };
   if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };

   //-- 2. Read the video stream
   capture = cvCaptureFromCAM( -1 );
   if( capture )
   {
     while( true )
     {
   frame = cvQueryFrame( capture );

   //-- 3. Apply the classifier to the frame
       if( !frame.empty() )
       { detectAndDisplay( frame ); }
       else
       { printf(" --(!) No captured frame -- Break!"); break; }

       int c = waitKey(10);
       if( (char)c == 'c' ) { break; }
      }
   }
   return 0;
 }

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

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

  //-- Detect faces
  face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );

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

    Mat faceROI = frame_gray( faces[i] );
    std::vector<Rect> eyes;

    //-- In each face, detect eyes
    eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) );

    for( size_t j = 0; j < eyes.size(); j++ )
     {
       Point center( faces[i].x + eyes[j].x + eyes[j].width*0.5, faces[i].y + eyes[j].y + eyes[j].height*0.5 );
       int radius = cvRound( (eyes[j].width + eyes[j].height)*0.25 );
       circle( frame, center, radius, Scalar( 255, 0, 0 ), 4, 8, 0 );
     }
  }
  //-- Show what you got
  imshow( window_name, frame );
 }

I have searched this issues for over a week and can not find anything that actually solves this problem....most mention to correctly reference the path and that does not work. Any help is appreciated

Screen capture of error image description zoomed in image description

and updated code

/** Global variables */
String face_cascade_name = "C:\\OpenCV\\sources\\data\\haarcascades\\haarcascade_frontalface_alt.xml";
String eyes_cascade_name = "C:\\OpenCV\\sources\\data\\haarcascades\\haarcascade_eye_tree_eyeglasses.xml";
CascadeClassifier face_cascade;
CascadeClassifier eyes_cascade;
string window_name = "Capture - Face detection";
RNG rng(12345);