From: <tum...@li...> - 2012-01-31 16:56:54
|
Revision: 988 http://tum-ros-pkg.svn.sourceforge.net/tum-ros-pkg/?rev=988&view=rev Author: moesenle Date: 2012-01-31 16:56:47 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Author: Dejan Pangercic <dej...@gm...> Date: Tue Jan 31 17:56:00 2012 +0100 commit 18a0d38c68c6c7687b2dc686099d920b40fa5f8d Author: Dejan Pangercic <dej...@gm...> Date: Tue Jan 31 17:55:38 2012 +0100 no need to save an xml commit 1f4fc5e466ea6b71c55184c96db00c0861f6287a Author: Dejan Pangercic <dej...@gm...> Date: Tue Jan 31 17:55:00 2012 +0100 public export git-commit Modified Paths: -------------- perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp Modified: perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp =================================================================== --- perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp 2012-01-31 16:56:40 UTC (rev 987) +++ perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp 2012-01-31 16:56:47 UTC (rev 988) @@ -182,7 +182,6 @@ // std::cerr << "buffer: " << buffer << std::endl; TiXmlDocument doc; doc.Parse((const char*)buffer.c_str(), 0, TIXML_ENCODING_UTF8); - doc.SaveFile ("text.xml"); std::string picture; findElement (&doc, picture); ROS_INFO_STREAM ("Picture link: " << picture); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tum...@li...> - 2012-02-18 21:16:29
|
Revision: 995 http://tum-ros-pkg.svn.sourceforge.net/tum-ros-pkg/?rev=995&view=rev Author: moesenle Date: 2012-02-18 21:16:22 +0000 (Sat, 18 Feb 2012) Log Message: ----------- Author: Dejan Pangercic <dej...@cs...> Date: Sat Feb 18 22:15:45 2012 +0100 commit 5cd7d5d41dca1d643ab5a61c680a35629b2f7573 Author: Dejan Pangercic <dej...@cs...> Date: Sat Feb 18 22:15:23 2012 +0100 forgotten include commit bc1d4b8e52767b7ad77db2b4e142f9f8ac5b4ec8 Author: Dejan Pangercic <dej...@cs...> Date: Sat Feb 18 22:09:16 2012 +0100 public export git-commit Modified Paths: -------------- perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp Modified: perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp =================================================================== --- perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp 2012-02-18 21:16:15 UTC (rev 994) +++ perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp 2012-02-18 21:16:22 UTC (rev 995) @@ -13,7 +13,7 @@ #include "tinyxml.h" #include <highgui.h> #include <zbar_barcode_reader_node/enable_barcode_reader.h> - +#include <cv_bridge/cv_bridge.h> //Magick++ lib #include <Magick++.h> //zbar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tum...@li...> - 2012-02-24 00:37:52
|
Revision: 996 http://tum-ros-pkg.svn.sourceforge.net/tum-ros-pkg/?rev=996&view=rev Author: moesenle Date: 2012-02-24 00:37:45 +0000 (Fri, 24 Feb 2012) Log Message: ----------- Author: Dejan Pangercic <dej...@cs...> Date: Fri Feb 24 01:37:22 2012 +0100 commit cbb807243e3bbe09543973f9d8976c70f7904eab Author: Dejan Pangercic <dej...@cs...> Date: Fri Feb 24 01:36:20 2012 +0100 got rid of IplImage, needed to be tested commit 9d9f1f2127342dfece2d09aa07b355aa0cf4feaf Author: Dejan Pangercic <dej...@cs...> Date: Fri Feb 24 00:40:34 2012 +0100 ROS_INFO_STREAM, cv_bridge_ptr as class member commit 92834a4d47ff06e0809906e59bbddbfed2848ee9 Author: Dejan Pangercic <dej...@cs...> Date: Sat Feb 18 22:15:45 2012 +0100 public export git-commit Modified Paths: -------------- perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp Modified: perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp =================================================================== --- perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp 2012-02-18 21:16:22 UTC (rev 995) +++ perception/zbar_barcode_reader_node/src/zbar_barcode_reader_node.cpp 2012-02-24 00:37:45 UTC (rev 996) @@ -49,12 +49,6 @@ BarcodeReaderNode(ros::NodeHandle &n) : n_(n), it_(n_) { - //link1 = "http://www.barcoo.com/api/get_product_complete?pi="; - //link2 = "&pins=ean&format=xml&source=ias-tum"; - //tag1 = "answer"; - //tag2 = "picture_high"; - //tag3 = "picture_low"; - n_.param ("input_image_topic", input_image_topic_, std::string("/image_raw")); n_.param ("outout_barcode_topic", output_barcode_topic_, std::string("barcode")); n_.param ("link1", link1_, std::string("http://www.barcoo.com/api/get_product_complete?pi=")); @@ -66,7 +60,6 @@ input_image_topic_, 1, &BarcodeReaderNode::imageCallback, this); barcode_pub_ = n_.advertise<std_msgs::String>(output_barcode_topic_, 1); - //cv::namedWindow ("Barcoo img"); enable_barcode_reader_ = 0; service_ = n.advertiseService("enable_barcode_reader_service", &BarcodeReaderNode::enable_barcode_reader,this); image_received_ = 0; @@ -221,15 +214,12 @@ //Check if there is a result std:: string result; - cout << "ohhh my goooooood\n\n"; findElement(&doc,result,tag1_); if(result.compare("0") == 0) //This condition checks if there is a result in the XML file if not returns 0 { - cout << "heloooooo barcode does not correspond to any object in the barcoo database"; + ROS_INFO_STREAM("Barcode does not correspond to any object in the barcoo database"); return 0; } - else - cout << "ELSE ELSE ELSE\n"; //Search for first tag findElement (&doc, picture,tag2_); @@ -333,15 +323,14 @@ if(!enable_barcode_reader_) return; - IplImage *cv_image = NULL; ROS_INFO("[BarcodeReaderNode: ] Image received"); try { - cv_image = bridge_.imgMsgToCv(msg_ptr, "mono8"); + cv_bridge_ptr_ = cv_bridge::toCvCopy(msg_ptr, "mono8"); } - catch (sensor_msgs::CvBridgeException error) + catch (cv_bridge::Exception& e) { - ROS_ERROR("error"); + ROS_ERROR("Error converting ROS Image"); } // create a reader @@ -350,12 +339,12 @@ // configure the reader scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1); + int width = cv_bridge_ptr_->image.cols; // extract dimensions + int height = cv_bridge_ptr_->image.rows; + // obtain image data - // IplImage * cv_image = cvLoadImage(argv[1], CV_LOAD_IMAGE_GRAYSCALE); - Magick::Blob blob(cv_image->imageData, cv_image->imageSize); + Magick::Blob blob(cv_bridge_ptr_->image.ptr(0), width * height); - int width = cv_image->width; // extract dimensions - int height = cv_image->height; const void *raw = blob.data(); // wrap image data @@ -403,7 +392,7 @@ image_received_ = 1; return; } - // std::cerr << "buffer after callBarcoo " << buffer << std::endl; + //Search for info in the xml file std::string pictureLink; res = getPictureLink (buffer,pictureLink); @@ -411,7 +400,7 @@ if(res == 0) //If barcode does not exist in the database return { - cout << "Barcode does not exist in the barcoo datbase\n"; + ROS_INFO_STREAM("Barcode does not exist in the barcoo datbase"); image_received_ = 1; return; } @@ -423,7 +412,7 @@ std::string htmlPage; std::string htmlLink; findElement(&doc,htmlLink,"back_link"); - cout << "html link: "+htmlLink+"\n"; + ROS_INFO_STREAM ("html link: " << htmlLink); //Download HTML page getHTMLpage(htmlLink,htmlPage); std::string ss = pattern_; @@ -447,32 +436,19 @@ //publish image if (!(imgTmp.empty())) { - //imshow("Barcoo img", imgTmp); - cv_bridge::CvImagePtr cv_ptr (new cv_bridge::CvImage); - - std::cerr<< "\n\n\n\n\nTESTESTESTESTESTn\n\n\n\n"; - - cv_ptr->header.stamp = ros::Time::now(); - cv_ptr->header.frame_id = "frame"; - cv_ptr->encoding = "bgr8"; - std::cerr<< "\n\n\n\n\nHELO00000n\n\n\n\n"; - cv_ptr->image = imgTmp; - std::cerr<< "\n\n\n\n\nHELOn\n\n\n\n"; - - ros_image = cv_ptr->toImageMsg(); + cv_bridge_ptr_->header.stamp = ros::Time::now(); + cv_bridge_ptr_->header.frame_id = "frame"; + cv_bridge_ptr_->encoding = "bgr8"; + cv_bridge_ptr_->image = imgTmp; + ros_image = cv_bridge_ptr_->toImageMsg(); findElement(&doc,product_title,"title"); findElement(&doc,product_producer,"producer"); findElement(&doc,product_category,"category_key"); - - - image_found_ = 1; } image_received_ = 1; } cv::waitKey(3); - // clean up - //image.set_data(NULL, 0); } protected: @@ -488,6 +464,7 @@ std::string product_producer; std::string product_category; ros::ServiceServer service_; + cv_bridge::CvImagePtr cv_bridge_ptr_; }; int main(int argc, char** argv) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |