Ask Your Question

dma's profile - activity

2018-01-01 01:04:43 -0500 received badge  Necromancer (source)
2017-02-02 17:47:12 -0500 asked a question xphoto/ color balance sample - problem with learn_color_balance.py

Hi,

I am trying to make the color balance sample (opencv extra modules, rebuilt from opencv 3.x head) working. but I have no luck while running the learn_color_balance.py python script, as I get:

python learn_color_balance.py -i png -g groundtruth/real_illum_568..mat -r 0,378 --num_trees 30 --max_tree_depth 6 --num_augmented 0 Traceback (most recent call last): File "learn_color_balance.py", line 250, in <module> inst = cv2.xphoto.createLearningBasedWB() AttributeError: 'module' object has no attribute 'xphoto'

I am not using python usually, so it might be a configuration problem I suppose. any help appreciated.

2014-02-18 12:35:43 -0500 commented question Watershed on gray image

I agree this is annoying - even if you can add 2 dummy channels.

2014-02-18 11:43:26 -0500 answered a question Is it normal a HSV image looks like this?

Bah..they do not look like the original picture because you display the HSV as if it was RGB that's all. But HSV is a better model to 'separate' perceptually the colors (then separate your objects). once your objects are separated, apply inverse color conversion to get the original color.

2013-12-12 18:08:02 -0500 answered a question Finding homography matrix

I see nothing obvious wrong with your code RANSAC tries to find an homography given a set of matches, and use a probalistic algorihm, sometimes it gives bad homographies, you need reject them and retry... (see "good result or bad result for findHomography" post).

2013-12-12 17:48:26 -0500 received badge  Editor (source)
2013-12-12 17:44:14 -0500 answered a question good result or bad result for findHomography

My understanding concerning :

  1. "Compute the determinant of the homography, and see if it's too close to zero for comfort."

Compute the determinant of the top left 2x2 homography matrix, and check if it's "too close" to zero for comfort...btw you can also check if it's *too *far from zero because then the invert matrix would have a determinant too close to zero. A determinant of zero would mean the matrix is not inversible, too close to zero would mean *singular (like you see the plane object at 90°, which is almost impossible if you use *good matches).

const double det = H.at<double>(0, 0) * H.at<double>(1, 1) - H.at<double>(1, 0) * H.at<double>(0, 1);

One way to do it would be to specify a positive value, higher than 1, say N, and then:

if((fabs(det)>(double)N) || (fabs(det)<(1.0/(double)N)) return false; // bad homography

And while we are at it...if det<0 the homography is not conserving the orientation (clockwise<->anticlockwise), except if you are watching the object in a mirror...it is certainly not good (plus the sift/surf descriptors are not done to be mirror invariants as far as i know, so you would probably don'thave good maches).

if(det<0) return false; // no mirrors in the scene

/* for reading & reference : [Detecting Planar Homographies in an Image Pair Etienne Vincent and Robert Laganiere School of Information Technology and Engineering University of Ottawa Canada K1N 6N5] */