{"action":"created","comment":{"url":"https://api.github.com/repos/paparazzi/paparazzi/pulls/comments/70393442","id":70393442,"diff_hunk":"@@ -0,0 +1,274 @@\n+/*\n+ * Copyright (C) Peng Lu\n+ *\n+ * This file is part of paparazzi\n+ *\n+ * paparazzi is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2, or (at your option)\n+ * any later version.\n+ *\n+ * paparazzi is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with paparazzi; see the file COPYING.  If not, see\n+ * <http://www.gnu.org/licenses/>.\n+ */\n+/**\n+ * @file \"modules/computer_vision/opencv_contour.cpp\"\n+ * @author Peng Lu\n+ * \n+ */\n+\n+\n+#include \"opencv_contour.h\"\n+\n+\n+\n+using namespace std;\n+#include <opencv2/core/core.hpp>\n+#include <opencv2/imgproc/imgproc.hpp>\n+using namespace cv;\n+#include \"opencv_image_functions.h\"\n+\n+//------------------------ added by Peng Lu ---------------------------//\n+//#include <opencv2/highgui/highgui.hpp>\n+float distance_est;\n+float d_x, d_y, d_z;\n+//------------------------ added by Peng Lu ---------------------------//\n+\n+\n+\n+///*\n+// YUV in opencv convert to YUV on Bebop\n+void yuv_opencv_to_yuv422(Mat image, char *img, int width, int height)\n+{\n+//Turn the opencv RGB colored image back in a YUV colored image for the drone\n+  for (int row = 0; row < height; row++) {\n+    for (int col = 0; col < width; col++) {\n+      // Extract pixel color from image\n+      cv::Vec3b &c = image.at<cv::Vec3b>(row, col);\n+\n+      // Set image buffer values\n+      int i = row * width + col;\n+      img[2 * i + 1] = c[0]; // y;\n+      img[2 * i] = col % 2 ? c[1] : c[2]; // u or v\n+      //img[2 * i + 1] = 0; // y;\n+      //img[2 * i] = 1; // u or v\n+    }\n+  }\n+}\n+///*\n+void uyvy_opencv_to_yuv_opencv(Mat image, Mat image_in, int width, int height)\n+{\n+//Turn the opencv RGB colored image back in a YUV colored image for the drone\n+  for (int row = 0; row < height; row++) {\n+    for (int col = 0; col < width; col++) {\n+      // Extract pixel color from image\n+      cv::Vec3b &c = image_in.at<cv::Vec3b>(row, col);\n+      cv::Vec3b &c_m1 = image_in.at<cv::Vec3b>(row, col);\n+      cv::Vec3b &c_p1 = image_in.at<cv::Vec3b>(row, col);\n+      if (col > 0)\n+      { cv::Vec3b &c_m1 = image_in.at<cv::Vec3b>(row, col-1);}\n+      if (col < width)\n+      { cv::Vec3b &c_p1 = image_in.at<cv::Vec3b>(row, col+1);}\n+      image.at<cv::Vec3b>(row, col)[0] = c[1] ;\n+      image.at<cv::Vec3b>(row, col)[1] = col % 2 ? c[0] : c_m1[0];\n+      image.at<cv::Vec3b>(row, col)[2] = col % 2 ? c_p1[0] : c[0];\n+\n+    }\n+  }\n+}\n+//*/\n+\n+\n+\n+int find_contour(char *img, int width, int height)\n+{\n+  // Create a new image, using the original bebop image.\n+  Mat M(width, height, CV_8UC2, img); // original\n+  //Mat M(width, height, CV_8UC3, img);\n+  //Mat M(width, height, CV_8UC1, img);\n+  Mat image, edge_image, thresh_image;\n+\n+  // \n+  //blur(image, image, Size(5, 5));\n+  //GaussianBlur(image, image, Size(9,9), 5,5);\n+\n+  // Canny edges, only works with grayscale image\n+  //int edgeThresh = 35;\n+  //Canny(image, image, edgeThresh, edgeThresh * 3);\n+  ","path":"sw/airborne/modules/computer_vision/opencv_contour.cpp","position":104,"original_position":104,"commit_id":"b9c67983cb30cfd47f616b8e43f81fc511eac202","original_commit_id":"b9c67983cb30cfd47f616b8e43f81fc511eac202","user":{"login":"kirkscheper","id":2835523,"avatar_url":"https://avatars.githubusercontent.com/u/2835523?v=3","gravatar_id":"","url":"https://api.github.com/users/kirkscheper","html_url":"https://github.com/kirkscheper","followers_url":"https://api.github.com/users/kirkscheper/followers","following_url":"https://api.github.com/users/kirkscheper/following{/other_user}","gists_url":"https://api.github.com/users/kirkscheper/gists{/gist_id}","starred_url":"https://api.github.com/users/kirkscheper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirkscheper/subscriptions","organizations_url":"https://api.github.com/users/kirkscheper/orgs","repos_url":"https://api.github.com/users/kirkscheper/repos","events_url":"https://api.github.com/users/kirkscheper/events{/privacy}","received_events_url":"https://api.github.com/users/kirkscheper/received_events","type":"User","site_admin":false},"body":"There is lots of commented out code, is this a work in progress or is it completed?","created_at":"2016-07-12T08:05:06Z","updated_at":"2016-07-12T08:05:06Z","html_url":"https://github.com/paparazzi/paparazzi/pull/1785#discussion_r70393442","pull_request_url":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785","_links":{"self":{"href":"https://api.github.com/repos/paparazzi/paparazzi/pulls/comments/70393442"},"html":{"href":"https://github.com/paparazzi/paparazzi/pull/1785#discussion_r70393442"},"pull_request":{"href":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785"}}},"pull_request":{"url":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785","id":76594915,"html_url":"https://github.com/paparazzi/paparazzi/pull/1785","diff_url":"https://github.com/paparazzi/paparazzi/pull/1785.diff","patch_url":"https://github.com/paparazzi/paparazzi/pull/1785.patch","issue_url":"https://api.github.com/repos/paparazzi/paparazzi/issues/1785","number":1785,"state":"open","locked":false,"title":"added detect contour","user":{"login":"lplp8899","id":8240152,"avatar_url":"https://avatars.githubusercontent.com/u/8240152?v=3","gravatar_id":"","url":"https://api.github.com/users/lplp8899","html_url":"https://github.com/lplp8899","followers_url":"https://api.github.com/users/lplp8899/followers","following_url":"https://api.github.com/users/lplp8899/following{/other_user}","gists_url":"https://api.github.com/users/lplp8899/gists{/gist_id}","starred_url":"https://api.github.com/users/lplp8899/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lplp8899/subscriptions","organizations_url":"https://api.github.com/users/lplp8899/orgs","repos_url":"https://api.github.com/users/lplp8899/repos","events_url":"https://api.github.com/users/lplp8899/events{/privacy}","received_events_url":"https://api.github.com/users/lplp8899/received_events","type":"User","site_admin":false},"body":"Added two files related to contour detection. More files come later.","created_at":"2016-07-07T13:30:07Z","updated_at":"2016-07-12T08:05:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7a7be8a2d587a3aa4d98340a37b2cd2d50e6d6a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785/commits","review_comments_url":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785/comments","review_comment_url":"https://api.github.com/repos/paparazzi/paparazzi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paparazzi/paparazzi/issues/1785/comments","statuses_url":"https://api.github.com/repos/paparazzi/paparazzi/statuses/b9c67983cb30cfd47f616b8e43f81fc511eac202","head":{"label":"lplp8899:pushcontour","ref":"pushcontour","sha":"b9c67983cb30cfd47f616b8e43f81fc511eac202","user":{"login":"lplp8899","id":8240152,"avatar_url":"https://avatars.githubusercontent.com/u/8240152?v=3","gravatar_id":"","url":"https://api.github.com/users/lplp8899","html_url":"https://github.com/lplp8899","followers_url":"https://api.github.com/users/lplp8899/followers","following_url":"https://api.github.com/users/lplp8899/following{/other_user}","gists_url":"https://api.github.com/users/lplp8899/gists{/gist_id}","starred_url":"https://api.github.com/users/lplp8899/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lplp8899/subscriptions","organizations_url":"https://api.github.com/users/lplp8899/orgs","repos_url":"https://api.github.com/users/lplp8899/repos","events_url":"https://api.github.com/users/lplp8899/events{/privacy}","received_events_url":"https://api.github.com/users/lplp8899/received_events","type":"User","site_admin":false},"repo":{"id":22123883,"name":"paparazzi","full_name":"lplp8899/paparazzi","owner":{"login":"lplp8899","id":8240152,"avatar_url":"https://avatars.githubusercontent.com/u/8240152?v=3","gravatar_id":"","url":"https://api.github.com/users/lplp8899","html_url":"https://github.com/lplp8899","followers_url":"https://api.github.com/users/lplp8899/followers","following_url":"https://api.github.com/users/lplp8899/following{/other_user}","gists_url":"https://api.github.com/users/lplp8899/gists{/gist_id}","starred_url":"https://api.github.com/users/lplp8899/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lplp8899/subscriptions","organizations_url":"https://api.github.com/users/lplp8899/orgs","repos_url":"https://api.github.com/users/lplp8899/repos","events_url":"https://api.github.com/users/lplp8899/events{/privacy}","received_events_url":"https://api.github.com/users/lplp8899/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lplp8899/paparazzi","description":"Paparazzi is a free and open-source hardware and software project for unmanned (air) vehicles. This is the main software repository.","fork":true,"url":"https://api.github.com/repos/lplp8899/paparazzi","forks_url":"https://api.github.com/repos/lplp8899/paparazzi/forks","keys_url":"https://api.github.com/repos/lplp8899/paparazzi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lplp8899/paparazzi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lplp8899/paparazzi/teams","hooks_url":"https://api.github.com/repos/lplp8899/paparazzi/hooks","issue_events_url":"https://api.github.com/repos/lplp8899/paparazzi/issues/events{/number}","events_url":"https://api.github.com/repos/lplp8899/paparazzi/events","assignees_url":"https://api.github.com/repos/lplp8899/paparazzi/assignees{/user}","branches_url":"https://api.github.com/repos/lplp8899/paparazzi/branches{/branch}","tags_url":"https://api.github.com/repos/lplp8899/paparazzi/tags","blobs_url":"https://api.github.com/repos/lplp8899/paparazzi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lplp8899/paparazzi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lplp8899/paparazzi/git/refs{/sha}","trees_url":"https://api.github.com/repos/lplp8899/paparazzi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lplp8899/paparazzi/statuses/{sha}","languages_url":"https://api.github.com/repos/lplp8899/paparazzi/languages","stargazers_url":"https://api.github.com/repos/lplp8899/paparazzi/stargazers","contributors_url":"https://api.github.com/repos/lplp8899/paparazzi/contributors","subscribers_url":"https://api.github.com/repos/lplp8899/paparazzi/subscribers","subscription_url":"https://api.github.com/repos/lplp8899/paparazzi/subscription","commits_url":"https://api.github.com/repos/lplp8899/paparazzi/commits{/sha}","git_commits_url":"https://api.github.com/repos/lplp8899/paparazzi/git/commits{/sha}","comments_url":"https://api.github.com/repos/lplp8899/paparazzi/comments{/number}","issue_comment_url":"https://api.github.com/repos/lplp8899/paparazzi/issues/comments{/number}","contents_url":"https://api.github.com/repos/lplp8899/paparazzi/contents/{+path}","compare_url":"https://api.github.com/repos/lplp8899/paparazzi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lplp8899/paparazzi/merges","archive_url":"https://api.github.com/repos/lplp8899/paparazzi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lplp8899/paparazzi/downloads","issues_url":"https://api.github.com/repos/lplp8899/paparazzi/issues{/number}","pulls_url":"https://api.github.com/repos/lplp8899/paparazzi/pulls{/number}","milestones_url":"https://api.github.com/repos/lplp8899/paparazzi/milestones{/number}","notifications_url":"https://api.github.com/repos/lplp8899/paparazzi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lplp8899/paparazzi/labels{/name}","releases_url":"https://api.github.com/repos/lplp8899/paparazzi/releases{/id}","deployments_url":"https://api.github.com/repos/lplp8899/paparazzi/deployments","created_at":"2014-07-22T22:57:59Z","updated_at":"2014-07-16T22:38:42Z","pushed_at":"2016-07-10T13:39:30Z","git_url":"git://github.com/lplp8899/paparazzi.git","ssh_url":"git@github.com:lplp8899/paparazzi.git","clone_url":"https://github.com/lplp8899/paparazzi.git","svn_url":"https://github.com/lplp8899/paparazzi","homepage":"http://paparazziuav.org","size":71027,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"paparazzi:master","ref":"master","sha":"15d6496de3ccfb790341fcd6a9ba0432a1aaac31","user":{"login":"paparazzi","id":318080,"avatar_url":"https://avatars.githubusercontent.com/u/318080?v=3","gravatar_id":"","url":"https://api.github.com/users/paparazzi","html_url":"https://github.com/paparazzi","followers_url":"https://api.github.com/users/paparazzi/followers","following_url":"https://api.github.com/users/paparazzi/following{/other_user}","gists_url":"https://api.github.com/users/paparazzi/gists{/gist_id}","starred_url":"https://api.github.com/users/paparazzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paparazzi/subscriptions","organizations_url":"https://api.github.com/users/paparazzi/orgs","repos_url":"https://api.github.com/users/paparazzi/repos","events_url":"https://api.github.com/users/paparazzi/events{/privacy}","received_events_url":"https://api.github.com/users/paparazzi/received_events","type":"Organization","site_admin":false},"repo":{"id":1068018,"name":"paparazzi","full_name":"paparazzi/paparazzi","owner":{"login":"paparazzi","id":318080,"avatar_url":"https://avatars.githubusercontent.com/u/318080?v=3","gravatar_id":"","url":"https://api.github.com/users/paparazzi","html_url":"https://github.com/paparazzi","followers_url":"https://api.github.com/users/paparazzi/followers","following_url":"https://api.github.com/users/paparazzi/following{/other_user}","gists_url":"https://api.github.com/users/paparazzi/gists{/gist_id}","starred_url":"https://api.github.com/users/paparazzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paparazzi/subscriptions","organizations_url":"https://api.github.com/users/paparazzi/orgs","repos_url":"https://api.github.com/users/paparazzi/repos","events_url":"https://api.github.com/users/paparazzi/events{/privacy}","received_events_url":"https://api.github.com/users/paparazzi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paparazzi/paparazzi","description":"Paparazzi is a free and open-source hardware and software project for unmanned (air) vehicles. This is the main software repository.","fork":false,"url":"https://api.github.com/repos/paparazzi/paparazzi","forks_url":"https://api.github.com/repos/paparazzi/paparazzi/forks","keys_url":"https://api.github.com/repos/paparazzi/paparazzi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paparazzi/paparazzi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paparazzi/paparazzi/teams","hooks_url":"https://api.github.com/repos/paparazzi/paparazzi/hooks","issue_events_url":"https://api.github.com/repos/paparazzi/paparazzi/issues/events{/number}","events_url":"https://api.github.com/repos/paparazzi/paparazzi/events","assignees_url":"https://api.github.com/repos/paparazzi/paparazzi/assignees{/user}","branches_url":"https://api.github.com/repos/paparazzi/paparazzi/branches{/branch}","tags_url":"https://api.github.com/repos/paparazzi/paparazzi/tags","blobs_url":"https://api.github.com/repos/paparazzi/paparazzi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paparazzi/paparazzi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paparazzi/paparazzi/git/refs{/sha}","trees_url":"https://api.github.com/repos/paparazzi/paparazzi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paparazzi/paparazzi/statuses/{sha}","languages_url":"https://api.github.com/repos/paparazzi/paparazzi/languages","stargazers_url":"https://api.github.com/repos/paparazzi/paparazzi/stargazers","contributors_url":"https://api.github.com/repos/paparazzi/paparazzi/contributors","subscribers_url":"https://api.github.com/repos/paparazzi/paparazzi/subscribers","subscription_url":"https://api.github.com/repos/paparazzi/paparazzi/subscription","commits_url":"https://api.github.com/repos/paparazzi/paparazzi/commits{/sha}","git_commits_url":"https://api.github.com/repos/paparazzi/paparazzi/git/commits{/sha}","comments_url":"https://api.github.com/repos/paparazzi/paparazzi/comments{/number}","issue_comment_url":"https://api.github.com/repos/paparazzi/paparazzi/issues/comments{/number}","contents_url":"https://api.github.com/repos/paparazzi/paparazzi/contents/{+path}","compare_url":"https://api.github.com/repos/paparazzi/paparazzi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paparazzi/paparazzi/merges","archive_url":"https://api.github.com/repos/paparazzi/paparazzi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paparazzi/paparazzi/downloads","issues_url":"https://api.github.com/repos/paparazzi/paparazzi/issues{/number}","pulls_url":"https://api.github.com/repos/paparazzi/paparazzi/pulls{/number}","milestones_url":"https://api.github.com/repos/paparazzi/paparazzi/milestones{/number}","notifications_url":"https://api.github.com/repos/paparazzi/paparazzi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paparazzi/paparazzi/labels{/name}","releases_url":"https://api.github.com/repos/paparazzi/paparazzi/releases{/id}","deployments_url":"https://api.github.com/repos/paparazzi/paparazzi/deployments","created_at":"2010-11-10T11:14:08Z","updated_at":"2016-07-11T09:53:09Z","pushed_at":"2016-07-11T23:03:52Z","git_url":"git://github.com/paparazzi/paparazzi.git","ssh_url":"git@github.com:paparazzi/paparazzi.git","clone_url":"https://github.com/paparazzi/paparazzi.git","svn_url":"https://github.com/paparazzi/paparazzi","homepage":"http://paparazziuav.org","size":100916,"stargazers_count":592,"watchers_count":592,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":610,"mirror_url":null,"open_issues_count":120,"forks":610,"open_issues":120,"watchers":592,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785"},"html":{"href":"https://github.com/paparazzi/paparazzi/pull/1785"},"issue":{"href":"https://api.github.com/repos/paparazzi/paparazzi/issues/1785"},"comments":{"href":"https://api.github.com/repos/paparazzi/paparazzi/issues/1785/comments"},"review_comments":{"href":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785/comments"},"review_comment":{"href":"https://api.github.com/repos/paparazzi/paparazzi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paparazzi/paparazzi/pulls/1785/commits"},"statuses":{"href":"https://api.github.com/repos/paparazzi/paparazzi/statuses/b9c67983cb30cfd47f616b8e43f81fc511eac202"}}}}
{"actor":{"display_login":"kirkscheper"}}