{"action":"created","comment":{"url":"https://api.github.com/repos/poparteu/openMVG/pulls/comments/74612084","id":74612084,"diff_hunk":"@@ -0,0 +1,188 @@\n+#include \"openMVG/calibration/calibration.hpp\"\n+\n+#include <ctime>\n+#include <algorithm>\n+#include <iostream>\n+\n+namespace openMVG {\n+namespace calibration {\n+\n+static double computeReprojectionErrors(\n+                                        const std::vector<std::vector<cv::Point3f> >& objectPoints,\n+                                        const std::vector<std::vector<cv::Point2f> >& imagePoints,\n+                                        const std::vector<cv::Mat>& rvecs, const std::vector<cv::Mat>& tvecs,\n+                                        const cv::Mat& cameraMatrix, const cv::Mat& distCoeffs,\n+                                        std::vector<float>& perViewErrors)\n+{\n+  std::vector<cv::Point2f> imagePoints2;\n+  int i, totalPoints = 0;\n+  double err, totalErr = 0;\n+  perViewErrors.resize(objectPoints.size());\n+\n+  for (i = 0; i < (int) objectPoints.size(); i++)\n+  {\n+    cv::projectPoints(cv::Mat(objectPoints[i]), rvecs[i], tvecs[i],\n+                      cameraMatrix, distCoeffs, imagePoints2);\n+    err = cv::norm(cv::Mat(imagePoints[i]), cv::Mat(imagePoints2), CV_L2);\n+    int n = (int) objectPoints[i].size();\n+    perViewErrors[i] = (float) std::sqrt(err * err / n);\n+    totalErr += err*err;\n+    totalPoints += n;\n+  }\n+  return std::sqrt(totalErr / totalPoints);\n+}\n+\n+static bool runCalibration(const std::vector<std::vector<cv::Point2f> >& imagePoints,\n+                           const std::vector<std::vector<cv::Point3f> >& objectPoints,\n+                           cv::Size imageSize,","path":"src/openMVG/calibration/calibration.cpp","position":37,"original_position":37,"commit_id":"1bd5ce13efab10c8e0b9e4430b6e93e15156d5e8","original_commit_id":"1bd5ce13efab10c8e0b9e4430b6e93e15156d5e8","user":{"login":"simogasp","id":1331744,"avatar_url":"https://avatars.githubusercontent.com/u/1331744?v=3","gravatar_id":"","url":"https://api.github.com/users/simogasp","html_url":"https://github.com/simogasp","followers_url":"https://api.github.com/users/simogasp/followers","following_url":"https://api.github.com/users/simogasp/following{/other_user}","gists_url":"https://api.github.com/users/simogasp/gists{/gist_id}","starred_url":"https://api.github.com/users/simogasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simogasp/subscriptions","organizations_url":"https://api.github.com/users/simogasp/orgs","repos_url":"https://api.github.com/users/simogasp/repos","events_url":"https://api.github.com/users/simogasp/events{/privacy}","received_events_url":"https://api.github.com/users/simogasp/received_events","type":"User","site_admin":false},"body":"`const cv::Size& imageSize`","created_at":"2016-08-12T15:38:47Z","updated_at":"2016-08-12T15:38:47Z","html_url":"https://github.com/poparteu/openMVG/pull/186#discussion_r74612084","pull_request_url":"https://api.github.com/repos/poparteu/openMVG/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/poparteu/openMVG/pulls/comments/74612084"},"html":{"href":"https://github.com/poparteu/openMVG/pull/186#discussion_r74612084"},"pull_request":{"href":"https://api.github.com/repos/poparteu/openMVG/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/poparteu/openMVG/pulls/186","id":77816411,"html_url":"https://github.com/poparteu/openMVG/pull/186","diff_url":"https://github.com/poparteu/openMVG/pull/186.diff","patch_url":"https://github.com/poparteu/openMVG/pull/186.patch","issue_url":"https://api.github.com/repos/poparteu/openMVG/issues/186","number":186,"state":"open","locked":false,"title":"[software] camera calibration","user":{"login":"QGimac","id":9058825,"avatar_url":"https://avatars.githubusercontent.com/u/9058825?v=3","gravatar_id":"","url":"https://api.github.com/users/QGimac","html_url":"https://github.com/QGimac","followers_url":"https://api.github.com/users/QGimac/followers","following_url":"https://api.github.com/users/QGimac/following{/other_user}","gists_url":"https://api.github.com/users/QGimac/gists{/gist_id}","starred_url":"https://api.github.com/users/QGimac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QGimac/subscriptions","organizations_url":"https://api.github.com/users/QGimac/orgs","repos_url":"https://api.github.com/users/QGimac/repos","events_url":"https://api.github.com/users/QGimac/events{/privacy}","received_events_url":"https://api.github.com/users/QGimac/received_events","type":"User","site_admin":false},"body":"- [x] support image sequences\r\n- [x] support folder\r\n- [x] support image sequences \r\n- [x] support step (only use a subset of images)\r\n- [x] Recursive refinement & selection of best images based on reprojection error\r\n- [x] Recursive refinement & selection of best images based on reprojection error & distribution in images","created_at":"2016-07-18T14:22:54Z","updated_at":"2016-08-12T15:38:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e783fa2294c7e3442e4abffe3e00a5881cf48e9f","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/poparteu/openMVG/milestones/14","html_url":"https://github.com/poparteu/openMVG/milestones/2016_08","labels_url":"https://api.github.com/repos/poparteu/openMVG/milestones/14/labels","id":1812937,"number":14,"title":"2016_08","description":"","creator":{"login":"simogasp","id":1331744,"avatar_url":"https://avatars.githubusercontent.com/u/1331744?v=3","gravatar_id":"","url":"https://api.github.com/users/simogasp","html_url":"https://github.com/simogasp","followers_url":"https://api.github.com/users/simogasp/followers","following_url":"https://api.github.com/users/simogasp/following{/other_user}","gists_url":"https://api.github.com/users/simogasp/gists{/gist_id}","starred_url":"https://api.github.com/users/simogasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simogasp/subscriptions","organizations_url":"https://api.github.com/users/simogasp/orgs","repos_url":"https://api.github.com/users/simogasp/repos","events_url":"https://api.github.com/users/simogasp/events{/privacy}","received_events_url":"https://api.github.com/users/simogasp/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":15,"state":"open","created_at":"2016-06-07T08:43:54Z","updated_at":"2016-08-11T17:18:42Z","due_on":"2016-08-31T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/poparteu/openMVG/pulls/186/commits","review_comments_url":"https://api.github.com/repos/poparteu/openMVG/pulls/186/comments","review_comment_url":"https://api.github.com/repos/poparteu/openMVG/pulls/comments{/number}","comments_url":"https://api.github.com/repos/poparteu/openMVG/issues/186/comments","statuses_url":"https://api.github.com/repos/poparteu/openMVG/statuses/1bd5ce13efab10c8e0b9e4430b6e93e15156d5e8","head":{"label":"poparteu:dev_lensCalibration","ref":"dev_lensCalibration","sha":"1bd5ce13efab10c8e0b9e4430b6e93e15156d5e8","user":{"login":"poparteu","id":9333123,"avatar_url":"https://avatars.githubusercontent.com/u/9333123?v=3","gravatar_id":"","url":"https://api.github.com/users/poparteu","html_url":"https://github.com/poparteu","followers_url":"https://api.github.com/users/poparteu/followers","following_url":"https://api.github.com/users/poparteu/following{/other_user}","gists_url":"https://api.github.com/users/poparteu/gists{/gist_id}","starred_url":"https://api.github.com/users/poparteu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poparteu/subscriptions","organizations_url":"https://api.github.com/users/poparteu/orgs","repos_url":"https://api.github.com/users/poparteu/repos","events_url":"https://api.github.com/users/poparteu/events{/privacy}","received_events_url":"https://api.github.com/users/poparteu/received_events","type":"Organization","site_admin":false},"repo":{"id":28635894,"name":"openMVG","full_name":"poparteu/openMVG","owner":{"login":"poparteu","id":9333123,"avatar_url":"https://avatars.githubusercontent.com/u/9333123?v=3","gravatar_id":"","url":"https://api.github.com/users/poparteu","html_url":"https://github.com/poparteu","followers_url":"https://api.github.com/users/poparteu/followers","following_url":"https://api.github.com/users/poparteu/following{/other_user}","gists_url":"https://api.github.com/users/poparteu/gists{/gist_id}","starred_url":"https://api.github.com/users/poparteu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poparteu/subscriptions","organizations_url":"https://api.github.com/users/poparteu/orgs","repos_url":"https://api.github.com/users/poparteu/repos","events_url":"https://api.github.com/users/poparteu/events{/privacy}","received_events_url":"https://api.github.com/users/poparteu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/poparteu/openMVG","description":"open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion.","fork":true,"url":"https://api.github.com/repos/poparteu/openMVG","forks_url":"https://api.github.com/repos/poparteu/openMVG/forks","keys_url":"https://api.github.com/repos/poparteu/openMVG/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poparteu/openMVG/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poparteu/openMVG/teams","hooks_url":"https://api.github.com/repos/poparteu/openMVG/hooks","issue_events_url":"https://api.github.com/repos/poparteu/openMVG/issues/events{/number}","events_url":"https://api.github.com/repos/poparteu/openMVG/events","assignees_url":"https://api.github.com/repos/poparteu/openMVG/assignees{/user}","branches_url":"https://api.github.com/repos/poparteu/openMVG/branches{/branch}","tags_url":"https://api.github.com/repos/poparteu/openMVG/tags","blobs_url":"https://api.github.com/repos/poparteu/openMVG/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poparteu/openMVG/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poparteu/openMVG/git/refs{/sha}","trees_url":"https://api.github.com/repos/poparteu/openMVG/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poparteu/openMVG/statuses/{sha}","languages_url":"https://api.github.com/repos/poparteu/openMVG/languages","stargazers_url":"https://api.github.com/repos/poparteu/openMVG/stargazers","contributors_url":"https://api.github.com/repos/poparteu/openMVG/contributors","subscribers_url":"https://api.github.com/repos/poparteu/openMVG/subscribers","subscription_url":"https://api.github.com/repos/poparteu/openMVG/subscription","commits_url":"https://api.github.com/repos/poparteu/openMVG/commits{/sha}","git_commits_url":"https://api.github.com/repos/poparteu/openMVG/git/commits{/sha}","comments_url":"https://api.github.com/repos/poparteu/openMVG/comments{/number}","issue_comment_url":"https://api.github.com/repos/poparteu/openMVG/issues/comments{/number}","contents_url":"https://api.github.com/repos/poparteu/openMVG/contents/{+path}","compare_url":"https://api.github.com/repos/poparteu/openMVG/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poparteu/openMVG/merges","archive_url":"https://api.github.com/repos/poparteu/openMVG/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poparteu/openMVG/downloads","issues_url":"https://api.github.com/repos/poparteu/openMVG/issues{/number}","pulls_url":"https://api.github.com/repos/poparteu/openMVG/pulls{/number}","milestones_url":"https://api.github.com/repos/poparteu/openMVG/milestones{/number}","notifications_url":"https://api.github.com/repos/poparteu/openMVG/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poparteu/openMVG/labels{/name}","releases_url":"https://api.github.com/repos/poparteu/openMVG/releases{/id}","deployments_url":"https://api.github.com/repos/poparteu/openMVG/deployments","created_at":"2014-12-30T15:39:27Z","updated_at":"2016-08-10T11:18:00Z","pushed_at":"2016-08-12T15:12:43Z","git_url":"git://github.com/poparteu/openMVG.git","ssh_url":"git@github.com:poparteu/openMVG.git","clone_url":"https://github.com/poparteu/openMVG.git","svn_url":"https://github.com/poparteu/openMVG","homepage":"","size":24955,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":52,"forks":2,"open_issues":52,"watchers":3,"default_branch":"popart_develop"}},"base":{"label":"poparteu:popart_develop","ref":"popart_develop","sha":"0eadbd2ba505842def5b121fa64ebc1f1666da34","user":{"login":"poparteu","id":9333123,"avatar_url":"https://avatars.githubusercontent.com/u/9333123?v=3","gravatar_id":"","url":"https://api.github.com/users/poparteu","html_url":"https://github.com/poparteu","followers_url":"https://api.github.com/users/poparteu/followers","following_url":"https://api.github.com/users/poparteu/following{/other_user}","gists_url":"https://api.github.com/users/poparteu/gists{/gist_id}","starred_url":"https://api.github.com/users/poparteu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poparteu/subscriptions","organizations_url":"https://api.github.com/users/poparteu/orgs","repos_url":"https://api.github.com/users/poparteu/repos","events_url":"https://api.github.com/users/poparteu/events{/privacy}","received_events_url":"https://api.github.com/users/poparteu/received_events","type":"Organization","site_admin":false},"repo":{"id":28635894,"name":"openMVG","full_name":"poparteu/openMVG","owner":{"login":"poparteu","id":9333123,"avatar_url":"https://avatars.githubusercontent.com/u/9333123?v=3","gravatar_id":"","url":"https://api.github.com/users/poparteu","html_url":"https://github.com/poparteu","followers_url":"https://api.github.com/users/poparteu/followers","following_url":"https://api.github.com/users/poparteu/following{/other_user}","gists_url":"https://api.github.com/users/poparteu/gists{/gist_id}","starred_url":"https://api.github.com/users/poparteu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poparteu/subscriptions","organizations_url":"https://api.github.com/users/poparteu/orgs","repos_url":"https://api.github.com/users/poparteu/repos","events_url":"https://api.github.com/users/poparteu/events{/privacy}","received_events_url":"https://api.github.com/users/poparteu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/poparteu/openMVG","description":"open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion.","fork":true,"url":"https://api.github.com/repos/poparteu/openMVG","forks_url":"https://api.github.com/repos/poparteu/openMVG/forks","keys_url":"https://api.github.com/repos/poparteu/openMVG/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poparteu/openMVG/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poparteu/openMVG/teams","hooks_url":"https://api.github.com/repos/poparteu/openMVG/hooks","issue_events_url":"https://api.github.com/repos/poparteu/openMVG/issues/events{/number}","events_url":"https://api.github.com/repos/poparteu/openMVG/events","assignees_url":"https://api.github.com/repos/poparteu/openMVG/assignees{/user}","branches_url":"https://api.github.com/repos/poparteu/openMVG/branches{/branch}","tags_url":"https://api.github.com/repos/poparteu/openMVG/tags","blobs_url":"https://api.github.com/repos/poparteu/openMVG/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poparteu/openMVG/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poparteu/openMVG/git/refs{/sha}","trees_url":"https://api.github.com/repos/poparteu/openMVG/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poparteu/openMVG/statuses/{sha}","languages_url":"https://api.github.com/repos/poparteu/openMVG/languages","stargazers_url":"https://api.github.com/repos/poparteu/openMVG/stargazers","contributors_url":"https://api.github.com/repos/poparteu/openMVG/contributors","subscribers_url":"https://api.github.com/repos/poparteu/openMVG/subscribers","subscription_url":"https://api.github.com/repos/poparteu/openMVG/subscription","commits_url":"https://api.github.com/repos/poparteu/openMVG/commits{/sha}","git_commits_url":"https://api.github.com/repos/poparteu/openMVG/git/commits{/sha}","comments_url":"https://api.github.com/repos/poparteu/openMVG/comments{/number}","issue_comment_url":"https://api.github.com/repos/poparteu/openMVG/issues/comments{/number}","contents_url":"https://api.github.com/repos/poparteu/openMVG/contents/{+path}","compare_url":"https://api.github.com/repos/poparteu/openMVG/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poparteu/openMVG/merges","archive_url":"https://api.github.com/repos/poparteu/openMVG/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poparteu/openMVG/downloads","issues_url":"https://api.github.com/repos/poparteu/openMVG/issues{/number}","pulls_url":"https://api.github.com/repos/poparteu/openMVG/pulls{/number}","milestones_url":"https://api.github.com/repos/poparteu/openMVG/milestones{/number}","notifications_url":"https://api.github.com/repos/poparteu/openMVG/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poparteu/openMVG/labels{/name}","releases_url":"https://api.github.com/repos/poparteu/openMVG/releases{/id}","deployments_url":"https://api.github.com/repos/poparteu/openMVG/deployments","created_at":"2014-12-30T15:39:27Z","updated_at":"2016-08-10T11:18:00Z","pushed_at":"2016-08-12T15:12:43Z","git_url":"git://github.com/poparteu/openMVG.git","ssh_url":"git@github.com:poparteu/openMVG.git","clone_url":"https://github.com/poparteu/openMVG.git","svn_url":"https://github.com/poparteu/openMVG","homepage":"","size":24955,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":52,"forks":2,"open_issues":52,"watchers":3,"default_branch":"popart_develop"}},"_links":{"self":{"href":"https://api.github.com/repos/poparteu/openMVG/pulls/186"},"html":{"href":"https://github.com/poparteu/openMVG/pull/186"},"issue":{"href":"https://api.github.com/repos/poparteu/openMVG/issues/186"},"comments":{"href":"https://api.github.com/repos/poparteu/openMVG/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/poparteu/openMVG/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/poparteu/openMVG/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/poparteu/openMVG/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/poparteu/openMVG/statuses/1bd5ce13efab10c8e0b9e4430b6e93e15156d5e8"}}}}
{"actor":{"display_login":"simogasp"}}