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

บทความ

กำลังแสดงโพสต์ที่มีป้ายกำกับ opencv

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

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...

[ ubuntu linux ] OpenCV installtion

วันนี้ลองเขียน cvFindExtrinsicParams2 ปรากฏว่า มันรันแล้วค้างไปเลย ใน OpenCV 1 หรือ ไม่ก็ขึ้น error มาตามนี้ ใน OpenCV 2.0 ** On entry to DLASCL, parameter number 4 had an illegal value ไปหาๆ ดู เจอ ticket นี้ มันบอกว่า เขาแก้บักไปตั้งแต่ revision 3148 จะให้กรูไปแก้ source แล้ว make ใหม่ ก็ขี้เกียจ เพราะว่า ตอนนี้ใช้ 2.0 แต่ มันออก เวอร์ชั่น 2.01 มาแล้ว ไม่ได้ทำนาน ลืมไปแล้ว ว่าลงยังไง ยังดี มีบล๊อกของ zkan กับ sir_ivy มาช่วยให้ระลึกชาติได้ จดไว้หน่อย เด๋วลืม อันนี้ วิธีลง ของ เวอร์ชั่นก่อนหน้า $ ./configure --prefix=${HOME}/opencv --with-ffmpeg --without-quicktime $ make $ make install ส่วน 2.01 ใช้ CMake ชีวิต ก็สะดวกสบาย ขึ้นอีกนิด ( วิธีลง จริงๆ เอามาจาก README ของแม่ง ที่มันลิงก์ไปหา ดอก อีกที ) .../OpenCV-2.1.0$ mkdir release .../OpenCV-2.1.0$ cd release/ .../OpenCV-2.1.0/release$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/dsin/opencv2_1 -D BUILD_PYTHON_SUPPORT=ON .. $ make $ make install พอลงสำเร็จเรียบร้อย ก็ลอง รันโค้ด ดู อันนี้เวอร์ชั่น lite น้ะจ้ะ...

[ ubuntu ] OpenCV in gedit

จิ้มไปจิ้มมา เผลอกด OK หายอีกกรู จดไว้ก่อน คราวหน้าจะได้ไม่ต้องไปงมอีก MY_FILENAME=`echo $GEDIT_CURRENT_DOCUMENT_PATH | cut -d . -f 1` gcc -o $MY_FILENAME $GEDIT_CURRENT_DOCUMENT_PATH -I${HOME}/opencv/include/opencv/ -L${HOME}/opencv/lib -lhighgui export LD_LIBRARY_PATH=${HOME}/opencv/lib $MY_FILENAME -I : Directories -L : Library search path -l : Libraries LD_LIBRARY_PATH is for running a code. If it is not set, you will come up with error like this. error while loading shared libraries: libhighgui.so.2: cannot open shared object file: No such file or directory ข้างล่างนี่ ยัดแบบเต็มๆ เอา levmar กับ sift เข้าไปด้วยเลย MY_FILENAME=`echo $GEDIT_CURRENT_DOCUMENT_PATH | cut -d . -f 1` export LD_LIBRARY_PATH=${HOME}/opencv/lib gcc -o $MY_FILENAME $GEDIT_CURRENT_DOCUMENT_PATH -I${HOME}/opencv/include/opencv/ -I/mnt/disk/AIT/OpenCV/sift/include/ -L${HOME}/opencv/lib -L${HOME}/levmar-2.4 -L/mnt/disk/AIT/OpenCV/sift/lib/ -lhighgui -lm -llapack -llevmar -lfeat $MY_FILENAME เราสามารถใช้ Enviro...

[ ubuntu ] SIFT Opensource installation

1. download from http://web.engr.oregonstate.edu/~hess/ 2. $ make make -C ./src siftfeat make[1]: Entering directory `/mnt/disk/AIT/OpenCV/sift/src' gcc -O3 -I../include `pkg-config --cflags opencv` `pkg-config --cflags gtk+-2.0` `pkg-config --cflags gsl` -c xform.c -o xform.o Package gsl was not found in the pkg-config search path. Perhaps you should add the directory containing `gsl.pc' to the PKG_CONFIG_PATH environment variable No package 'gsl' found xform.c:16:24: error: gsl/gsl_sf.h: No such file or directory xform.c:17:25: error: gsl/gsl_rng.h: No such file or directory xform.c:18:29: error: gsl/gsl_randist.h: No such file or directory xform.c:27: error: expected declaration specifiers or ‘...’ before ‘gsl_rng’ xform.c: In function ‘ransac_xform’: xform.c:85: error: ‘gsl_rng’ undeclared (first use in this function) xform.c:85: error: (Each undeclared identifier is reported only once xform.c:85: error: for each function it appears in.) xform.c:85: error: ‘rng’ und...