Ask Your Question

mhaghighat's profile - activity

2019-10-17 23:32:59 -0600 received badge  Necromancer (source)
2018-07-12 17:44:14 -0600 edited answer clear ROI history from kcf tracking in opencv

You can release the old tracker and create a new tracker and initiate it with your new ROI. That is: tracker.release();

2018-07-10 17:22:27 -0600 answered a question Does OpenCV blobFromImage preserve the aspect ratio of the input image?

It seems it does not preserve the aspect ratio: https://github.com/opencv/opencv/blob/9e1b1e5389237c2b9f6c7b9d7715d9836c

2018-06-25 13:37:28 -0600 marked best answer Should I release cv::Ptr before reassigning?

Say, I have a

cv::Ptr<cv::backgroundsubtractormog2> mogPtr = cv::createBackgroundSubtractorMOG2(300, 16, true);

Later, I'd like to change the configuration of the background subtractor, but I want to reassign the new object pointer to the same variable (mogPtr):

mogPtr = cv::createBackgroundSubtractorMOG2(300, 64, false);

I wonder if I should release the mogPtr before I assign a new pointer to it. Is it a bad idea if I do? Will there be a memory leak if I don't?

2018-06-14 14:36:37 -0600 edited question Should I release cv::Ptr before reassigning?

Should I release cv::Ptr before reassigning? Say, I have a cv::Ptr<cv::backgroundsubtractormog2> mogPtr = cv:

2018-06-14 14:36:23 -0600 edited question Should I release cv::Ptr before reassigning?

Should I release cv::Ptr before reassigning? Say, I have a cv::Ptr<cv::backgroundsubtractormog2> mogPtr = cv:

2018-06-14 14:29:36 -0600 asked a question Should I release cv::Ptr before reassigning?

Should I release cv::Ptr before reassigning? Say, I have a cv::Ptr<cv::backgroundsubtractormog2> mogPtr= cv::

2018-06-12 11:34:14 -0600 commented question Does OpenCV blobFromImage preserve the aspect ratio of the input image?

So, it does not preserve the aspect ratio. Thanks a lot.

2018-06-12 11:12:56 -0600 asked a question Does OpenCV blobFromImage preserve the aspect ratio of the input image?

Does OpenCV blobFromImage preserve the aspect ratio of the input image? I wonder if the cv::blobFromImage() preserves th

2018-05-30 10:55:00 -0600 commented answer patent - FACE RECOGNITION

What about OpenFace?

2018-04-05 16:37:38 -0600 answered a question Failure to import cv2 in python : DLL load failed.

The issue is due to the missing python3.dll file in Anaconda3. To fix the issue, you should simply copy the python3.dl

2018-01-05 10:41:13 -0600 edited question CMake Build Error OpenCV 3.4.0

CMake Build Error OpenCV 3.4.0 System information: OpenCV => 3.4.0 Operating System / Platform => Windows 7 (64

2018-01-05 10:37:09 -0600 received badge  Editor (source)
2018-01-05 10:37:09 -0600 edited question CMake Build Error OpenCV 3.4.0

CMake Build Error OpenCV 3.4.0 System information: OpenCV => 3.4.0 Operating System / Platform => Windows 7 (64

2018-01-04 17:41:39 -0600 asked a question CMake Build Error OpenCV 3.4.0

CMake Build Error OpenCV 3.4.0 System information: OpenCV => 3.4.0 Operating System / Platform => Windows 7 (64

2017-11-07 16:00:20 -0600 answered a question how to find correlation coefficient for two images?

Assuming both image1 and image2 are the same size: float correlation(cv::Mat &image1, cv::Mat &image2) { c

2017-11-07 14:40:52 -0600 commented answer how to find correlation coefficient for two images?

Why do you have to convert the input images to float?

2017-11-03 18:43:09 -0600 received badge  Necromancer (source)
2017-11-03 14:31:39 -0600 answered a question BORDER_REFLECT vs. BORDER_REFLECT_101

cv2.BORDER_REFLECT - Border will be mirror reflection of the border elements, like this : fedcba|abcdefgh|hgfedcb cv2.

2017-09-11 19:06:27 -0600 answered a question clear ROI history from kcf tracking in opencv

You can release the old tracker and create a new tracker and initiate it with your new ROI. That is: tracker.release();

2017-07-25 19:31:05 -0600 commented question What is a valid/invalid ROI for OpenCV tracker?

p was a nullptr!

2017-07-24 18:05:41 -0600 asked a question What is a valid/invalid ROI for OpenCV tracker?

I run a KCF tracker over the frames of a video in which an object appears from an arbitrary corner and moves towards another arbitrary corner and exits the frame region. The tracker is supposed to follow this object all along.

It works pretty well most of the times, but sometimes it crashes when the object's region of interest (ROI) falls out of the valid frame region, i.e., the rectangle between (0,0) and (frame.size().width-1, frame.size().height-1).

It works fine most of the times even when half of the ROI is out of the valid frame region, and it keeps tracking the object when it returns to the valid region. However, sometimes, it crashes when the ROI goes over the invalid region. Since the crash happens rarely, I don't want to impose conditions to terminate the tracker as soon as the ROI touches an invalid region, but I don't want the crash either.

I couldn't find any documentation stating the termination rule of the cv::Tracker. I wonder if anyone knows what is an acceptable ROI and what is not!e ROI and what is not!

2017-03-22 05:46:31 -0600 received badge  Necromancer (source)
2017-03-21 18:29:24 -0600 answered a question How to remove detected shadows from foreground image using Background Subtraction MOG2

Try this:

cv::Ptr<cv::BackgroundSubtractorMOG2> pMOG2 = cv::createBackgroundSubtractorMOG2();
cv::Mat fgMask;  // Foreground mask

// Update the background model and get the foreground mask
pMOG2->apply(frame, fgMask);

// Blur the foreground mask to reduce the effect of noise and false positives
cv::blur(fgMask, fgMask, cv::Size(15, 15), cv::Point(-1, -1));

// Remove the shadow parts and the noise
cv::threshold(fgMask, fgMask, 128, 255, cv::THRESH_BINARY);
2017-03-10 13:09:00 -0600 received badge  Scholar (source)
2017-03-09 19:24:33 -0600 asked a question OpenCV (C++) - whitenning transformation on a color image

Is there a built-in function to apply a whitening transformation on a cv::Mat with 3 channels? I want the image to have a zero mean and a unit variance.

2016-09-29 11:33:35 -0600 received badge  Enthusiast
2016-09-28 17:53:18 -0600 commented question OpenCV for Windows (2.4.1): Cuda-enabled app won't load on non-nVidia systems

I am having a similar problem, it tries to open file 'opencv_cudaobjdetect310.lib', which does not exist in my non-NVIDIA machine. However, I don't know how to disable this call.

2016-08-31 22:41:40 -0600 answered a question Error with createBackgroundSubtractor with OpenCV 3.1 and extra module contrib

If you want the MOG to work, you should

#include "opencv2/bgsegm.hpp"

and then

pMOG = bgsegm::createBackgroundSubtractorMOG();
2016-08-31 22:41:40 -0600 answered a question background detection tutorial: error using MOG pointers

If you want the MOG to work, you should

#include "opencv2/bgsegm.hpp"

and then

pMOG = bgsegm::createBackgroundSubtractorMOG();
2016-08-19 13:59:19 -0600 received badge  Supporter (source)