Improve readability of InputArray type arg-s in func-s signature (Feature #2518)


Added by Andrey Pavlenko over 12 years ago. Updated over 9 years ago.


Status:Open Start date:
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:3.0
Difficulty: Pull request:

Description

[from ECCV-2012 / Mobile OpenCV tutorial / wishlist brainstorm]
Some of OpenCV functions ( e.g. cv::add() ) accepts input arg-s of almost any types, so InputArray works like a charm here.
But there are some others that expect InputArray-s of particular type(s) only, and use of InputArray type for input arg-s here complicates their usage. Examples:

  • findHomography: the InputArray srcPoints, InputArray dstPoints are expected to be 2D points vector, i.e. std::vector<Point2{i,f,d}>, Mat 1xN or Nx1 CV_{32S,32F,64F}C2
  • convexityDefects: the InputArray _points is expected to be std::vector<Point2i>, Mat 1xN or Nx1 CV_32SC2
  • calcOpticalFlowPyrLK:
    • InputArray prevImg, InputArray nextImg are expected to be gray-scale images (8UC1) or pyramid (std::vector<Mat>)
    • InputArray prevPts, CV_OUT InputOutputArray nextPts are expected to be Point2f vector
      and etc.
      Even for cv::add() the InputArray src2 can be not only image but cv::Scalar as well!

The suggestion is to define a set of typedef-s that will help to understand what is expected and use them in signatures.

The potential candidates for the improvement are:
  1. randu
  2. randn
  3. inRange
  4. goodFeaturesToTrack
  5. findFundamentalMat
  6. cornerSubPix
  7. minEnclosingCircle
  8. findHomography
  9. solvePnP
  10. distCoeffs
  11. solvePnPRansac
  12. distCoeffs
  13. calcOpticalFlowPyrLK
  14. fitEllipse
  15. fillPoly
  16. polylines
  17. fillConvexPoly
  18. boundingRect
  19. approxPolyDP
  20. arcLength
  21. pointPolygonTest
  22. minAreaRect
  23. getAffineTransform
  24. hconcat
  25. vconcat
  26. undistortPoints
  27. checkRange
  28. meanStdDev
  29. drawContours
  30. findContours
  31. convexityDefects
  32. isContourConvex
  33. convexHull
  34. projectPoints
  35. distCoeffs
  36. initCameraMatrix2D
  37. findChessboardCorners
  38. drawChessboardCorners

History

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4449

Also available in: Atom PDF