<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-369473332761631712</id><updated>2011-08-27T12:01:54.320-07:00</updated><category term='perspective camera model'/><category term='javac'/><category term='opencv installation'/><title type='text'>sir_ivy</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-6396583804165856831</id><published>2010-11-16T22:14:00.000-08:00</published><updated>2010-12-14T01:33:17.376-08:00</updated><title type='text'>Note for ROS Episode II</title><content type='html'>&lt;a href="http://www.ros.org/wiki/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages"&gt;Convert ROS image to CVImages&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/joy/Tutorials/ConfiguringALinuxJoystick"&gt;Joy stick test&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/joy/Tutorials/WritingTeleopNode"&gt;Writing code to get input from Joy stick&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/pr2_robot/Tutorials/Adding%20a%20Hokuyo%20to%20the%20PR2"&gt;Adding laser scan to robot&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/hokuyo_node"&gt;A Hokuyo laser scan description&lt;br /&gt;&lt;/a&gt;&lt;a href="http://www.ros.org/wiki/laser_assembler"&gt;Laser Assembler listen to point received from Laser scan&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/move_base_stage/Tutorials/stage%20and%20navigation%20stack"&gt;move base and navigation&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-6396583804165856831?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/6396583804165856831/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2010/11/note-for-ros-episode-ii.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6396583804165856831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6396583804165856831'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2010/11/note-for-ros-episode-ii.html' title='Note for ROS Episode II'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-4925378754106581933</id><published>2010-09-30T02:12:00.001-07:00</published><updated>2010-10-20T03:18:01.285-07:00</updated><title type='text'>NOte for ROS stuff : )</title><content type='html'>&lt;font style="font-weight: bold;"&gt;NodeHandle&lt;/font&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/roscpp/Overview/NodeHandles"&gt;http://www.ros.org/wiki/roscpp/Overview/NodeHandles&lt;/a&gt;&lt;br /&gt;&lt;font style="font-weight: bold;"&gt;param searchParam&lt;/font&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/roscpp_tutorials/Tutorials/Parameters"&gt;http://www.ros.org/wiki/roscpp_tutorials/Tutorials/Parameters&lt;/a&gt;&lt;br /&gt;&lt;font style="font-weight: bold;"&gt;subscribe to Topic API&lt;/font&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/doc/api/roscpp/html/classros_1_1NodeHandle.html#ac8600d1dda9123e4562072500e0784b7"&gt;http://www.ros.org/doc/api/roscpp/html/classros_1_1NodeHandle.html#ac8600d1dda9123e4562072500e0784b7&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tf API in C++&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.ros.org/doc/api/tf/html/c++/namespacetf.html"&gt;http://www.ros.org/doc/api/tf/html/c++/namespacetf.html&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Navigation for robot, local_costmap, global_costmap, map_server&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/navigation/Tutorials/RobotSetup"&gt;http://www.ros.org/wiki/navigation/Tutorials/RobotSetup&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Using Custom Maps in Simulation&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/pr2_simulator/Tutorials/UsingCustomMapForSimulation"&gt;http://www.ros.org/wiki/pr2_simulator/Tutorials/UsingCustomMapForSimulation&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Messages and frame_id&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/Messages"&gt;http://www.ros.org/wiki/Messages&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Robot controller using keyboard&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/pr2_controllers/Tutorials/Using%20the%20robot%20base%20controllers%20to%20drive%20the%20robot"&gt;http://www.ros.org/wiki/pr2_controllers/Tutorials/Using%20the%20robot%20base%20controllers%20to%20drive%20the%20robot&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Move base&lt;/span&gt;&lt;a href="http://www.ros.org/wiki/move_base"&gt;&lt;br /&gt;http://www.ros.org/wiki/move_base&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Laser Scan&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/laser_pipeline/Tutorials/IntroductionToWorkingWithLaserScannerData"&gt;http://www.ros.org/wiki/laser_pipeline/Tutorials/IntroductionToWorkingWithLaserScannerData&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How to put 3D models into Gazebo simulation&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.ros.org/wiki/ogre_tools/STL_To_Ogre_Mesh_Converter"&gt;http://www.ros.org/wiki/ogre_tools/STL_To_Ogre_Mesh_Converter&lt;/a&gt;&lt;br /&gt;Directory for texture list &lt;br /&gt;/home/jednipat/ros/stacks/simulator_gazebo/gazebo/gazebo/share/gazebo/Media/materials/scripts&lt;br /&gt;-Gazebo/White&lt;br /&gt;-Gazebo/Grey&lt;br /&gt;-Gazebo/Eyes&lt;br /&gt;-Gazebo/FlatBlack&lt;br /&gt;-Gazebo/Black&lt;br /&gt;-Gazebo/Red&lt;br /&gt;-Gazebo/Green&lt;br /&gt;-Gazebo/RedEmissive&lt;br /&gt;-Gazebo/GreenEmissive&lt;br /&gt;-Gazebo/BlueLaser&lt;br /&gt;-Gazebo/BlueEmissive&lt;br /&gt;-Gazebo/JointAnchor&lt;br /&gt;-Gazebo/Blue&lt;br /&gt;-Gazebo/Skull&lt;br /&gt;-Gazebo/ExclamationPoint&lt;br /&gt;-Gazebo/QuestionMark&lt;br /&gt;-Gazebo/SmileyHappy&lt;br /&gt;-Gazebo/SmileySad&lt;br /&gt;-Gazebo/SmileyDead&lt;br /&gt;-Gazebo/SmileyPlain&lt;br /&gt;-Gazebo/WoodFloor&lt;br /&gt;-Gazebo/CeilingTiled&lt;br /&gt;-Gazebo/PaintedWall&lt;br /&gt;-Gazebo/PioneerBody&lt;br /&gt;-Gazebo/Pioneer2Body&lt;br /&gt;-Gazebo/Gold&lt;br /&gt;-Gazebo/CloudySky&lt;br /&gt;-Gazebo/RustySteel&lt;br /&gt;-Gazebo/Chrome&lt;br /&gt;-Gazebo/BumpyMetal&lt;br /&gt;-Gazebo/GrayGrid&lt;br /&gt;-Gazebo/Rocky&lt;br /&gt;-Gazebo/GrassFloor&lt;br /&gt;-Gazebo/Rockwall&lt;br /&gt;-Gazebo/RustyBarrel&lt;br /&gt;-Gazebo/WoodPallet&lt;br /&gt;-Gazebo/Fish&lt;br /&gt;-Gazebo/LightWood&lt;br /&gt;-Gazebo/WoodTile&lt;br /&gt;-Gazebo/Brick&lt;br /&gt;-Gazebo/TransparentTest&lt;br /&gt;-Gazebo/DepthMap&lt;br /&gt;-Gazebo/PCBGreen&lt;br /&gt;-Gazebo/Turret&lt;br /&gt;-Gazebo/EpuckBody&lt;br /&gt;-Gazebo/EpuckRing&lt;br /&gt;-Gazebo/EpuckPlate&lt;br /&gt;-Gazebo/EpuckLogo&lt;br /&gt;-Gazebo/EpuckMagenta&lt;br /&gt;-Gazebo/EpuckGold&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-4925378754106581933?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/4925378754106581933/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2010/09/note-for-ros-stuff.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/4925378754106581933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/4925378754106581933'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2010/09/note-for-ros-stuff.html' title='NOte for ROS stuff : )'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-879791356208617795</id><published>2010-07-28T01:39:00.000-07:00</published><updated>2010-07-28T02:14:21.721-07:00</updated><title type='text'>ROS  Publisher and Subscriber</title><content type='html'>&lt;span style="font-weight: bold;"&gt;ROS publisher &amp;amp; subscriber&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I just note for the important line of code from the ROS wiki.&lt;br /&gt;The code below is used to define publisher in ROS system.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Publisher&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ros::NodeHandle n;&lt;br /&gt;&lt;span class="ID"&gt;ros&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="ID"&gt;Publisher&lt;/span&gt; &lt;span class="ID"&gt;chatter_pub&lt;/span&gt; &lt;span class="SPChar"&gt;=&lt;/span&gt; &lt;span class="ID"&gt;n&lt;/span&gt;&lt;span class="SPChar"&gt;.&lt;/span&gt;&lt;span class="ID"&gt;advertise&lt;/span&gt;&lt;span class="SPChar"&gt;&lt;&lt;/span&gt;&lt;span class="ID"&gt;std_msgs&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="ID"&gt;String&lt;/span&gt;&lt;span class="SPChar"&gt;&gt;&lt;/span&gt;&lt;span class="SPChar"&gt;(&lt;/span&gt;&lt;span class="String"&gt;"chatter"&lt;/span&gt;&lt;span class="SPChar"&gt;,&lt;/span&gt; &lt;span class="Number"&gt;1&lt;/span&gt;&lt;span class="Number"&gt;0&lt;/span&gt;&lt;span class="Number"&gt;0&lt;/span&gt;&lt;span class="SPChar"&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;chatter_put  is Publisher object.&lt;br /&gt;n.advertise&lt;message&gt;("topicname",numberofMessage);&lt;br /&gt;&lt;br /&gt;To publish message, we can use the following code:&lt;br /&gt;&lt;br /&gt;msg.data = datatobepublish;   // assign message for publish&lt;br /&gt;chatter_put.publish(msg);        // Call publish method of Publisher class&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Subscriber&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A subscriber must define callback function that will get called when a new message have arrived on the chatter topic.&lt;br /&gt;&lt;br /&gt;Define callback function:&lt;br /&gt;&lt;br /&gt;void chatterCallback(const std_msgs::StringConstPtr&amp;amp; msg)&lt;br /&gt;{&lt;br /&gt;   ROS_INFO("Received [%s]",msg-&gt;data.c_str());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Define nodeHandle and call subscribe function&lt;br /&gt;&lt;span style="font-family: monospace;"&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ResWord"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ID"&gt;&lt;br /&gt;ros&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="ID"&gt;NodeHandle&lt;/span&gt; &lt;span class="ID"&gt;n&lt;/span&gt;&lt;span class="SPChar"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="ID"&gt;ros&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="SPChar"&gt;:&lt;/span&gt;&lt;span class="ID"&gt;Subscriber&lt;/span&gt; &lt;span class="ID"&gt;chatter_sub&lt;/span&gt; &lt;span class="SPChar"&gt;=&lt;/span&gt; &lt;span class="ID"&gt;n&lt;/span&gt;&lt;span class="SPChar"&gt;.&lt;/span&gt;&lt;span class="ID"&gt;subscribe&lt;/span&gt;&lt;span class="SPChar"&gt;(&lt;/span&gt;&lt;span class="String"&gt;"chatter"&lt;/span&gt;&lt;span class="SPChar"&gt;,&lt;/span&gt; &lt;span class="Number"&gt;1&lt;/span&gt;&lt;span class="Number"&gt;0&lt;/span&gt;&lt;span class="Number"&gt;0&lt;/span&gt;&lt;span class="SPChar"&gt;,&lt;/span&gt; &lt;span class="ID"&gt;chatterCallback&lt;/span&gt;&lt;span class="SPChar"&gt;)&lt;/span&gt;&lt;span class="SPChar"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The line above means that&lt;br /&gt;&lt;br /&gt;nodeObject.subscribe("publisherTopicName",numberOfMsgInQue,callbackFunctionName);&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Reference:  http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29&lt;br /&gt;&lt;br /&gt;&lt;pre dir="ltr" id="roscpp_tutorials.2BAC8-Tutorials.2BAC8-WritingPublisherSubscriber.CA-210224db2b79949cbdd88d3368ce99a4883c7a12" lang="en"&gt;&lt;span class="line"&gt;&lt;span class="SPChar"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-879791356208617795?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/879791356208617795/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2010/07/ros-publisher-and-subscriber.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/879791356208617795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/879791356208617795'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2010/07/ros-publisher-and-subscriber.html' title='ROS  Publisher and Subscriber'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-6755805142589132332</id><published>2009-09-11T23:54:00.000-07:00</published><updated>2009-09-12T00:14:52.675-07:00</updated><title type='text'>Install Subclipse ใน eclipse ganymede</title><content type='html'>1. ใช้ synaptic หรือ sudo apt-get install แพ็กเกจนี้--&gt; libnb-svnclientadapter-java&lt;br /&gt;2. เปิด eclipse ไปที่ Help-&gt;Software Updates-&gt;(Tab)Available Software-&gt;Add Site เติมชื่อเว็บไซต์ดังนี้ http://subclipse.tigris.org/update_1.6.x/&lt;br /&gt;  Note: ชื่อเว็บไซต์ตอน Add site จะแตกต่างกันขึ้นอยู่กับเวอร์ชั่นของ eclipse ที่ใช้ตรวจสอบดูว่าควรจะใช้ update site URL อะไรที่เว็บ &lt;a href="http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA"&gt;subclipse &lt;/a&gt;&lt;br /&gt;3. Add site เสร็จก็ คลิกเลือกเพื่อ install ดังนี้&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_xbEyuCi5nLk/SqtIHJXd_vI/AAAAAAAAABg/IphfxoKz4ps/s1600-h/Screenshot-Software+Updates+and+Add-ons+.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 202px;" src="http://3.bp.blogspot.com/_xbEyuCi5nLk/SqtIHJXd_vI/AAAAAAAAABg/IphfxoKz4ps/s320/Screenshot-Software+Updates+and+Add-ons+.png" alt="" id="BLOGGER_PHOTO_ID_5380473467434827506" border="0" /&gt;&lt;/a&gt;    คลิกปุ่ม install&lt;br /&gt;4. เมื่อการติดตั้งพร้อมก็คลิก Next , accept ละก็ Finish ได้เลย&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-6755805142589132332?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/6755805142589132332/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/09/install-subclipse-eclipse-ganymede.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6755805142589132332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6755805142589132332'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/09/install-subclipse-eclipse-ganymede.html' title='Install Subclipse ใน eclipse ganymede'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xbEyuCi5nLk/SqtIHJXd_vI/AAAAAAAAABg/IphfxoKz4ps/s72-c/Screenshot-Software+Updates+and+Add-ons+.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-8248030891321188819</id><published>2009-09-05T07:46:00.000-07:00</published><updated>2009-09-05T11:22:52.230-07:00</updated><title type='text'>Memo : Hack SURF code in openCV</title><content type='html'>&lt;p&gt;Reference from example(find_obj.cpp) in openCV , there are steps as following:&lt;/p&gt;&lt;p&gt;1. Load source image and destination image with &lt;em&gt;cvLoadImage(filename,CV_LOAD_&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;IMAGE_GRAYSCALE)&lt;/em&gt;&lt;/p&gt;&lt;p&gt;2. Data type &lt;em&gt;cvSURFParams&lt;/em&gt; is used to do something? (Need more documentation) &lt;/p&gt;&lt;p&gt;3. Function &lt;em&gt;cvExtractSURF&lt;/em&gt; is used to extract SURF feature points and descriptors for both source and destination images. By calling &lt;em&gt;cvExtractSURF&lt;/em&gt;, it will give us info about  key points(x and y location) in image and descriptor of each point. These info are kept in &lt;em&gt;CvSeq&lt;/em&gt; data type where objectKeyPoints is used to keep location of key points and  objectDescriptors is used to keep descriptor of each key point.&lt;/p&gt;&lt;p&gt;4. Function &lt;em&gt;findPairs &lt;/em&gt;have iteration based on number of descriptor of sourc image. For each descriptor of source image is compared with every descriptor of destination image. Vector &lt;em&gt;ptPairs&lt;/em&gt; is used to keep index of  correspondence descriptors. &lt;em&gt;ptPairs &lt;/em&gt;kept vector in pair of  source descriptor index and destination descriptor index. (i.e. (1st src descriptor index, index of similar destination descriptor,  2nd src descriptor index, index of similar destination descriptor, 3rd src descriptor index, index of similar destination descriptor,......, nth src descriptor index, index of similar destination descriptor)) &lt;/p&gt;&lt;p&gt;Precisely, even index of &lt;em&gt;ptPairs&lt;/em&gt; will point to source &lt;em&gt;objectKeyPoints &lt;/em&gt;and odd index of &lt;em&gt;ptPairs&lt;/em&gt; will point to destination  &lt;em&gt;imageKeyPoints&lt;/em&gt;. Now , you will get point correspondences between two image. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-8248030891321188819?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/8248030891321188819/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/09/surf-implementation-explanation-in.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/8248030891321188819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/8248030891321188819'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/09/surf-implementation-explanation-in.html' title='Memo : Hack SURF code in openCV'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-888051441872762619</id><published>2009-09-04T00:28:00.000-07:00</published><updated>2009-09-04T08:25:11.243-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='opencv installation'/><title type='text'>Installation openCV on Ubuntu 9.04</title><content type='html'>วันนี้ทำการลง openCV ใหม่หลังจากลงอุบุนตุใหม่ ประกอบกับจำไม่ได้ว่า&lt;br /&gt;ครั้งก่อนลงไปแล้วไม่ได้จดวิธีลงไว้ ลงอีกครั้งเลยขอจดไว้ก่อน เผื่อคราวหน้า&lt;br /&gt;ลงอุบุนตุใหม่จะได้ไม่มานั่งงมอีก&lt;br /&gt;&lt;br /&gt;อ้างอิงการลง openCV บน Ubuntu 9.04 จาก&lt;br /&gt;&lt;a href="http://webeng.cs.ait.ac.th/cvwiki/opencv:tutorial:install:ubuntu"&gt;&lt;br /&gt;http://webeng.cs.ait.ac.th/cvwiki/opencv:tutorial:install:ubuntu&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(Thanks อ.แมท(&lt;a href="http://www.cs.ait.ac.th/%7Emdailey"&gt;Dr.Matthew@AIT&lt;/a&gt;)for very useful installation guide)&lt;br /&gt;ซึ่งมีขั้นตอนดังนี้&lt;br /&gt;&lt;br /&gt;1. ใช้ synaptic ติดตั้ง libgstreamer0.10-dev และ libdc1394-13-dev&lt;br /&gt;2. ดาวน์โหลด opencv 1.1.0 ได้จาก &lt;a href="http://opencv.willowgarage.com/wiki/"&gt;openCV wiki&lt;/a&gt;&lt;br /&gt;3. แตกไฟล์ opencv-1.1pre1.tar.gz โดยใช้คำสั่ง tar -xvfz opencv-1.1pre1.tar.gz&lt;br /&gt;4. ในไดเรกทอรี่ของ opencv-1.1.0 พิมพ์คำสั่ง(ให้เหมือนอันนี้เลยนะ เครื่องหมาย=พิมพ์ให้ติดprefix)&lt;br /&gt;./configure --prefix=${HOME}/opencv --without-xine --without-quicktime --with-gstreamer --with-1394libs --with-v4l&lt;br /&gt;5. ในไดเรกทอรี่ของ opencv-1.1.0 พิมพ์คำสั่ง&lt;br /&gt;make&lt;br /&gt;6. เมื่อ make เสร็จ ก็พิมพ์&lt;br /&gt;make install&lt;br /&gt;เพื่อติดตั้ง opencv ได้เลยโดย opencv จะไปติดตั้งอยู่ที่ /home/jednipat/opencv ตามไดเรคทอรี่ที่ระบุไว้ตอนรัน ./configure&lt;br /&gt;7. พิมพ์&lt;br /&gt;export LD_LIBRARY_PATH=/home/jednipat/opencv/lib&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;เมื่อ make install เสร็จ ก็ลองมารัน example ที่ opnecv ให้มาโดยคอมไพล์ดังนี้&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;g++ -o outputname yourfilename.c -I /home/jednipat/opencv/include/opencv/ -lhighgui -L /home/jednipat/opencv/lib/&lt;/span&gt; &lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;กรณีของผมคอมไพล์ผ่านแต่พอรันแล้ว เจอ error ดังนี้ (เนื่องจากผมลืมทำข้อ 7)&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family:arial;"&gt;&lt;br /&gt;error while loading shared libraries: libhighgui.so.2: cannot open&lt;br /&gt;shared object file: No such file or directory&lt;/span&gt;  &lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;เลยค้นวิธีแก้ได้มาจากบล็อกของ &lt;a href="http://dsin.blogspot.com/2009/07/opencv-in-gedit.html"&gt;dsin (พี่พง)&lt;/a&gt; สาเหตุเป็นเพราะว่ายังไม่ได้ export LD_LIBRARY_PATH ซึ่งก็ทำได้ดังนี้&lt;/span&gt;  &lt;pre style="font-family: arial;"&gt;export LD_LIBRARY_PATH=/home/jednipat/opencv/lib&lt;br /&gt;&lt;br /&gt;ที่นี้คิดว่าน่าจะรันได้ตามปกติ ลองคอมไพล์และรัน example ดูอีกที คอมไพล์ผ่าน&lt;br /&gt;แต่พอรันปุ๊ป เจอกับ&lt;br /&gt;&lt;br /&gt;OpenCV ERROR: Unspecified error (The function is not implemented.&lt;br /&gt;Rebuild the library with Windows, GTK+ 2.x or Carbon support)&lt;br /&gt;in function cvNamedWindow, window.cpp(71)&lt;br /&gt;Terminating the application...&lt;br /&gt;Segmentation fault&lt;br /&gt;&lt;br /&gt;อ๊ากก... ค้นไปค้นมาอีกก็ได้คำแนะนำจาก&lt;a href="http://software.intel.com/en-us/forums/intel-integrated-performance-primitives/topic/53833/"&gt;เว็บนี้&lt;/a&gt;  &lt; - - คลิก  คอมเมนต์สุดท้ายบอกไว้ว่าสาเหตุมาจากตอนรัน ./configure และ make ไม่มี gtk+ lib dev ไม่มีเขาแนะนำให้ remove openCV ออกก่อน แล้วไปลง libgtk2.0-dev (เข้า synaptic package management แล้ว search คำว่า libgtk2.0-dev ละก็ mark for installation - &gt; apply )&lt;br /&gt;&lt;br /&gt;เมื่อลง libgtk2.0-dev เสร็จให้ uninstall openCV  ก่อนโดยพิมพ์ make uninstall&lt;br /&gt;ในไดเรคทอรี่ opencv-1.1.0 จากนั้นเพื่อความชัวร์ควรจะ restart เครื่องก่อน&lt;br /&gt;(ผมไม่รีสตาร์ทเครื่อง  make ใหม่ก็เจอปัญหาเดิม เลยลอง รีสตาร์ทเครื่อง แล้วทำใหม่)&lt;br /&gt;&lt;br /&gt;แล้วทำการ ./configure , make , make install อีกที&lt;br /&gt;&lt;br /&gt;1&gt;  ./configure blablabla..&lt;br /&gt;2&gt;  make&lt;br /&gt;3&gt;  make install&lt;br /&gt;4&gt;  export LD_LIBRARY_PATH=/home/jednipat/opencv/lib&lt;br /&gt;&lt;br /&gt;จากนั้นไปยัง directory  /home/jednipat/opencv-1.1.0/samples/c&lt;br /&gt;แล้วลองคอมไพล์ไฟล์ใด ๆ ผมเลือกไฟล์ตัวอย่างการใช้งาน SURF descriptor&lt;br /&gt;ชื่อไฟล์ว่า find_obj.cpp คอมไพล์ด้วยคำสั่งดังนี้&lt;br /&gt;&lt;br /&gt;g++ find_obj.cpp -o test -I /home/jednipat/opencv/include/opencv/ -lhighgui&lt;br /&gt;-L /home/jednipat/opencv/lib/&lt;br /&gt;&lt;br /&gt;จากนั้นรัน ./test เพื่อดูผลลัพธ์ของโปรแกรม&lt;br /&gt;&lt;br /&gt;เย้... สำเร็จ..&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-888051441872762619?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/888051441872762619/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/09/installation-opencv-on-ubuntu-910.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/888051441872762619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/888051441872762619'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/09/installation-opencv-on-ubuntu-910.html' title='Installation openCV on Ubuntu 9.04'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-8873794312200062520</id><published>2009-07-05T09:21:00.000-07:00</published><updated>2009-07-05T13:54:54.961-07:00</updated><title type='text'>How to computing camera matrix P</title><content type='html'>1. ทำการแรนดอมดาต้าของจุดใน 3D มาก่อน โดยทำการแรนดอมโดยฟิกค่าเฉลี่ยของระยะบนแกน Z อยู่ที่ 5 แล้วทำการแรนดอมค่าให้ได้เมตริกซ์ขนาด 4x30 โดยแต่ละคอลัมน์ของเมตริกซ์แสดงถึงค่าของ [ x ; y ; z+5; 1] ซึ่งผลลัพธ์ของขั้นตอนแรกนี้จะได้เมตริกซ์ลักษณะนี้ Xw= [x1,x2,....,x30 ; y1,y2,....,y30; z1+5,z2+5,...,z30+5;1,1,......,1]4x30  (Xw เป็นชื่อเมตริกซ์นะ)&lt;br /&gt;&lt;br /&gt;2.จากนั้นทำการกำหนดค่า intrinsic camera parameter ลงในเมตริกซ์ขนาด 3x3 ดังนี้ K = [ 320 0 320 ; 0 320 240 ; 0 0 1 ]3x3 ในกรณีนี้ principal point ถูกเซ็ตค่าอยู่ที่ px=320(K(1,3)) py=240(K(2,3))&lt;br /&gt;&lt;br /&gt;3.หลังจากกำหนดค่า intrinsic camera parameter แล้วก็ต้องกำหนด extrinsic camera parameter ด้วย กรณีนี้ให้ Rotation matrix มีค่าดังนี้ [1 0 0 ; 0 1 0 ; 0 0 1]3x3 และยังไม่มีการ translate จึงได้เมตริกซ์ t = [ 0 ; 0 ; 0 ] เมื่อได้ทั้ง extrin และ intrin แล้วจะได้เมตริกซ์ของกล้อง P ดังนี้ P = K*[ R t ] ซึ่งได้ผลลัพธ์ดังนี้ P= [320 0 320 0; 0 320 240 0; 0 0 1 0]3x4 เมตริกซ์ P นี้จะเป็นเมตริกซ์ที่ใช้ในการฉายภาพจากวัตถุใน 3D ลงมายังฉาก 2D (กล่าวคือ เปลี่ยนพิกัด 3D เป็น 2D บนภาพนั่นเอง)&lt;br /&gt;&lt;br /&gt;4. เมื่อได้ P แล้วก็นำจุดที่แรนดอม Xw มาโปรเจคลงบนฉากโดยเราจะเรียกว่าเป็นการโปรเจคแบบอุดมคติ (ideal projection) โดยแต่ละจุดบนฉากจะแทนด้วยเมตริกซ์ x โดยที่ x = P*Xw ซึ่งมีขนาด 3x30 ซึ่งแต่ละคอลัมน์ของเมตริกซ์นี้จะเป็นจุดที่มีค่าทั้งแกน x , y และ z  จากหลักการของ homogeneous matrix การแปลงจุดจาก 3D (x,y,z) สามารถแปลงไปเป็นจุดบนฉากได้โดยการนำ z ไปหาร x และ y ซึ่งจะได้พิกัดบนฉาก 2D เราจึงได้จุด (x/z,y/z) มาถึงตอนนี้เราจะได้พิกัดบนฉาก 2D ละ โดยเราเก็บจุดทั้ง 30 จุดไว้ในเมตริกซ์ x เหมือนเดิม เพื่อง่ายต่อการเข้าใจเราใช้คำสั่งนี้เพื่อให้ได้เมตริกซ์ของจุด 30 จุดบนฉาก2D x=x./repmat(x(3,:), 3 , 1 ) (ผลลัพธ์จะได้พิกัดจุดบนฉาก 30 จุด ซึ่งแถวที่สามในทุกคอลัมน์ของเมตริกซ์จะเป็น 1 หมด)&lt;br /&gt;&lt;br /&gt;5.จากนั้นเราจะทำการเพิ่ม gaussian noise และทำเมตริกซ์ให้เป็น discrete มากขึ้นโดยการแรนดอมค่าระหว่าง 0 ถึง 1 แล้วบวกเข้ากับแถว 1 และ 2 ในเมตริกซ์ x จากนั้นก็ round (ปัดทศนิยมทิ้ง) แล้วเก็บไว้ในเมตริกซ์ x อันเดิม&lt;br /&gt;&lt;br /&gt;6.หาค่าเฉลี่ยระยะห่างของจุดทั้ง 30 จุดใน 3D (ใช้ค่าในเมตริกซ์ Xw) กับตำแหน่งของกล้อง(ในที่นี้ตำแหน่งกล้องอยู่ที่ 0,0,0) โดยใช้ avg_dist_to_cam = mean( sqrt( sum(( Xw(1:3,:) - repmat( C, 1, n )).^2))); คำสั่งนี้จะทำการหาค่าระยะห่างระหว่างตำแหน่งกล้องและจุด 3D 30 จุด โดยในแต่ละคอลัมน์จะคำนวณดังนี้  ระยะห่างจากกล้องถึงจุด3D = sqrt((x-0)^2  + (y-0)^2 + (z-0)^2) (สาเหตุที่ x, y ,z ลบด้วย 0 เพราะว่า camera อยู่ที่ 0,0,0) ณ ขั้นตอนนี้เมตริกซ์ 3x30 เราจะถูกยุบเหลือ 1x30 แล้วเนื่องจากคำสั่ง sum จะทำการบวกแถวในแต่ละคอลัมน์นั่นเอง  เมื่อ sum และ sqrt แล้วสิ่งที่เราได้ตอนนี้คือค่าระยะห่างจากกล้องถึงจุดทั้ง 30 จุดซึ่งเป็นเมตริกซ์ 1x30 นั่นเอง จากนั้นเราใช้คำสั่ง mean เพื่อหาค่าเฉลี่ยระยะห่างจากกล้องถึงจุดทั้ง 30 จุด แล้วเก็บไว้ในตัวแปร avg_dist_to_cam&lt;br /&gt;&lt;br /&gt;7.ทำการนอร์มอลไลซ์ homogeneous coordinate&lt;br /&gt;  Xw = Xw ./ repmat( Xw(4,:), 4, 1 ); &lt;--- จุดใน 3D&lt;br /&gt;  x = x ./ repmat( x(3,:), 3, 1 ); &lt;-- จุดบนฉาก 2D&lt;br /&gt;&lt;br /&gt;8.หา isotropic scaling เพื่อ normalize x กับ Xw (isotropic scaling คือ sx = sy = sz)&lt;br /&gt;สำหรับ 3D จะหาเมตริกซ์ transform เพื่อจะนำจุดcentroid(ของจุดทั้ง 30 จุด)กลับมายัง origin โดยจะคำนวณ centroid ของจุดใน 3D โดยใช้ค่าเฉลี่ยของแต่ละแกน (x1+x2+...+x30)/30   แกน y ก็หาโดย (y1+y2+...+y30)/30 แกนz ก็หาโดย (z1+z2+...+z30)/30 ก็จะได้ centroid ของ จุด 30 จุด แต่เราจะต้องใส่เครื่องหมายลบให้ค่าของ centroid เนื่องจาก เป็นการนำ centroid กลับมายัง origin โดยใช้คำสั่งใน octave ดังนี้ Ttrans = [ eye( k ), -mean( Xw(1:k,:)' )' ; zeros( 1, k ), 1 ]; Ttrans คือเมตริกซ์ขนาด 4x4 ที่มีลักษณะดังนี้ [ 1, 0 , 0 , ค่าที่ใช้ย้ายในแกนx ;  0 , 1 , 0 , ค่าที่ใช้ย้ายในแกนy ; 0 , 0 , 1 , ค่าที่ใช้ย้ายในแกนz ; 0 , 0 , 0 ,1 ]4x4 (หากใครเคยเรียนCG มาคงคุ้น ๆ กับเมตริกซ์นี้ ซึ่งมันก็คือเมตริกซ์ที่เราใช้ในการ translate นั่นเอง)&lt;br /&gt;มาถึงตอนนี้แล้วเราได้เมตริกซ์ที่ translate centroid มายัง 0,0,0 แล้ว ก็ใช้ให้มันเป็นประโยชน์ โดยการนำเมตริกซ์นี้มาใช้หาตำแหน่งของจุดทั้ง 30 จุดโดยอ้างอิงจากจุด 0,0,0 (แต่เดิมจุด30จุดมันไม่ได้อ้างอิงจากจุด 0,0,0 การจะ rotate , scale ก็ทำยากมากมาย) traslated_Xw = Ttrans*Xw ; (คูณเมตริกซ์เหมือน CG เลย เอา translate เมตริกซ์ไว้ข้างหน้าจุดไว้ด้านหลัง ไม่ใช่ Xw*Ttrans นะ)&lt;br /&gt;เมื่อได้ translated_Xw แล้ว เราต้องหา scaling factor ที่เหมาะสมให้กับจุดทั้ง30จุดใน translated_Xw โดยหาระยะห่างจากจุดทั้ง 30 จุดกับ origin แล้วหาค่าเฉลี่ยรวมของระยะห่างทั้ง 30 จุด ดังนี้  s=sqrt(k)/mean(sqrt(sum(translatedXw(1:k,:).^2))) โดย k = size(Xw,1)-1  เมื่อได้ s แล้วเราก็จะสามารถสร้าง Tscale เมตริกซ์ซึ่งใช้สำหรับการสเกลได้ (ซึ่งเมตริกซ์นี้จะทำการ scale ทั้งแกน x,y,z เท่ากันเพราะใช้ s ตัวเดียวกัน หรือเรียกอีกอย่างว่าเป็น isotropic scale ไงล่ะ) ใช้คำสั่ง octave ได้ดังนี้ Tscale = [ s * eye(k), zeros(k,1) ; zeros(1,k), 1 ]; ซึ่ง Tscale จะมีลักษณะดังนี้ [ s , 0 , 0 ,0 ; 0 , s ,0 ,0 ; 0 , 0 , s , 0 ; 0 , 0 , 0 , 1 ]4x4 (เหมือนเช่นเคยมันคือเมตริกซ์ scaling ใน CG อีกนั่นเอง)&lt;br /&gt;&lt;br /&gt;มาถึงตอนนี้เราได้เมตริกซ์ Trans(late) และ Tscale แล้ว จัดการรวมร่างมันซะ ให้ได้ Transform matrix ทำได้ดังนี้ T_for_Xw = Tscale*Trans;&lt;br /&gt;&lt;br /&gt;ขั้นตอนที่กล่าวมานี้อธิบายสำหรับเมตริกซ์ Xw (จุดใน 3D) ซึ่งยังไม่จบ เราต้องหา Transform matrix สำหรับ 2D ด้วย ซึ่งก็ทำเหมือนกันเพียงแต่ค่า k จะเปลี่ยนเป็น k=size(x,1)-1&lt;br /&gt;Ttrans = [ eye( k ), -mean( x(1:k,:)' )' ; zeros( 1, k ), 1 ];&lt;br /&gt;translated_x = Ttrans*x;&lt;br /&gt;s=sqrt(k)/mean(sqrt(sum(translated_x(1:k,:).^2)));&lt;br /&gt;Tscale = [ s * eye(k), zeros(k,1) ; zeros(1,k), 1 ];&lt;br /&gt;T_for_x=Tscale*Ttrans;&lt;br /&gt;&lt;br /&gt;9. เมื่อได้ transform matrix มาแล้วเราก็ทำการ transform ทั้งจุดใน 3D(Xw) และก็จุดในฉาก(x) กันเลย โดยใช้คำสั่งดังนี้&lt;br /&gt;xtilde = T_for_x*x;&lt;br /&gt;Xwtilde = T_for_Xw*Xw;&lt;br /&gt;&lt;br /&gt;10. เมื่อได้จุดที่ถูก transform แล้วเราจะมาประมาณค่าแบบเชิงเส้นของเมตริกซ์ P (เมตริกซ์ของกล้อง) โดยใช้ DLT algorithm เพื่อประมาณค่า P (DLT algorithm ไว้จะมาอธิบายวันหลัง) แต่มีโค้ดดังนี้&lt;br /&gt;%------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;function P = dlt( xtilde, Xwtilde )&lt;br /&gt;&lt;br /&gt;  n = size( Xwtilde, 2 );&lt;br /&gt;  if n &lt; 6&lt;br /&gt;    error( 'DLT for P requires at least 6 points' );&lt;br /&gt;  end;&lt;br /&gt;&lt;br /&gt;  A = [];&lt;br /&gt;&lt;br /&gt;  for i = 1:n&lt;br /&gt;&lt;br /&gt;    xi = xtilde( 1, i );&lt;br /&gt;    yi = xtilde( 2, i );&lt;br /&gt;    wi = xtilde( 3, i );&lt;br /&gt;    Xwi = Xwtilde( :, i );&lt;br /&gt;&lt;br /&gt;    Ai = [ 0, 0, 0, 0,   -wi * Xwi',    yi * Xwi' ;&lt;br /&gt;            wi * Xwi',   0, 0, 0, 0,   -xi * Xwi' ];&lt;br /&gt;&lt;br /&gt;    A = [ A ; Ai ];&lt;br /&gt;  end;&lt;br /&gt;&lt;br /&gt;  [U,D,V] = svd( A );&lt;br /&gt;&lt;br /&gt;  % The solution P minimizing |Ap| subject to |p|=1 is the last column of V&lt;br /&gt;&lt;br /&gt;  P = reshape( V(:,12), 4, 3 )';&lt;br /&gt;  P = P / norm(P(3,1:3));&lt;br /&gt;&lt;br /&gt;%------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-8873794312200062520?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/8873794312200062520/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/07/how-to-computing-camera-matrix-p.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/8873794312200062520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/8873794312200062520'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/07/how-to-computing-camera-matrix-p.html' title='How to computing camera matrix P'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-1369932438488948977</id><published>2009-06-27T23:06:00.000-07:00</published><updated>2009-07-05T13:56:30.998-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javac'/><title type='text'>'javac' is not recognized as an internal or external command, operable program or batch file.</title><content type='html'>'javac' is not recognized as an internal or external command, operable program or batch file.&lt;br /&gt;&lt;br /&gt;วิธีแก้ไข&lt;br /&gt;&lt;code style="font-family: courier new;" class="jive-code jive-java"&gt;พิมพ์เซ็ตค่า PATH ใน Command line โดยระบุ directory ที่มีไฟล์ javac.exe อยู่ สำหรับตัวอย่างด้านล่าง javac.exe ถูกเก็บอยู่ที่&lt;br /&gt;&lt;br /&gt;C:\Program Files\Java\jdk1.6.0_11\bin&lt;br /&gt;&lt;br /&gt;ดังนั้นใน Command line จึงพิมพ์เซ็ต path ตามนี้&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;code class="jive-code jive-java"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new;"&gt;&gt;&gt; set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_11\bin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;หรือสามารถเซ็ตค่า PATH ได้อีกวิธีหนึ่งโดย คลิกขวาที่ MyComputer เลือก Properties จากนั้นเลือกแท็บ Advanced จากนั้นคลิ๊กตรง Environment Variables จากนั้นในหน้าต่าง System Variables ให้เลือก Variable ชื่อ PATH  แล้วคลิก Edit จากนั้นเพิ่ม path ที่เก็บ javac.exe เข้าไปต่อท้าย value เดิมดังนี้&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;valueที่มีอยู่เดิม;C:\Program Files\Java\jdk1.6.0_11\bin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;แต่ถ้าไม่มี variable ชื่อ PATH ให้สร้าง variable ใหม่ชื่อ PATH จากนั้นเพิ่ม value เข้าไปดังนี้&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;C:\Program Files\Java\jdk1.6.0_11\bin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;จากนั้นกด OK แล้วทดลองใช้ javac ใน command line ได้เลย ^_^&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-1369932438488948977?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/1369932438488948977/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/06/javac-is-not-recognized-as-internal-or.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/1369932438488948977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/1369932438488948977'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/06/javac-is-not-recognized-as-internal-or.html' title='&apos;javac&apos; is not recognized as an internal or external command, operable program or batch file.'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-6525843740775052662</id><published>2009-06-27T02:45:00.000-07:00</published><updated>2009-06-27T03:25:27.148-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perspective camera model'/><title type='text'>Perspective Camera Model</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_xbEyuCi5nLk/SkXzHEHOZYI/AAAAAAAAAA4/Li-OnyLEX8M/s1600-h/Perspective+Camera+Models_1246096002024.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 287px; height: 264px;" src="http://2.bp.blogspot.com/_xbEyuCi5nLk/SkXzHEHOZYI/AAAAAAAAAA4/Li-OnyLEX8M/s320/Perspective+Camera+Models_1246096002024.png" alt="" id="BLOGGER_PHOTO_ID_5351951034888381826" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;Reference pic from:&lt;/span&gt; http://www1.cs.columbia.edu/~jebara/htmlpapers/SFM/node6.html&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;จากภาพจุดสีแดงคือ 3D feature point ซึ่งกำลังถูกฉายภาพลงไปบนระนาบภาพ II ด้วยเส้น perspective โดยมีจุดศูนย์กลางการฉายภาพที่จุดสีเขียว(COP)&lt;br /&gt;&lt;br /&gt;f คือระยะห่างจาก COP ไปถึงระนาบภาพ(image plane) ไปตามแนวแกน z&lt;br /&gt;&lt;br /&gt;การฉายภาพของ COP ไปยังระนาบภาพไปตามแนวแกน z (optimal axis หรือ principal axis) เรียกว่า principal point&lt;br /&gt;&lt;br /&gt;โดยปกติทั่วไปแล้ว f จะถูกเซ็ตเป็น 1 เพื่อความง่ายในการแสดงสมการ  และ f จะเปลี่ยนแปลงเฉพาะ scaling ของภาพ เขียนสมการได้ดังนี้&lt;br /&gt;&lt;br /&gt;       [ u ; v]2x1 = [ X ; Y]2x1*(f/Z)&lt;br /&gt;&lt;br /&gt;สำหรับในกล้องทั่วไปจะมีตัวแปรทางเรขาคณิตอื่นอีก&lt;br /&gt;&lt;br /&gt;   [u ; v]2x1 = K*[ X ; Y ; Z]3x1&lt;br /&gt;&lt;br /&gt;ซึ่ง&lt;br /&gt;&lt;br /&gt;   K =  [ sx sseta u0 ;  0 sy  vo]2x3&lt;br /&gt;     sx และ sy คือ scaling ของระนาบภาพตามแนวแกน X และแกน Y&lt;br /&gt;     sseta คือ ตำแหน่งที่เบนไประหว่างแกน X และแกน Y และ (uo,vo) ซึ่งเป็นพิกัดของ principal point&lt;br /&gt;                  ในระนาบภาพ&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="file:///C:/DOCUME%7E1/jednipat/LOCALS%7E1/Temp/moz-screenshot-2.jpg" alt="" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-6525843740775052662?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/6525843740775052662/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/06/perspective-camera-model.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6525843740775052662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6525843740775052662'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/06/perspective-camera-model.html' title='Perspective Camera Model'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_xbEyuCi5nLk/SkXzHEHOZYI/AAAAAAAAAA4/Li-OnyLEX8M/s72-c/Perspective+Camera+Models_1246096002024.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-432452824553914808</id><published>2009-06-22T11:48:00.000-07:00</published><updated>2009-06-22T12:15:58.621-07:00</updated><title type='text'>Camera self-calibration</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Camera calibration&lt;/span&gt; is the recovery of intrinsic parameters of camera.        The standard off-line calibration procedure is to acquire images of an object         with known Euclidean structure and &lt;span style="font-style: italic;"&gt;compute the camera matrix that minimizes the         error between the image of the object and its reprojection&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Self-calibration&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;methods&lt;/span&gt;  can be used when no Euclidean information is available , and, if properly designed,  can also cope with varying &lt;span style="font-style: italic;"&gt;intrinsic parameters&lt;/span&gt;. If the intrinsic parameters are wrong, the reconstruction         will suffer from a projective distortion even if the motion         is correct.&lt;br /&gt;&lt;br /&gt;Reference จาก http://mi.eng.cam.ac.uk/~prdsm2/Research/SelfCalibration/&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Type of camera parameters&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;Extrinsic camera parameters : the parameters that define the location and orientation&lt;br /&gt;of the camera reference frame with respect to a known world reference frame.&lt;br /&gt;These are the parameters that identify uniquely the &lt;span style="font-style: italic;"&gt;transformation between the&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;unknown camera reference frame and the known world reference frame&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Intrinsic camera parameters: the parameters necessary to link the pixel coordinates of&lt;br /&gt;an image point with the corresponding coordinates in the camera reference frame.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Reference : http://www.cse.unr.edu/~bebis/CS791E/Notes/CameraParameters.pdf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-432452824553914808?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/432452824553914808/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/06/camera-self-calibration.html#comment-form' title='0 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/432452824553914808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/432452824553914808'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/06/camera-self-calibration.html' title='Camera self-calibration'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-369473332761631712.post-6230639161203556583</id><published>2009-06-02T20:37:00.000-07:00</published><updated>2009-06-02T20:54:18.257-07:00</updated><title type='text'>Hello Blogspot</title><content type='html'>Hello Blogspot . Sir_IVY begins with blogspot. ^_^&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/369473332761631712-6230639161203556583?l=sirivy2.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sirivy2.blogspot.com/feeds/6230639161203556583/comments/default' title='ส่งความคิดเห็น'/><link rel='replies' type='text/html' href='http://sirivy2.blogspot.com/2009/06/hello-blogger.html#comment-form' title='1 ความคิดเห็น'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6230639161203556583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/369473332761631712/posts/default/6230639161203556583'/><link rel='alternate' type='text/html' href='http://sirivy2.blogspot.com/2009/06/hello-blogger.html' title='Hello Blogspot'/><author><name>sir_ivy</name><uri>http://www.blogger.com/profile/07786480210076509895</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://4.bp.blogspot.com/_xbEyuCi5nLk/TKXqUTJ7lkI/AAAAAAAAAG0/iibSaZD119g/S220/44848_148460315176554_100000377592686_305042_7697111_n.jpg'/></author><thr:total>1</thr:total></entry></feed>
