Ask Your Question

prerna1's profile - activity

2019-06-07 15:29:27 -0500 received badge  Notable Question (source)
2016-08-10 05:54:17 -0500 received badge  Popular Question (source)
2016-06-15 07:35:25 -0500 received badge  Popular Question (source)
2013-10-17 14:00:21 -0500 commented answer How can I convert an OpenCV Mat of type CV_8UC3 pixel data to an unsigned int* in ARGB format?

Later, if I want to retrieve these rgb values, how can I do that?

2013-10-17 09:18:55 -0500 asked a question How can I convert OpenCV Mat to unsigned int*?

I need a pointer unsigned int* data, such that,

an unsigned int (32 bits) holds a pixel in ARGB format, which from left to right is as follows:

  • the first 8 bits are for the alpha channel (and are ignored)
  • the next 8 bits are for the red channel
  • the next 8 bits are for the green channel
  • the last 8 bits are for the blue channel
2013-10-17 08:57:57 -0500 asked a question How can I convert an OpenCV Mat of type CV_8UC3 pixel data to an unsigned int* in ARGB format?

I need a pointer unsigned int* data, such that,

an unsigned int (32 bits) holds a pixel in ARGB format, which from left to right is as follows:

the first 8 bits are for the alpha channel (and are ignored) the next 8 bits are for the red channel the next 8 bits are for the green channel the last 8 bits are for the blue channl

2013-09-02 20:20:35 -0500 asked a question How can I create a cross-platform Qt app which uses OpenCV?

I have compiled the OpenCV library & places the dylibs into a folder and included the dylibs by writing LIBS += /myproject/...executablepath/opencv_lib/*.dylib in my project's .pro file

The above works if I have files in /usr/local/lib, however it does NOT work when these dylibs are not there in /usr/local/lib.

I want to create a Qt app which "bundles" OpenCV with it, such that the user does NOT need to install OpenCV himself before running the app. Now that I have already included the dylibs in my project, why should the libraries need to be there in /usr/local/lib also?

Please help!

2013-06-20 09:58:39 -0500 asked a question How can I convert cv::Mat of type CV_8UC1 to a QImage in Qt?

I am trying to fetch the depth frame from kinect and convert that into a cv::Mat & subsequently a QImage. I used the following code to convert a depth frame to an OpenCV Mat object:

VideoFrameRef depthFrame = depthListener.getFrame();
cv::Mat depthDisp (depthFrame.getVideoMode().getResolutionY(), depthFrame.getVideoMode().getResolutionX(), CV_16UC1, (unsigned char*)depthFrame.getData());
cv::normalize(depthDisp, depthDisp, 0, 255, CV_MINMAX, CV_8UC1);
imshow("d", depthDisp);

THE IMAGE DISPLAYS WELL! So, now I have to convert from an OpenCV Mat of type CV_8UC1 to a QImage. I tried the following:

QImage dispQDepth = new Qimage((uchar*)depthDisp.data, depthDisp.size().width, depthDisp.size().height, QImage::Format_Indexed8);

And then displayed the QImage using a QLabel:

QLabel *imgDispLabel = new QLabel("");
imgDispLabel->setPixmap(QPixmap::fromImage(dispQDepth));

But, THIS DOES NOT WORK! What can I do to get it to work?

2013-06-18 09:24:06 -0500 received badge  Editor (source)
2013-06-18 08:21:28 -0500 received badge  Nice Question (source)
2013-06-18 08:08:23 -0500 commented answer CascadeClassifier.detectMultiScale takes a minute! Why?

Hey! I am having a similar problem. I trained a classifier for hand detection, but detectMultiScale(..) is way to slow!! It's taking too long to detect the hand in every frame. How many positives and negatives did you use to get a better detector?

2013-06-18 06:34:56 -0500 commented answer Why is my haar classifier slow?

I know what image resolution is. But are you referring to the image resolution of the positives and negatives or are you referring to the image size specified while creating the vec file?

2013-06-17 12:38:04 -0500 commented answer Why is my haar classifier slow?

By image resolution, what are you referring to? Can you be more specific please?

2013-06-17 09:07:34 -0500 received badge  Student (source)
2013-06-17 08:47:13 -0500 asked a question Why is my haar classifier slow?

I trained a HAAR classifier to detect hands in a LIVE VIDEO FEED from the webcam. I used 621 positives & 3712 negatives.

I used opencv_createsamples to generate the vec file for positives: ./opencv_createsamples -vec /Users/.../positivesvec.vec -info /Users/.../positiveDesc.txt -w 20 -h 30

And then, I used opencv_traincascade to train the classifier: opencv_traincascade -data /Users/.../hand -vec /Users/.../positivesvec.vec -bg /Users/.../negativeDesc.txt -numPos 621 -numNeg 3712 -numStages 15 minHitRate 0.999 maxFalseAlarmRate 0.5 -w 20 -h 30 -mode ALL

The training took around 30 hours or so and I got an xml file. However, when I use that xml file for detection, it is really VERY slow (1 frame in 3-4 seconds maybe).

I know that my object detection code is correct because it works perfectly for faces. This is what I use:

trained_cascade_name = "/Users/.../cascade.xml"; 
if( !cascade.load( trained_cascade_name ) ){ qDebug()<<"Error loading cascade file!"; return; }; 
std::vector<Rect> hands;
Mat frame_gray; // Haar works on grayscale images
cvtColor(frame, frame_gray, CV_RGB2GRAY);
equalizeHist(frame_gray, frame_gray);

cascade.detectMultiScale( frame_gray, hands, 1.1, 3, 0|CV_HAAR_DO_CANNY_PRUNING|CV_HAAR_FIND_BIGGEST_OBJECT, cv::Size(30,30),cv::Size(100,100));
        CvPoint topleft, bottomright;
for( int i = 0; i < hands.size(); i++ )
{
            topleft.x=hands[i].x;
            topleft.y=hands[i].y;
            bottomright.x=hands[i].x+hands[i].width;
            bottomright.y=hands[i].y+hands[i].height;
            cv::rectangle(frame, topleft, bottomright, Scalar(255,0,255), 1, 8, 0);
}

EDIT:

Could it be because of my dataset? http://answers.opencv.org/question/4722/cascadeclassifierdetectmultiscale-takes-a-minute/?comment=15341#comment-15341