{"action":"created","comment":{"url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/comments/79299354","id":79299354,"diff_hunk":"@@ -0,0 +1,254 @@\n+// -*- coding:utf-8-unix; mode: c++; indent-tabs-mode: nil; c-basic-offset: 2; -*-\n+/*********************************************************************\n+* Software License Agreement (BSD License)\n+*\n+*  Copyright (c) 2016, JSK Lab.\n+*  All rights reserved.\n+*\n+*  Redistribution and use in source and binary forms, with or without\n+*  modification, are permitted provided that the following conditions\n+*  are met:\n+*\n+*   * Redistributions of source code must retain the above copyright\n+*     notice, this list of conditions and the following disclaimer.\n+*   * Redistributions in binary form must reproduce the above\n+*     copyright notice, this list of conditions and the following\n+*     disclaimer in the documentation and/or other materials provided\n+*     with the distribution.\n+*   * Neither the name of the Kei Okada nor the names of its\n+*     contributors may be used to endorse or promote products derived\n+*     from this software without specific prior written permission.\n+*\n+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+*  \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+*  POSSIBILITY OF SUCH DAMAGE.\n+*********************************************************************/\n+\n+/**\n+ * @file https://github.com/opencv/opencv/blob/master/samples/cpp/lsd_lines.cpp\n+ * @brief Sample code showing how to detect line segments using the LineSegmentDetector\n+ * @author OpenCV team\n+ */\n+\n+#include <ros/ros.h>\n+#include \"opencv_apps/nodelet.h\"\n+#include <image_transport/image_transport.h>\n+#include <sensor_msgs/image_encodings.h>\n+#include <cv_bridge/cv_bridge.h>\n+\n+#include <opencv2/highgui/highgui.hpp>\n+#include <opencv2/imgproc/imgproc.hpp>\n+\n+#include <dynamic_reconfigure/server.h>\n+#include \"opencv_apps/Line.h\"\n+#include \"opencv_apps/LineArrayStamped.h\"\n+#include \"opencv_apps/LineSegmentDetectorConfig.h\"\n+\n+\n+namespace line_segment_detector {\n+class LineSegmentDetectorNodelet : public opencv_apps::Nodelet\n+{\n+  image_transport::Publisher img_pub_;\n+  image_transport::Subscriber img_sub_;\n+  image_transport::CameraSubscriber cam_sub_;\n+  ros::Publisher msg_pub_;\n+\n+  boost::shared_ptr<image_transport::ImageTransport> it_;\n+\n+  typedef line_segment_detector::LineSegmentDetectorConfig Config;\n+  typedef dynamic_reconfigure::Server<Config> ReconfigureServer;\n+  Config config_;\n+  boost::shared_ptr<ReconfigureServer> reconfigure_server_;\n+\n+  bool debug_view_;\n+  ros::Time prev_stamp_;\n+\n+  int lsd_refine_;\n+  double lsd_scale_;\n+  double lsd_sigma_scale_;\n+  double lsd_quant_;\n+  double lsd_angle_threshold_;\n+  double lsd_log_eps_;\n+  double lsd_density_threshold_;\n+  int lsd_n_bins_;\n+  double lsd_line_length_threshold_;\n+\n+  std::string window_name_;\n+  static bool need_config_update_;\n+\n+  void reconfigureCallback(Config &new_config, uint32_t level)\n+  {\n+    config_ = new_config;\n+\n+    lsd_refine_ = config_.lsd_refine_type;\n+    lsd_scale_ = config_.lsd_scale;\n+    lsd_sigma_scale_ = config_.lsd_sigma_scale;\n+    lsd_angle_threshold_ = config_.lsd_angle_threshold;\n+    lsd_log_eps_ = config_.lsd_log_eps;\n+    lsd_density_threshold_ = config_.lsd_density_threshold;\n+    lsd_n_bins_ = config_.lsd_n_bins;\n+    lsd_line_length_threshold_ = config_.lsd_line_length_threshold;\n+  }\n+\n+  const std::string &frameWithDefault(const std::string &frame, const std::string &image_frame)\n+  {\n+    if (frame.empty())\n+      return image_frame;\n+    return frame;\n+  }\n+\n+  void imageCallbackWithInfo(const sensor_msgs::ImageConstPtr& msg, const sensor_msgs::CameraInfoConstPtr& cam_info)\n+  {\n+    do_work(msg, cam_info->header.frame_id);\n+  }\n+\n+  void imageCallback(const sensor_msgs::ImageConstPtr& msg)\n+  {\n+    do_work(msg, msg->header.frame_id);\n+  }\n+\n+  static void trackbarCallback( int, void* )\n+  {\n+    need_config_update_ = true;\n+  }\n+\n+  void do_work(const sensor_msgs::ImageConstPtr& msg, const std::string input_frame_from_msg)\n+  {\n+    // Work on the image.\n+    try\n+    {\n+      // Convert the image into something opencv can handle.\n+      cv::Mat frame = cv_bridge::toCvShare(msg, sensor_msgs::image_encodings::BGR8)->image;\n+\n+      // Do the work\n+      cv::Mat src_gray;\n+      /// Convert it to gray\n+      if ( frame.channels() > 1 ) {\n+        cv::cvtColor( frame, src_gray, cv::COLOR_RGB2GRAY );\n+      } else {\n+        src_gray = frame;\n+      }\n+\n+      /// Create window\n+      if( debug_view_) {\n+        cv::namedWindow( window_name_, cv::WINDOW_AUTOSIZE );\n+      }\n+\n+      std::string new_window_name;\n+      cv::Mat grad;\n+\n+      cv::Ptr<cv::LineSegmentDetector> lsd = cv::createLineSegmentDetector(lsd_refine_, lsd_scale_,","path":"src/nodelet/line_segment_detector_nodelet.cpp","position":null,"original_position":149,"commit_id":"cfa63e6333eb14e63b8be53a86f456fcc9c56d0f","original_commit_id":"c17a3e4e96738f0b07918d4561dcab2d591d8681","user":{"login":"iory","id":4690682,"avatar_url":"https://avatars.githubusercontent.com/u/4690682?v=3","gravatar_id":"","url":"https://api.github.com/users/iory","html_url":"https://github.com/iory","followers_url":"https://api.github.com/users/iory/followers","following_url":"https://api.github.com/users/iory/following{/other_user}","gists_url":"https://api.github.com/users/iory/gists{/gist_id}","starred_url":"https://api.github.com/users/iory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iory/subscriptions","organizations_url":"https://api.github.com/users/iory/orgs","repos_url":"https://api.github.com/users/iory/repos","events_url":"https://api.github.com/users/iory/events{/privacy}","received_events_url":"https://api.github.com/users/iory/received_events","type":"User","site_admin":false},"body":"we don't have to create it every loop.\r\nre-create instance when rosparam changed.\r\nhttps://github.com/ros-perception/opencv_apps/pull/35/files#diff-51d9a14bcb3567cf07467833b23d4bebR91","created_at":"2016-09-18T07:15:54Z","updated_at":"2016-09-18T07:15:54Z","html_url":"https://github.com/ros-perception/opencv_apps/pull/35#discussion_r79299354","pull_request_url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/comments/79299354"},"html":{"href":"https://github.com/ros-perception/opencv_apps/pull/35#discussion_r79299354"},"pull_request":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35","id":85452827,"html_url":"https://github.com/ros-perception/opencv_apps/pull/35","diff_url":"https://github.com/ros-perception/opencv_apps/pull/35.diff","patch_url":"https://github.com/ros-perception/opencv_apps/pull/35.patch","issue_url":"https://api.github.com/repos/ros-perception/opencv_apps/issues/35","number":35,"state":"open","locked":false,"title":"Add line segment detector(lsd)","user":{"login":"iory","id":4690682,"avatar_url":"https://avatars.githubusercontent.com/u/4690682?v=3","gravatar_id":"","url":"https://api.github.com/users/iory","html_url":"https://github.com/iory","followers_url":"https://api.github.com/users/iory/followers","following_url":"https://api.github.com/users/iory/following{/other_user}","gists_url":"https://api.github.com/users/iory/gists{/gist_id}","starred_url":"https://api.github.com/users/iory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iory/subscriptions","organizations_url":"https://api.github.com/users/iory/orgs","repos_url":"https://api.github.com/users/iory/repos","events_url":"https://api.github.com/users/iory/events{/privacy}","received_events_url":"https://api.github.com/users/iory/received_events","type":"User","site_admin":false},"body":"![lsd](https://cloud.githubusercontent.com/assets/4690682/18561577/76995198-7bbb-11e6-90b5-12cd129f2b68.png)\r\n","created_at":"2016-09-15T18:12:59Z","updated_at":"2016-09-18T07:15:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bcbb140e50fb160c1288b478a432b20dd15cddeb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35/commits","review_comments_url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35/comments","review_comment_url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros-perception/opencv_apps/issues/35/comments","statuses_url":"https://api.github.com/repos/ros-perception/opencv_apps/statuses/cfa63e6333eb14e63b8be53a86f456fcc9c56d0f","head":{"label":"iory:lsd","ref":"lsd","sha":"cfa63e6333eb14e63b8be53a86f456fcc9c56d0f","user":{"login":"iory","id":4690682,"avatar_url":"https://avatars.githubusercontent.com/u/4690682?v=3","gravatar_id":"","url":"https://api.github.com/users/iory","html_url":"https://github.com/iory","followers_url":"https://api.github.com/users/iory/followers","following_url":"https://api.github.com/users/iory/following{/other_user}","gists_url":"https://api.github.com/users/iory/gists{/gist_id}","starred_url":"https://api.github.com/users/iory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iory/subscriptions","organizations_url":"https://api.github.com/users/iory/orgs","repos_url":"https://api.github.com/users/iory/repos","events_url":"https://api.github.com/users/iory/events{/privacy}","received_events_url":"https://api.github.com/users/iory/received_events","type":"User","site_admin":false},"repo":{"id":59579295,"name":"opencv_apps","full_name":"iory/opencv_apps","owner":{"login":"iory","id":4690682,"avatar_url":"https://avatars.githubusercontent.com/u/4690682?v=3","gravatar_id":"","url":"https://api.github.com/users/iory","html_url":"https://github.com/iory","followers_url":"https://api.github.com/users/iory/followers","following_url":"https://api.github.com/users/iory/following{/other_user}","gists_url":"https://api.github.com/users/iory/gists{/gist_id}","starred_url":"https://api.github.com/users/iory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iory/subscriptions","organizations_url":"https://api.github.com/users/iory/orgs","repos_url":"https://api.github.com/users/iory/repos","events_url":"https://api.github.com/users/iory/events{/privacy}","received_events_url":"https://api.github.com/users/iory/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iory/opencv_apps","description":"","fork":true,"url":"https://api.github.com/repos/iory/opencv_apps","forks_url":"https://api.github.com/repos/iory/opencv_apps/forks","keys_url":"https://api.github.com/repos/iory/opencv_apps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iory/opencv_apps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iory/opencv_apps/teams","hooks_url":"https://api.github.com/repos/iory/opencv_apps/hooks","issue_events_url":"https://api.github.com/repos/iory/opencv_apps/issues/events{/number}","events_url":"https://api.github.com/repos/iory/opencv_apps/events","assignees_url":"https://api.github.com/repos/iory/opencv_apps/assignees{/user}","branches_url":"https://api.github.com/repos/iory/opencv_apps/branches{/branch}","tags_url":"https://api.github.com/repos/iory/opencv_apps/tags","blobs_url":"https://api.github.com/repos/iory/opencv_apps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iory/opencv_apps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iory/opencv_apps/git/refs{/sha}","trees_url":"https://api.github.com/repos/iory/opencv_apps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iory/opencv_apps/statuses/{sha}","languages_url":"https://api.github.com/repos/iory/opencv_apps/languages","stargazers_url":"https://api.github.com/repos/iory/opencv_apps/stargazers","contributors_url":"https://api.github.com/repos/iory/opencv_apps/contributors","subscribers_url":"https://api.github.com/repos/iory/opencv_apps/subscribers","subscription_url":"https://api.github.com/repos/iory/opencv_apps/subscription","commits_url":"https://api.github.com/repos/iory/opencv_apps/commits{/sha}","git_commits_url":"https://api.github.com/repos/iory/opencv_apps/git/commits{/sha}","comments_url":"https://api.github.com/repos/iory/opencv_apps/comments{/number}","issue_comment_url":"https://api.github.com/repos/iory/opencv_apps/issues/comments{/number}","contents_url":"https://api.github.com/repos/iory/opencv_apps/contents/{+path}","compare_url":"https://api.github.com/repos/iory/opencv_apps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iory/opencv_apps/merges","archive_url":"https://api.github.com/repos/iory/opencv_apps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iory/opencv_apps/downloads","issues_url":"https://api.github.com/repos/iory/opencv_apps/issues{/number}","pulls_url":"https://api.github.com/repos/iory/opencv_apps/pulls{/number}","milestones_url":"https://api.github.com/repos/iory/opencv_apps/milestones{/number}","notifications_url":"https://api.github.com/repos/iory/opencv_apps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iory/opencv_apps/labels{/name}","releases_url":"https://api.github.com/repos/iory/opencv_apps/releases{/id}","deployments_url":"https://api.github.com/repos/iory/opencv_apps/deployments","created_at":"2016-05-24T14:15:20Z","updated_at":"2016-05-24T14:15:21Z","pushed_at":"2016-09-18T07:12:50Z","git_url":"git://github.com/iory/opencv_apps.git","ssh_url":"git@github.com:iory/opencv_apps.git","clone_url":"https://github.com/iory/opencv_apps.git","svn_url":"https://github.com/iory/opencv_apps","homepage":null,"size":297,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"indigo"}},"base":{"label":"ros-perception:indigo","ref":"indigo","sha":"762f95a03017ca28cc9f5cf80a01c9c70e389ee3","user":{"login":"ros-perception","id":2328630,"avatar_url":"https://avatars.githubusercontent.com/u/2328630?v=3","gravatar_id":"","url":"https://api.github.com/users/ros-perception","html_url":"https://github.com/ros-perception","followers_url":"https://api.github.com/users/ros-perception/followers","following_url":"https://api.github.com/users/ros-perception/following{/other_user}","gists_url":"https://api.github.com/users/ros-perception/gists{/gist_id}","starred_url":"https://api.github.com/users/ros-perception/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros-perception/subscriptions","organizations_url":"https://api.github.com/users/ros-perception/orgs","repos_url":"https://api.github.com/users/ros-perception/repos","events_url":"https://api.github.com/users/ros-perception/events{/privacy}","received_events_url":"https://api.github.com/users/ros-perception/received_events","type":"Organization","site_admin":false},"repo":{"id":58278267,"name":"opencv_apps","full_name":"ros-perception/opencv_apps","owner":{"login":"ros-perception","id":2328630,"avatar_url":"https://avatars.githubusercontent.com/u/2328630?v=3","gravatar_id":"","url":"https://api.github.com/users/ros-perception","html_url":"https://github.com/ros-perception","followers_url":"https://api.github.com/users/ros-perception/followers","following_url":"https://api.github.com/users/ros-perception/following{/other_user}","gists_url":"https://api.github.com/users/ros-perception/gists{/gist_id}","starred_url":"https://api.github.com/users/ros-perception/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros-perception/subscriptions","organizations_url":"https://api.github.com/users/ros-perception/orgs","repos_url":"https://api.github.com/users/ros-perception/repos","events_url":"https://api.github.com/users/ros-perception/events{/privacy}","received_events_url":"https://api.github.com/users/ros-perception/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros-perception/opencv_apps","description":"","fork":false,"url":"https://api.github.com/repos/ros-perception/opencv_apps","forks_url":"https://api.github.com/repos/ros-perception/opencv_apps/forks","keys_url":"https://api.github.com/repos/ros-perception/opencv_apps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros-perception/opencv_apps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros-perception/opencv_apps/teams","hooks_url":"https://api.github.com/repos/ros-perception/opencv_apps/hooks","issue_events_url":"https://api.github.com/repos/ros-perception/opencv_apps/issues/events{/number}","events_url":"https://api.github.com/repos/ros-perception/opencv_apps/events","assignees_url":"https://api.github.com/repos/ros-perception/opencv_apps/assignees{/user}","branches_url":"https://api.github.com/repos/ros-perception/opencv_apps/branches{/branch}","tags_url":"https://api.github.com/repos/ros-perception/opencv_apps/tags","blobs_url":"https://api.github.com/repos/ros-perception/opencv_apps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros-perception/opencv_apps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros-perception/opencv_apps/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros-perception/opencv_apps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros-perception/opencv_apps/statuses/{sha}","languages_url":"https://api.github.com/repos/ros-perception/opencv_apps/languages","stargazers_url":"https://api.github.com/repos/ros-perception/opencv_apps/stargazers","contributors_url":"https://api.github.com/repos/ros-perception/opencv_apps/contributors","subscribers_url":"https://api.github.com/repos/ros-perception/opencv_apps/subscribers","subscription_url":"https://api.github.com/repos/ros-perception/opencv_apps/subscription","commits_url":"https://api.github.com/repos/ros-perception/opencv_apps/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros-perception/opencv_apps/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros-perception/opencv_apps/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros-perception/opencv_apps/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros-perception/opencv_apps/contents/{+path}","compare_url":"https://api.github.com/repos/ros-perception/opencv_apps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros-perception/opencv_apps/merges","archive_url":"https://api.github.com/repos/ros-perception/opencv_apps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros-perception/opencv_apps/downloads","issues_url":"https://api.github.com/repos/ros-perception/opencv_apps/issues{/number}","pulls_url":"https://api.github.com/repos/ros-perception/opencv_apps/pulls{/number}","milestones_url":"https://api.github.com/repos/ros-perception/opencv_apps/milestones{/number}","notifications_url":"https://api.github.com/repos/ros-perception/opencv_apps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros-perception/opencv_apps/labels{/name}","releases_url":"https://api.github.com/repos/ros-perception/opencv_apps/releases{/id}","deployments_url":"https://api.github.com/repos/ros-perception/opencv_apps/deployments","created_at":"2016-05-07T18:05:19Z","updated_at":"2016-05-17T23:46:54Z","pushed_at":"2016-09-18T07:12:50Z","git_url":"git://github.com/ros-perception/opencv_apps.git","ssh_url":"git@github.com:ros-perception/opencv_apps.git","clone_url":"https://github.com/ros-perception/opencv_apps.git","svn_url":"https://github.com/ros-perception/opencv_apps","homepage":null,"size":277,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":9,"forks":6,"open_issues":9,"watchers":2,"default_branch":"indigo"}},"_links":{"self":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35"},"html":{"href":"https://github.com/ros-perception/opencv_apps/pull/35"},"issue":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/issues/35"},"comments":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/ros-perception/opencv_apps/statuses/cfa63e6333eb14e63b8be53a86f456fcc9c56d0f"}}}}
{"actor":{"display_login":"iory"}}