Ask Your Question

cvi's profile - activity

2016-08-18 08:33:29 -0500 commented question Background subtractor - automatically ignore always-changing area

@LBerger yeah, I was hoping to have it not require manual intervention or be subject to issues if moved slightly

2016-08-18 07:43:48 -0500 asked a question Background subtractor - automatically ignore always-changing area

Is there a way to have a background subtractor automatically ignore an area of the video that is always changing such as an LED screen so that doesn't constantly show as foreground?

2016-08-18 03:22:51 -0500 received badge  Supporter (source)
2016-08-13 15:31:47 -0500 commented question Video artifacts (noise?) - how to reduce effect on foreground detection

@LBerger - I haven't. I'll give that a try and see how it does. Is setVarThresholdGen of any value? The documentation has so little explanation as to what each thing does. Thanks

2016-08-13 01:35:25 -0500 asked a question Video artifacts (noise?) - how to reduce effect on foreground detection

I'm using MOG2 background subtraction with the default settings and what I'm assuming is noise in the video feed gets registered as foreground. I've eliminated much of the effects of this using a slight initial gaussian blur and also bhy applying a couple of morphologies after the mask is created, but I'm wondering what the best approach is to this.

Here's what a small piece of the RAW video looks like (NOTE: it may appear zoomed in when you play it) https://drive.google.com/file/d/0B5Ks...

2016-08-07 22:44:50 -0500 received badge  Editor (source)
2016-08-07 22:27:33 -0500 asked a question Camera exposure returning -6.0 regardless of actual exposure

The following code always prints -6.0 regardless of if the camera is pointing at something bright or something dark. Any ideas why it's doing this and how to fix it?

I tried the laptop-integrated Dell webcam and it always outputs 71761848.0

However, when I tried a Logitech camera the number did change (ranged from -10.0 to -3.0) depending how bright / dark the scene was.

cap = cv2.VideoCapture(0)
while(1):
    ret, image = cap.read()
    print(str(cap.get(cv2.CAP_PROP_EXPOSURE)))

This is on Windows 10 running OpenCV 3.1.

2016-08-07 13:36:09 -0500 asked a question Detect faces more accurately in ~180 degree fisheye camera image by correcting first

With a fisheye lens that's about 180 degrees, the goal is to help ensure the best accuracy in detecting the presence of faces (especially near the edges) by first undistorting the image. I understand it's unrealistic to expect to be able to do it super close to the edges since it's 180 degrees, but I'd like to at least get relatively close.

In OpenCV (v3.1 if that matters), I tried to use calibrate.py to do this. While it can detect the checkerboard pattern in a lot of the calibration images I took, it has trouble with ones where the distortion is more extreme. The end result was that it provided a camera matrix and distortion coefficients that correct the center fairly well, but don't do too much about the edges.

Is there some straightforward way to manually tweak the matrices to get the desired correction or is there another good approach to this? I am hoping for an intuitive way to tweak the numbers to do it qualitatively without having to understand it much from a math standpoint.

What I got from calibrate.py is a camera matrix of

[[537.04, 0, 961.19], [0, 536.42 , 506.01], [0, 0, 1]]

and distortion coefficients of

[-2.897e-01, 7.527e-02, 0, 0, 0]

This takes an image like this (shown here at 25% size):

image description

And corrects it to something like

image description

This is certainly better than nothing, but not quite the desired level of correction.

In case it's helpful, here's the code to undistort the image (OpenCV 3.1 + Python 2.7). NOTE: this expects the images to be sized at 1920x1080 (i.e. the native resolution of the camera)

import cv2
import numpy as np
cammatrix = np.array([[537.04, 0, 961.19], [0, 536.42 , 506.01], [0, 0, 1]])
distcoeffs = np.array([-2.897e-01, 7.527e-02, 0, 0, 0])
image = cv2.imread("PATH_TO_IMAGE.jpg")
h,w = image.shape[:2]
newcam,roi = cv2.getOptimalNewCameraMatrix(cammatrix, distcoeffs, (w,h), 1) 
newimage = cv2.undistort(image, cammatrix, distcoeffs, None, newcam)
cv2.imshow("Orig Image", image)
cv2.imshow("Image", newimage)
cv2.waitKey(0)