ข้ามไปที่เนื้อหาหลัก

บทความ

กำลังแสดงโพสต์จาก กันยายน, 2010

QR decomposition from RQ decomposition

just reverse process here For example, Given, M = [1.177 -0.0372159 -0.00193271 ; -0.000159094 1.25581 0.0460427 ; 0.115352 0.0235739 0.993045 ; ] If we do qr decomposition directly, we will have >> [R,K] = qr(M) R = -0.9952 0.0020 -0.0975 0.0001 -0.9998 -0.0216 -0.0975 -0.0215 0.9950 K = -1.1826 0.0349 -0.0949 0 -1.2561 -0.0674 0 0 0.9873 Anyway, we can use RQ, we reverse the cols, then transpose M another_M = [-0.00193271 0.0460427 0.993045 ; -0.0372159 1.25581 0.0235739 ; 1.177 -0.000159094 0.115352 ; ] then [another_K another_R] = rq(another_M) another_R = [-0.097518 -0.021568 0.995 ; -0.00196984 0.999767 0.0214782 ; -0.995232 0.000134525 -0.0975378 ; ] another_K = [0.987275 0.0673646 -0.0949297 ; 0 1.2561 0.034908 ; 0 0 -1.18264 ; ] We transpose another_R, then reverse the cols. We will have R. R = -0.9952 -0.0020 -0.0975 0.0001 0.9998 -0.0216 -0.0975 0.0215 0.9950 We transpose another_K

cvFindFundamentalMat in OpenCV 2 and OpenCV 2.1

just note that In cvFindFundamentalMat, if you pass CV_8S status in OpenCV 2.1 it will have an error like this OpenCV Error: Assertion failed (src.depth() == dst.depth() && src.size() == dst.size()) in cvCopy, file /mnt/disk/AIT/OpenCV/OpenCV-2.1.0/src/cxcore/cxcopy.cpp, line 466 terminate called after throwing an instance of 'cv::Exception' what(): /mnt/disk/AIT/OpenCV/OpenCV-2.1.0/src/cxcore/cxcopy.cpp:466: error: (-215) src.depth() == dst.depth() && src.size() == dst.size() in function cvCopy Aborted The type should be CV_8UC1 which is worked with both version

โปรแกรม วิธี ศึกษา วิชา คณิตศาสตร์ แบบสนุกๆ

ได้ลองเล่น โปรแกรม ทาง การศึกษา ฟรีๆ บน iPhone 2 ตัว มาได้สักพัก เห็นว่า น่าสนใจดี เลยเอามา แนะนำ ต่อ ตามนี้ 1. Formulas Free เป็นการรวมสูตร เลข ไว้บน มือถือ ( คล้ายๆ หนังสือสรุปสูตร สอบเอ็นทรานซ์ ENT' เล่มเล็กๆ ที่ขายกัน ) มีตั้งแต่ Algebra ง่ายๆ อย่างเช่น พวก สูตรพื้นที่วงกลม, ค่าสัมบูรณ์, logarithm, Matrix, จนไปถึง สูตร diff, integrate, การแก้สมการ diff equation order 1, order 2 หรือแม้กระทั่ง Laplace transform 2. Quick Graph โปรแกรม plot กราฟ สุดเจ๋ง ใส่สมการลงไปก็ plot ได้เลย มี interface สวยงาม plot 3 มิติ เป็น surface ได้ด้วยนะ เจ๋งจริงๆ QuickGraph ถ้าอยู่บน PC ก็ใช้เป็น gnuplot plot ได้เยอะแยะมากมายเหมือนกัน ส่วนเจ้าตัว Formula Free ที่เห็นรวมๆ อยู่บนเวปไม่เห็นจะมี wiki ก็น้ำเยอะ แต่ก็เป็นทางออกที่ดีระดับนึง วันนี้คุ้ยๆ มา เลยไปเจอ mathworld.wolfram เห็นท่าจะดีสุดในตอนที่เขียนนี้ แต่มัน search ตรงๆ ไม่ได้ มีทริกนิดหน่อย เช่น จะหาสมบัติการคูณ Matrix หาคำว่า Matrix จะไม่เจอ ต้อง search ว่า ' Matrix Multiplication ' ( ซึ่งวิธี search แบบนี้เอาไปใช้ กับ wiki ได้ด้วย

ลอง point -I -l -L ด้วย pkg-config

จากการตามไปดู build_all.sh พบว่า มันใช้ pkg-config ด้วยความสงสัยว่า มันเป็นอะไรยังไง เลยลองรันดู $ pkg-config opencv --cflags -I/home/dsin/opencv/include/opencv $ pkg-config opencv --libs -L/home/dsin/opencv/lib -lcxcore -lcv -lhighgui -lcvaux -lml $ pkg-config opencv --cflags --libs -I/home/dsin/opencv/include/opencv -L/home/dsin/opencv/lib -lcxcore -lcv -lhighgui -lcvaux -lml ว้าว เจ๋งแหะ ถ้าเป็นอย่างนี้ เราสามารถ ลง library ไว้ในที่ต่างกัน ในคนละเครื่องได้ ย้าย library ไปยังที่อื่นๆ ได้ โดยไม่ต้องเปลี่ยนตัวแปร เยอะแยะ ใน Makefile แค่เปลี่ยน PKG_CONFIG_PATH ซึ่งเป็นตัวแปรที่เป็นอิสระจาก svn ได้ วิธีทำ คือ 1. export PKG_CONFIG_PATH=${HOME}/opencv/lib/pkgconfig 2. ซึ่งในโฟลเดอร์ ${HOME}/opencv/lib/pkgconfig มีไฟล์ opencv.pc อยู่ ซึ่งวิธีเขียน เป็นตามนี้ # Package Information for pkg-config prefix=/home/dsin/opencv exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include/opencv Name: OpenCV Description: Intel(R) Open Source Computer Vision Library Version: 1.1.0 Lib

howto Rotate Rotation matrix from relative frame back to reference frame [ subsequent rotation ]

As we know that the angle from 'pitch, roll, yaw' is measured from first reference frame . Even though, we have subsequent frame. For example, if we rotate 90 degree around x axis, then rotate 90 degree around y axis. we noticed from the last couple that it is rotate 90 around y axis of the first frame ( not -90 degree around z axis in the secound frame ) We can use rotation formula, like R = RyRx However, in some case, if we want to use the the rotated frame as a reference frame, ( for example, -90 degree around z axis in the second frame, in this case ), we can do that and the formula to convert from rotated frame to the first reference frame is BRB -1 or BRB T ( because the rotation matrix is orthonormal ) for example, from the example above we rotate 90 degree around x axis and then 90 degree around y axis, so R = RyRx octave:1> [0 0 1;0 1 0;-1 0 0]*[1 0 0;0 0 -1;0 1 0] ans = 0 1 0 0 0 -1 -1 0 0 if we want to rotate 90 around x axis and then -90 degree arou

[ OpenCV ] read yaml file

File to read %YAML:1.0 calibration_time: "Wed 08 Sep 2010 01:49:24 PM ICT" image_count: 10 image_width: 640 image_height: 480 board_width: 8 board_height: 6 square_size: 3. flags: 0 camera_matrix: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 7.0670231633826893e+02, 0., 2.9776351172468094e+02, 0., 7.0623929245059901e+02, 2.6088449526885739e+02, 0., 0., 1. ] distortion_coefficients: !!opencv-matrix rows: 1 cols: 4 dt: d data: [ -5.8713493296008348e-02, 3.5972311978605072e-02, 1.0258503131952429e-02, -2.5861511364179125e-04 ] avg_reprojection_error: 2.8090511932969092e-01 per_view_reprojection_errors: !!opencv-matrix rows: 1 cols: 10 dt: d data: [ 3.5422265529632568e-01, 3.9157994588216144e-01, 1.9369331995646158e-01, 2.4840275446573892e-01, 1.7604033586879572e-01, 2.6437775293986004e-01, 2.4450556437174478e-01, 2.3067680994669595e-01, 4.2982764355838299e-01, 2.7572441101074219e-01 ] Example char *out_filename = "/home/dsin/Pursuit/Project/pursuit/c

[ ROS ] PR2 axis coordinate

จาก coordinate ทั่วไปมักจะเอา y จิ้มไปข้างหน้า อย่างนี้ รูปรถต้นแบบ ที่เอามาใส่แกน เอามาจาก มหาวิทยาลัย ไหนซักที่ ลืมไปแล้ว ขอโทษนะคร้าบบ _/|\_ แต่ PR2 เอา x จิ้มไปข้างหน้า เพ่งๆ เอาละกันนะ base_link อยู่ข้างล่าง ที่ไอ้ลูกศรเหลืองๆ มัน transform ไปหาเยอะๆ นั่นแหละ จริงๆ มันมาจาก gazebo นะเธอว์ Most models are designed such that the are upright (with respect to the z axis) and pointing along the positive x axis. ตามไปอ่านของจริงได้ ที่หัวข้อ coordinate systems and units จาก ที่นี่ น้ะจ้ะ

[ ROS ] ขาของ PR2

จะเห็นว่า มันเป็นล้อเลื่อนเหมือน เก้าอี้หมุน joint ถูกแสดงไว้ในรูป

[ ROS ] variable type

Primitive Type Serialization C++ Python bool (1) unsigned 8-bit int uint8_t (2) bool int8 signed 8-bit int int8_t int uint8 unsigned 8-bit int uint8_t int (3) int16 signed 16-bit int int16_t int uint16 unsigned 16-bit int uint16_t int int32 signed 32-bit int int32_t int uint32 unsigned 32-bit int uint32_t int int64 signed 64-bit int int64_t long uint64 unsigned 64-bit int uint64_t long float32 32-bit IEEE float float float float64 64-bit IEEE float double float string ascii string (4) std::string string time secs/nsecs signed 32-bit ints ros::Time rospy.Time duration secs/nsecs signed 32-bit ints ros::Duration rospy.Duration ref: ros

[ ROS ] NodeHandle params

แทนที่จะเขียน if(n_.hasParam("cam_topic")){ n_.getParam("cam_topic", cam_topic_); } else { cam_topic_ = "gigaset_cam/image_raw"; } เขียนเป็น n_.param<std::string>("cam_topic", cam_topic_, "gigaset_cam/image_raw"); สั้นกว่ากันเยอะเลย

svn add only folder

USAGE svn add --non-recursive otherdir Example $ svn add communication_packet_protocol/communication_packet_protocol.tex svn: 'communication_packet_protocol' is not a working copy $ svn add --non-recursive communication_packet_protocol A communication_packet_protocol $ svn add communication_packet_protocol/communication_packet_protocol.tex A communication_packet_protocol/communication_packet_protocol.tex ref : svn book

gtest-1.4.0 uninstall log

dsin@dsin-laptop:/mnt/disk/AIT/Thesis/cpp_library/gtest-1.4.0 $ sudo make uninstall [sudo] password for dsin: rm -f '/usr/local/bin/gtest-config' /bin/bash ./libtool --mode=uninstall rm -f '/usr/local/lib/libgtest.la' rm -f /usr/local/lib/libgtest.la /usr/local/lib/libgtest.so.0.0.0 /usr/local/lib/libgtest.so.0 /usr/local/lib/libgtest.so /usr/local/lib/libgtest.a /bin/bash ./libtool --mode=uninstall rm -f '/usr/local/lib/libgtest_main.la' rm -f /usr/local/lib/libgtest_main.la /usr/local/lib/libgtest_main.so.0.0.0 /usr/local/lib/libgtest_main.so.0 /usr/local/lib/libgtest_main.so /usr/local/lib/libgtest_main.a rm -f '/usr/local/share/aclocal/gtest.m4' rm -f '/usr/local/include/gtest/gtest.h' rm -f '/usr/local/include/gtest/gtest-death-test.h' rm -f '/usr/local/include/gtest/gtest-message.h' rm -f '/usr/local/include/gtest/gtest-param-test.h' rm -f '/usr/local/include/gtest/gtest_pred_impl.h' rm -f '/usr/local

ลองเล่น google c++ test ( gtest-1.5.0 ) บน ubuntu

Installation เอามาจาก README ของมัน $ g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -c ${GTEST_DIR}/src/gtest-all.cc $ ar -rv libgtest.a gtest-all.o เวลา compile -I ${HOME}/gtest-1.5.0/include -L ${HOME}/gtest-1.5.0/ -lgtest Demo เอามาจากเวปของ ibm #include "gtest/gtest.h" TEST(SquareRootTest, PositiveNos) { EXPECT_EQ (18.0, square-root (324.0)); EXPECT_EQ (25.4, square-root (645.16)); EXPECT_EQ (50.3321, square-root (2533.310224)); } TEST (SquareRootTest, ZeroAndNegativeNos) { ASSERT_EQ (0.0, square-root (0.0)); ASSERT_EQ (-1, square-root (-22.0)); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } EXPECT v.s. ASSERT = non-fetal v.s. fetal EXPECT : execution continues even if there is a failure ASSERT : test execution abort

finding intrinsic parameter [ K ] and extrinsic parameter [ R, t ] ( camera calibration ) with OpenCV

เด๋วนี้ อะไรๆ ก็ง่าย ไม่ต้องไป mark จุด ใน matlab library ให้เมื่อยตุ้ม โปรแกรมนี้นี้มาจากการรวมพลังกันของ 3 ฟังก์ชั่น นั่นคือ cvFindChessboardCorners, cvFindCornerSubPix, และ cvCalibrateCamera2 ซึ่งอันที่จริงแล้ว cvCalibrateCamera2 กับ cvFindExtrinsicCameraParams2 เหมือนกันนะอิอิ ถ้ารู้ intrinsic parameter มาแล้ว หนีไปใช้ cvFindExtrinsicCameraParams2 เพื่อหา rotation vector กับ translation vector ก็ได้ อยู่ใน demo ของ opencv version 2.0 นั่นแหละ วิธีใช้ จ้า ไม่บอก [input] อะไรแสดงว่า ใช้ค่าจาก webcam $ ./calibration.o -w 8 -h 6 [input] [input] จะใส่เป็นไฟล์วีดีโอ หรือ จะใส่ [input] เป็นไฟล์ calib.txt ก็ได้ calib.txt /mnt/disk/AIT/Thesis/image/sonycam/DSC08606.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC08607.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC08608.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC08609.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC08610.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC08611.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC08612.JPG /mnt/disk/AIT/Thesis/image/sonycam/DSC0

iqscoretest9, is it a dangerous site ?

- Thursday September 02 2010, 11:25 - XXX: hey dsin : ;-) XXX: I just took an IQ quiz here.. pretty cool :-P dsin : Where is here ? XXX: got a 113 lol... thought I was smarter than that dsin : You fool lolz XXX: you should see if you can beat me... if u can ill buy u a drink lol dsin : never. However, where is here ? dsin : here is not there ? dsin : lolz XXX: http://iqscoretest9.com/?test=21hk10524 I bet you cant haha dsin : let's see if it a phishing or scam site XXX: take it now while i take a shower! dsin : it 404 not found XXX: ill be back in a few after im all fresh lol dsin : hey dsin : told the admin for me dsin : that their website is down XXX: BRB .. take that test! dsin : 404 not found ! how can I take that test ? dsin : damn - 11:31 - dsin : you should check your worm that it is ready before you spread it. I bet that it is not a silly bot, it's human. This is another funny conversation http://pastie.org/pastes/1087154

integrate formula cheat sheet

Be careful, this should be 'u du'. If it is not u, please convert it into u. OK ? ref : eformulae