Ask Your Question

khansen's profile - activity

2018-06-11 08:27:57 -0600 received badge  Popular Question (source)
2017-12-25 10:53:26 -0600 received badge  Notable Question (source)
2015-12-04 04:49:03 -0600 received badge  Popular Question (source)
2013-08-27 15:12:46 -0600 commented answer Ideal motion/object tracking method - Problems with image noise

Hi Mathieu. I'm trying PeopleDetect.cpp now, but the softcascade.hpp file doesn't exist within any of the folders in OpenCV 2.4.6. I was able to find it in the 2.9.0.0 documentation, but I don't think that helps me much. Is this a third part library? If so, where can I download it?

2013-08-16 11:55:03 -0600 commented answer Problem opening then displaying AVI file

I looked into that. Unfortunately, that's not my problem. OpenCV is hyper-specific about what AVI formats it supports. My uncompressed 24 bit RGB (RV24) coming out of iSpy didn't meet those specs.

http://opencv.willowgarage.com/wiki/VideoCodecs

2013-08-16 11:51:24 -0600 commented answer Ideal motion/object tracking method - Problems with image noise

Thanks for the advice! I'll look into these and post results.

The camera won't be moving at all. It has PTZ functionality, but I only got it for the 360 deg. FOV via fisheye lens. The space it will be in has no windows, so I thought a background subtraction setup using one original image subtracting from the current frame would work quite well. Would you concur? I will be sure to play with HOGdescriptor too. I didn't see the cpp sample you mentioned via the link. Is it somewhere else?

RE to tracking: I don't need to persistently track and ID people after they've left the FOV. It might be nice to have down the road though. What I'm really looking for in these regards is the ability to track many people as they appear in the FOV, at one time then ID ... (more)

2013-08-16 11:36:57 -0600 received badge  Supporter (source)
2013-08-15 16:42:13 -0600 asked a question Problem opening then displaying AVI file

Hello,

The program below is supposed to open an AVI file that is stored in the app directory then display it, but it's crashing when I run it. I'm new to C++ and OpenCV, this issue has been driving me mad all day, and I've looked all over the internet for a solution. Please help! I'm using OpenCV 2.4.6 with VS 2010 on a x64 machine.

This is the error I'm getting:

First-chance exception at 0x76daa048 (msvcrt.dll) in iotaCam4.exe: 0xC0000005: Access violation reading location 0x009907e0.
Unhandled exception at 0x76daa048 (msvcrt.dll) in iotaCam4.exe: 0xC0000005: Access violation reading location 0x009907e0.

The point at which the debugger places the break is at line 45 (bool bSuccess = cap.read(curVid);).

Code:

#define _CRT_SECURE_NO_DEPRECATE

#include <sstream>
#include <string>
#include <iostream>
#include <opencv\highgui.h>
#include <opencv\cv.h>
#include <vector>
#include <background_segm.hpp>
#include <opencv2/opencv.hpp>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>

using namespace cv;
using namespace std;

int nmixtures = 2;
int bShadowDetection = 1;
int history = 2;

Mat oriImg;     // original still image from IP Cam
Mat curVid;     // live feed from IP Cam
Mat difImg;     // resultant image from background subtraction 

int main(int argc, char *argv[])
{
    // get cam feed and show in new window
    VideoCapture cap("1_2013-08-15_10-38-25.avi");
     if (!cap.isOpened())  // if not success, exit program
    {
         cout << "Cannot open the video file" << endl;
         return -1;
    }
    double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
    double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video
    cout << "Frame size : " << dWidth << " x " << dHeight << endl;
    namedWindow("Current Video", CV_WINDOW_AUTOSIZE);


    // show images in windows
    while(1)
    {
        // show camera feed
        bool bSuccess = cap.read(curVid); // read a new frame from video
        if (!bSuccess) //if not success, break loop
        {
            cout << "Cannot read a frame from video file" << endl;
            break;
        }
        imshow("Current Video", curVid);
        if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
      {
            cout << "esc key is pressed by user" << endl;
            break; 
      }
    }

    return 0;
}

Here is the output and errors I get when debugging:

'iotaCam4.exe': Loaded 'C:\Users\khanse\Documents\Visual Studio 2010\Projects\iotaCam4\Debug\iotaCam4.exe', Symbols loaded.
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Symbols loaded (source information stripped).
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Symbols loaded (source information stripped).
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Symbols loaded (source information stripped).
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\sysfer.dll', Cannot find or open the PDB file
'iotaCam4.exe': Loaded 'C:\opencv\build\x86\vc10\bin\opencv_core246d.dll', Cannot find or open the PDB file
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'iotaCam4.exe': Loaded 'C:\opencv\build\x86\vc10\bin\opencv_highgui246d.dll', Cannot find or open the PDB file
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Symbols loaded (source information stripped).
'iotaCam4.exe': Loaded 'C:\Windows\SysWOW64\gdi32 ...
(more)
2013-08-14 11:47:57 -0600 received badge  Editor (source)
2013-08-14 11:36:55 -0600 asked a question Ideal motion/object tracking method - Problems with image noise

Hi all,

I would like to get an idea of the best way to go about tracking people with an ceiling-mounted IP camera. Ultimately, I would like to have an application that does the following:

  • show the video feed in a primary window
  • identifies moving objects then assigns them with an identifier of some kind (object1, object2, etc.)
  • in the primary window, draw a rectangle around each object and add the object ID to it as a tag
  • capture the x and y coordinates of the object or rectangle, preferably the center (it seems that this can be done using the moments() method)
  • in a second window show a binary image of blobs/people in black and everything else in white
  • on the binary image, draw a line from the previous x,y coordinates of each object to the current coordinates

EDIT: I am currently getting far too much noise in my binary image, and have not been able to limit it with the filters I'm using. I'm also unable to track and tag multiple objects. This may be the result of the example I borrowed from, in which only the object with the largest area is tagged. Unfortunately, I have not been able to fix this.

main.cpp - full code found in this Gist

int main(int argc, char *argv[])
{
    // get cam feed and show in new window
    VideoCapture cap(0);
     if (!cap.isOpened())  // if not success, exit program
    {
         cout << "Cannot open the video file" << endl;
         return -1;
    }

    setwindowSettings();   // create window with trackers that adjust filter settings

    // background subtraction init
    BackgroundSubtractorMOG2 bg = BackgroundSubtractorMOG2(hist,thresh,false);

    cap.read(curVid);

    Sleep(5000);

    // show images in windows
    while(1)
    {
        // show camera feed
        bool bSuccess = cap.read(curVid); // read a new frame from video
        if (!bSuccess) // if not success, break loop
        {
            cout << "Cannot read a frame from video file" << endl;
            break;
        }

        // start morph functions then draw
        HSV();                             // apply cvtColor(curVid,imgHSV,CV_BGR2HSV);
        Erosion( 0, 0 );                   // choose erosion type and apply erode(imgHSV,erosion_dst,element); 
        Dilation( 0, 0 );                  // choose dilation type and apply dilate(erosion_dst,dilation_dst,element);

        // background subtraction
            bg(dilation_dst,mask,-1);
        imshow("mask",mask);

        // find and draw contours to Mat test
        trackFilteredObject();
        imshow("test", test);

        // escape program with keystroke
        if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
        {
            cout << "esc key is pressed by user" << endl;
            break; 
        }

    }
    return 0;
}