Merge pull request #15764 from ChipKerchner:demosaicingToHal
[platform/upstream/opencv.git] / doc / faq.markdown
1 Frequently Asked Questions {#faq}
2 ==========================
3
4 -   **What is InputArray?**
5
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?
8
9
10     This is the proxy class for passing read-only input arrays into OpenCV functions.
11
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.