Skip to content

Commit e80766a

Browse files
committed
Merge pull request opencv#9419 from sturkmen72:patch-1
2 parents 25a4559 + ea4bcad commit e80766a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

doc/faq.markdown

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
Frequently Asked Questions {#faq}
22
==========================
33

4-
- Q: Example question?
4+
- **What is InputArray?**
55

6-
A: Example answer
6+
It can be seen that almost all OpenCV functions receive InputArray type.
7+
What is it, and how can I understand the actual input types of parameters?
78

89

9-
- Q: Example question?
10+
This is the proxy class for passing read-only input arrays into OpenCV functions.
1011

11-
A: Example answer
12+
Inside a function you should use cv::_InputArray::getMat() method to construct
13+
a matrix header for the array (without copying data). cv::_InputArray::kind() can be used to distinguish Mat from vector<> etc.
14+
but normally it is not needed.
15+
16+
for more information see cv::_InputArray
17+
18+
- **Which is more efficient, use contourArea() or count number of ROI non-zero pixels?**
19+
20+
In a case where you only want relative areas, which one is faster to compute:
21+
calculate a contour area or count the number of ROI non-zero pixels?
22+
23+
cv::contourArea() uses Green formula (http://en.wikipedia.org/wiki/Green's_theorem) to compute the area, therefore its complexity is O(contour_number_of_vertices). Counting non-zero pixels in the ROI is O(roi_width*roi_height) algorithm, i.e. much slower. Note, however, that because of finite, and quite low, resolution of the raster grid, the two algorithms will give noticeably different results. For large and square-like contours the error will be minimal. For small and/or oblong contours the error can be quite large.

0 commit comments

Comments
 (0)