Ask Your Question

xsmet's profile - activity

2019-05-15 13:38:47 -0600 received badge  Popular Question (source)
2013-05-28 08:00:48 -0600 answered a question Direct Occlusion Culling using OpenCV?

Short answer: no, OpenCV won't help you here.

Perhaps more helpful: have you looked at a Z-buffer algorithm (a.k.a. visible-surface algorithm)? This is a well documented method of calculating which polygons are visible from a given viewpoint, which sounds like what you need.

There are OpenGL implementations available probably, if you want fast GPU processing.

2013-05-27 10:33:27 -0600 received badge  Teacher (source)
2013-05-27 09:47:17 -0600 received badge  Self-Learner (source)
2013-05-27 09:40:41 -0600 received badge  Supporter (source)
2013-05-27 09:40:09 -0600 commented answer Adding Matrices without saturation

About addWeighted(): I was trying to work with integer numbers in [0, 255], and similarly integer numbers in [0, 100*255]. The code would run on an embedded platform, so I tried to do everything with plain 16-bit ints, and I could not tolerate any loss of precision (which might, theoretically, have been possible with CV_32F).

I didn't say that addWeighted() was less efficient, but I meant to say that it can be slightly less accurate.

2013-05-27 09:39:24 -0600 answered a question Adding Matrices without saturation

Both solution work, thanks guys.

The first one (berak's) is more efficient without the conversions.

The second one (Guanta's) gets kudos for allowing the use of operator+ etc., looks better in code.

I also learned about OpenCV accumulator images meanwhile, worth a read for anyone interested.

2013-05-27 09:24:15 -0600 received badge  Scholar (source)
2013-05-23 03:38:13 -0600 asked a question Adding Matrices without saturation

Is it possible to add two matrices (with values in [0, 255]) and store the result in a matrix with values in [0, 510]?

I would be adding up to 100 matrices that way, and want to keep the high precision (which rules out the use of cv::addWeighted()). A 16-bit int per pixel should suffice to contain these values.

I hoped this would work:

Mat A(10, 10, CV_8UC1, 200);
Mat B(10, 10, CV_8UC1, 200);
Mat C(10, 10, CV_32S, 0);
cv::add(A, B, C);

But the values in C are saturated to 255 (rather than value 400 being stored in some 16-bit data type).

Any suggestions are highly appreciated!