Skip to content

Commit

Permalink
cleaned up codes commit
Browse files Browse the repository at this point in the history
  • Loading branch information
medegw01 committed Dec 13, 2017
1 parent fb6ff0b commit add9ae4
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions catkin_ws/src/pathify/src/ImageDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class ImageDetector {
// Output different messages for all to see.
imageDetector_pub = nh_.advertise<std_msgs::String>("imageDetector_output", 1000);

//Input_Talker_sub = nh_.subscribe("chatter", 1000, chatterCallback);


cv::namedWindow(OPENCV_WINDOW);
}

Expand Down Expand Up @@ -77,15 +76,11 @@ class ImageDetector {
findContours(img_mask, contours, hierarchy,
CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0));

for (int i = 0; i < contours.size(); i++) {
cv::drawContours(cv_ptr->image, contours, i,
cv::Scalar(0,0,0), 2, 8, hierarchy, 0, cv::Point());
}
for (int i = 0; i < contours.size(); i++) m

if (!img_mask.empty()) {
for (unsigned int i = 0; i < contours.size(); i++) {
if (cv::contourArea(contours[i]) >= 120000) {
//std::cout << "Area = " << cv::contourArea(contours[i]) << std::endl;
colorDetected = true;
colorClose = true;
}
Expand All @@ -106,7 +101,7 @@ class ImageDetector {
std::stringstream ss;
ss << "Stop";
msg.data = ss.str();
//std::cout << ss.str() << std::endl;


ROS_INFO("%s", msg.data.c_str());
imageDetector_pub.publish(msg);
Expand All @@ -120,7 +115,7 @@ class ImageDetector {
std::stringstream ss;
ss << "FoundButGetCloser";
msg.data = ss.str();
//std::cout << ss.str() << std::endl;


ROS_INFO("%s", msg.data.c_str());
imageDetector_pub.publish(msg);
Expand All @@ -134,8 +129,6 @@ class ImageDetector {
std::stringstream ss;
ss << "NothingFound";
msg.data = ss.str();
//std::cout << ss.str() << std::endl;

ROS_INFO("%s", msg.data.c_str());
imageDetector_pub.publish(msg);
ss.clear();
Expand All @@ -145,7 +138,6 @@ class ImageDetector {

// Update GUI Window
cv::imshow(OPENCV_WINDOW, cv_ptr->image);
//cv::imshow(OPENCV_WINDOW, img_mask);
cv::waitKey(5);

// Output modified video stream
Expand Down

0 comments on commit add9ae4

Please sign in to comment.