Ask Your Question

hyder's profile - activity

2020-11-28 07:49:05 -0600 received badge  Popular Question (source)
2020-04-08 07:37:40 -0600 received badge  Notable Question (source)
2020-03-13 17:21:16 -0600 received badge  Popular Question (source)
2019-10-11 00:28:07 -0600 asked a question Hole filling and edge linking in a binarized cell image

Hole filling and edge linking in a binarized cell image Hi all, I need to segment and classify blood cells in several im

2019-10-09 11:20:54 -0600 received badge  Popular Question (source)
2019-04-07 07:39:26 -0600 received badge  Popular Question (source)
2017-09-13 10:53:57 -0600 commented question Train an LBP head detector using opencv_traincascade

@berak, what do you think would be a better approach if I want to detect heads from an overhead camera using a learning

2017-09-12 03:23:56 -0600 commented question Train an LBP head detector using opencv_traincascade

All the 50 positive samples are not 100x100. Infact everyone of them is greater than 100x100 and they are also not of th

2017-09-12 02:40:21 -0600 commented question Train an LBP head detector using opencv_traincascade

@berak, but there are cascaded detectors for non-rigid objects (like face). So shouldn't it work for other non-rigid obj

2017-09-10 12:10:36 -0600 asked a question Train an LBP head detector using opencv_traincascade

Train an LBP head detector using opencv_traincascade Hello, I am trying to train an overhead head detector using LBP wi

2017-09-10 04:31:37 -0600 commented answer opencv_annotation error

Working now. Thanks.

2017-09-10 04:31:19 -0600 marked best answer opencv_annotation error

Hello,

I am trying to annotate 10 images (named img1.jpg, ... , img10.jpg) using opencv_annotation tool in Windows openCV 3.1.0. I have placed these 10 images in a folder named p and placed that folder in /build/bin/Debug.

I have built only the Debug version of the library, so I am running the opencv_annotationd.exe from folder /build/bin/Debug with the following command line

opencv_annotationd --annotations=/p/file.txt --images=/p/

But I am getting the following error

The path for the output file contains an error and could not be opened. Please check again!

What might be the issue?

Thanks.

2017-09-07 03:18:38 -0600 commented question opencv_annotation error

I have also tried it on Linux with the following: opencv_annotation --annotations=/home/haider/Desktop/images/file.txt

2017-09-07 02:49:59 -0600 commented question opencv_annotation error

I have tried your suggestion. Placed the folder p in Local Disk C and ran the following command line from inside the bui

2017-09-07 02:14:35 -0600 asked a question opencv_annotation error

opencv_annotation error Hello, I am trying to annotate 10 images (named img1.jpg, ... , img10.jpg) using opencv_annotat

2017-04-09 12:54:30 -0600 asked a question build openCV-3.1.0 with GStreamer windows

Hi,

I am trying to build openCV-3.1.0 with GStreamer enabled using cmake-gui. I have installed these two GStreamer packages (gstreamer-1.0-devel-x86_64-1.11.2.msi and gstreamer-1.0-x86_64-1.11.2.msi) provided on this page.

When I configure cmake, it cannot find GStreamer include libraries and the option is NO infront of GStreamer in Video I/O logs of cmake.

Can someone please point me to a comprehensive guide on how to build and install openCV-3.1.0 from source with GStreamer support?

Thanks.

2017-03-16 06:50:24 -0600 commented answer picamera alternative in openCV(C++)
  1. That is what I thought; sensor mode is essentially changing capturing resolution so I used CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_HEIGHT but it only changes the resolution and not the sensor mode. This is confirmed by the fact that if the sensor mode had been changed successfully to "mode 5" (corresponding to 1296x730), my output image would not contain any "junk" value.

  2. Wouldn't using boost::python help?

Any other suggestion?

2017-03-16 05:14:33 -0600 asked a question picamera alternative in openCV(C++)

Hi,

There is a python package available for controlling Raspberry Pi camera called picamera which exposes all the options available in raspistill.

I need to access/change the "sensor mode" (which changes the resolution) for capturing. I am using openCV (C++) for my application but there is no option to change "sensor mode" available in cv::VideoCapture::set. There is a field of CV_CAP_PROP_MODE but that is not the same. So my question is:

  1. Is there a way to change the "sensor mode" in openCV?

  2. If not, then is there a C++ alternative available like picamera?

  3. If not, then is there a way to use this python package in my C++ program?

2017-01-04 22:03:17 -0600 commented question openmp with sections directive

@LBerger, after your suggestions I tried to find the performance difference with and without openCV. Using the cv::getBuildInformation() function, I can see that Use openMP, Use concurrency and Use openCL options are YES. Also Use IPP has path mentioned against it. All other options in third-party libraries are NO. I have also enabled Use openMP option in VS2013. The problem is when I use openCV functions (e.g. cv::matchTemplate(), cv::GaussianBlur() etc) with and without #pragma omp parallel there is a decrease in performance instead of performance boost. These functions take approximately double the time with the omp pargma. Windows 64 bit platform with VS2013 ultimate. Any idea what I am doing wrong? Thanks.

2016-12-28 11:16:29 -0600 commented question openmp with sections directive

@LBerger, okay. Is there a list available where I can find the already parallelized openCV's functions and check whether I am using any of them in my code?

2016-12-28 11:06:56 -0600 commented question openmp with sections directive

@LBerger, as I said this is just a crude form of my code. I am afraid I can't print the entire tracking algorithm code here. Therefore, I have replaced it with a simple instruction (to give an idea about the structure of my code) because I just want the tracking part and the overlay part to run in parallel on different cores rather than them running sequentially on a single core. I am not parallelizing anything within these sections though.

2016-12-28 10:57:33 -0600 commented question openmp with sections directive

@LBerger I want the overlay section and the tracking section to run in parallel. Is this not a good approach to reduce the total time spent on a given frame? Would you rather suggest that I parallelize my tracking algorithm itself, e.g. the correlation part in my tracking part?

2016-12-28 09:50:18 -0600 asked a question openmp with sections directive

Hi,

I have a tracking algorithm with two main parts; 1. tracking algorithm 2. video overlay.

A lot of stuff needs to be overlayed and it takes a lot of time. I was thinking of parallelizing the two parts using openMP with minimal effort. So I thought of using the sections directive available in openMP. The following code is just a crude form of what I am trying to achieve:

#include "opencv2\highgui\highgui.hpp"
#include "opencv2\core\core.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include <iostream>
#include <omp.h>
#include "Timer.h"

using namespace std;
using namespace cv;

int main()
{
    VideoCapture cap(0);        //start the webcam
    Mat frame, roi;
    Timer t;                    //timer class
    int frameNo = 0;
    double summ = 0;

    while (true)
    {
        cap >> frame;
        frameNo++;
        roi = frame(Rect(100, 100, 300, 300)).clone();  //extract a deep copy of region of interest; for tracking purposes
        t.start();                                      //start the timer
#pragma omp parallel sections
        {
#pragma omp section         //first section: tracking algorithm
            {
                //some tracking algorithm below which uses only "roi" variable
                GaussianBlur(roi, roi, Size(5, 5), 0, 0, BORDER_REPLICATE);
            }
#pragma omp section         //second section: overlay video
            {
                //a lot of overlay in different video parts which uses only "frame" variable
                putText(frame, "string 1", Point(10, 10), 1, 1, Scalar(1));
                putText(frame, "string 2", Point(20, 20), 1, 1, Scalar(1));
                putText(frame, "string 3", Point(30, 30), 1, 1, Scalar(1));
                putText(frame, "string 4", Point(40, 40), 1, 1, Scalar(1));
                putText(frame, "string 5", Point(50, 50), 1, 1, Scalar(1));
                putText(frame, "string 6", Point(60, 60), 1, 1, Scalar(1));
                putText(frame, "string 7", Point(70, 70), 1, 1, Scalar(1));
                putText(frame, "string 8", Point(80, 80), 1, 1, Scalar(1));
                putText(frame, "string 9", Point(90, 90), 1, 1, Scalar(1));
                putText(frame, "string 10", Point(100, 100), 1, 1, Scalar(1));
            }
        }
        t.stop();               //stop the timer

        summ += t.getElapsedTimeInMilliSec();
        if (frameNo % 10 == 0)      //average total time over 10 frames
        {
            cout << summ / 10 << endl;
            summ = 0;
        }
        imshow("frame", frame);
        if (waitKey(10) == 27)
            break;
    }
    return 0;
}

I don't seem to see a performance boost with timing analysis and in some cases the timing with openMP gets worse even when I am using different variables in my sections

My question is whether I am using the right approach (using sections directive) for my case or is there a better way to parallelize my existing code using openMP with minimal effort?

Thanks.

2016-11-04 12:34:46 -0600 received badge  Nice Question (source)
2016-07-19 05:40:22 -0600 commented question getPeopleDetector48x96 missing in 3.0.0

@sturkmen, thanks for the reply. I have gotten the code working. Another question: what does the first for loop in peopledetect.cpp do? Is it for non-maxima suppression i.e. to eliminate extra rectangles for a single human detection?

 for( i = 0; i < found.size(); i++ )
        {
            Rect r = found[i];
            for( j = 0; j < found.size(); j++ )
                if( j != i && (r & found[j]) == r)
                    break;
            if( j == found.size() )
                found_filtered.push_back(r);
        }
2016-07-18 05:59:15 -0600 asked a question getPeopleDetector48x96 missing in 3.0.0

Hi,

I am trying to use openCV's HOGDescriptor to detect pedestrians in a video named 768x576 provided in data folder. I am using getDefaultPeopleDetector()as input to SVM but it suffers from a lot of misses maybe because it is trained for 64x128 samples. There is also a getPeopleDetector48x96() but I cannot seem to find it in 3.0.0. Anybody has any idea how to use getPeopleDetector48x96() in 3.0.0 ?

Thanks.

2016-06-06 23:29:02 -0600 commented question Efficient way to apply a minimum filter

Thank you @LBerger and @Tetragramm. cv::erode works fine! Also, I noted the speed difference between images of type CV_64FC3 and CV_8UC3. So I think it would be computationally better if I keep my images in CV_8UC3 type.

2016-06-06 02:27:04 -0600 asked a question Efficient way to apply a minimum filter

Hi,

I am trying to implement a function which takes an image (type: CV_64FC3) and applies two operations on it:

  1. Each RGB pixel is replaced by the minimum channel value resulting in a CV_64C1 type image.
  2. A minimum filter of size blockSize is applied.

The function is performing as required but it takes approximately 1600ms to process a single image of resolution 720 x 576 with blockSize of 15. My question is whether I can do anything to make it computationally efficient, particularly for loop. Code:

Mat darkChannel(Mat im, int blockSize)
{
    int padSize = (blockSize - 1) / 2;
    double minVal;

    Mat temp, minChannel, borderMinChannel, bgr[3];

    split(im, bgr); //split into RGB channels
    (cv::min)(bgr[0], bgr[1], temp); //find minimum between R and G channels
    (cv::min)(temp, bgr[2], minChannel); 

    copyMakeBorder(minChannel, borderMinChannel, padSize, padSize, padSize, padSize, BORDER_REPLICATE); //padding

    Mat dc = Mat::zeros(borderMinChannel.rows, borderMinChannel.cols, CV_64FC1); //create Mat to store final result
    double* p;

    for (int i = padSize; i < borderMinChannel.rows - padSize; i++)
    {
        p = dc.ptr<double>(i);
        for (int j = padSize; j < borderMinChannel.cols - padSize; j++)
        {
            minMaxLoc(borderMinChannel(Rect(j - padSize, i - padSize, 2 * padSize + 1, 2 * padSize + 1)), &minVal, NULL); //find the minimum value in a block
            p[j] = minVal; //put the minimum value in Mat
        }
    }

    dc = dc(Rect(padSize, padSize, minChannel.cols, minChannel.rows)); //remove padding to return to original size
    return dc;
}
2016-06-02 14:21:45 -0600 received badge  Self-Learner (source)
2016-06-02 01:11:32 -0600 received badge  Critic (source)
2016-06-02 01:10:44 -0600 answered a question minimum value per pixel (w.r.t channel) in a 3 channel image

I found another way of doing this:

Mat temp, minChannel, bgr[3];

split(src, bgr);                           //split src into B,G,R channels
(cv::min)(bgr[0], bgr[1], temp);           //find minimum between B and G channels
(cv::min)(temp, bgr[2], minChannel);       //find minimum between temp and R channels
2016-05-31 01:54:02 -0600 commented answer minimum value per pixel (w.r.t channel) in a 3 channel image

Thanks for the reply. Shouldn't it be split(src, x) rather than split(x, src)?

2016-05-30 06:36:23 -0600 asked a question minimum value per pixel (w.r.t channel) in a 3 channel image

Hi everyone,

Is there any function in openCV which can return the minimum/maximum value of a pixel w.r.t channel in a 3 channel image (e.g. a BGR image) like the following available in MATLAB:

temp = min(im, [], 3);

I know that you can use nested loops to access each pixel using Mat::at<type>(i,j) operator and then use min function twice to get the minimum value per pixel like this:

for (int m = 0; m<src.rows; m++)
    {
        for (int n = 0; n<src.cols; n++)
        {
            intensity = src.at<Vec3b>(m, n);
            rgbmin.at<uchar>(m, n) = min(min(intensity.val[0], intensity.val[1]), intensity.val[2]);
        }
    }

but this seems slower and I am looking for a more efficient way to do this.

Thanks

2016-04-25 06:27:34 -0600 commented question CvMat vs cv::Mat data pointer

@berak,

  • The CvMat* Y is actually a 2x1 measurement matrix used for Kalman correction cv::KalmanFilter::correct(Y) and I need to set the two values of the Y matrix with a and b (which I know realize can be set simply by Y(0) = (float)a and Y(1) = float(b) ).

  • Thanks for the suggestion. Removed the pointers.

  • I am now using Mat::at<float>(r) notation to access the values of Mat correction returned by cv::KalmanFilter::correct(Y).

  • Solved my problem. Thanks!
2016-04-22 02:12:47 -0600 asked a question CvMat vs cv::Mat data pointer

Hi,

I am trying to convert some code using CvMat to cv::Mat, but I cannot seem to figure out how to access the float* fl field present in data union of CvMat using cv::Mat. For example,

CvMat* Y; 
Y->data.fl[0] = (float)(a);
Y->data.fl[1] = (float)(b);

how to convert the above code if Y is cv::Mat?

 cv::Mat* Y; 
 Y->data.fl[0] = (float)(a);         //data is a pointer instead of a union
 Y->data.fl[1] = (float)(b);

I think I will have to use double index in cv::Mat case such as data[x][y]. But how to decide the values of x and y using .fl[i] index.

Thanks!

2016-02-24 01:06:54 -0600 asked a question VideoCapture get, set FPS property for camera on Windows

Hi,

I am using OpenCV(3.0.0) on Windows 7 with a USB camera. I need to get and set the fps of the connected camera but CV_CAP_PROP_FPS does not seem to work for my camera.

Now I know that we cannot set and get a VideoCapture property if it is not supported by the connected camera (Unfortunately I do not know the manufacturer of my camera). I searched for the problem and found out that there is a solution for Ubuntu as reported here. I was wondering if a similar solution exits for Windows?

Thanks.

2016-01-25 23:44:54 -0600 received badge  Editor (source)
2016-01-25 23:10:21 -0600 asked a question cvcam properties in VideoCapture

Hi,

I know cvcam has long been replaced by the VideoCapture class and a lot of the properties available in cvcam can not be found in VideoCapture, for example:

cvcamSetProperty(desiredCam, CVCAM_RNDWIDTH, &w);
cvcamSetProperty(desiredCam, CVCAM_RNDHEIGHT, &h);

the above instructions set the rendering width and height of the desiredCam. What are their alternatives in VideoCapture class? Are they simply CAP_PROP_FRAME_WIDTH and CAP_PROP_FRAME_HEIGHT?

Similarly, cvcamGetCamerasCount(), cvcamInit(), cvcamStart() etc are not available in VideoCapture.

I am asking this because I have a large openCV code which was written way back and contains many outdated APIs. What would be some good sources to get the alternatives/correspondence between new and old APIs?

Thanks.

2016-01-25 07:24:55 -0600 marked best answer OpenCV 3.0.0 - process new frame callback

Hi, I am trying to implement an algorithm which requires processing a new frame as soon as it is available from the camera. The polling method cannot be used because a lot of serial commands are to be sent after processing. Rather I want to use some interrupt based method which notifies me as a new frame becomes available. I've heard that Callback function based implementation was present in OpenCV beta 5 release which would be called automatically on the arrival of a new frame and then I could implement the processing algorithm in that callback, but I can't find it in the 3.0.0. Is anything of such sort available in 3.0.0?

I have searched for the problem and found this link:link but it is fairly old.

So my question is whether such callback functionality is available in 3.0.0 or should I use some other method like multi threading?

I am sorry if I can't explain it very well. I am fairly new to openCV. Please feel free to ask if any additional information is required.

Thanks.