發表文章

Visual odometry for drone's navigation

[Concept] Considering a drone is currently at a position P(i), at time step i. A waypoint to be achieved at the next time step is W(i+1) 1. Calculating position error between W(i+1) and P(i). 2. Position error fed into a PID controller that generates a velocity command V(i). 3. Calculating velocity error between V(i) and current velocity from visual odometry algorithm. 4. Velocity error fed into another PID controller to get an appropriate roll, pitch, yaw and throttle outputs. Reference: [1] Strydom, Reuben, Saul Thurrowgood, and Mandyam V. Srinivasan. "Visual odometry: autonomous uav navigation using optic flow and stereo." Proceedings of Australasian Conference on Robotics and Automation. 2014. [Intel AERO] Connecting Lidar Lite Range Finder: https://github.com/intel-aero/aero-optical-flow https://docs.px4.io/en/flight_controller/intel_aero.html ROS: 05-Autonomous-drone-programming-with-ROS http://wiki.ros.org/rtabmap_ros  ( Section: Stereo Outd...

Intel AERO manual / automatic flying

前置作業: Flashing intel AERO board and calibration (參:  Initial setup , Flight mode setting ) *先flash Aero-xx-xx.iso,再安裝Ubuntu 16.04。(跟雙系統的安裝方法一樣,安裝完後需從Kernel 4.4.76 登入) Video display test (參: Video streaming ) *Press shift & ESC for entrying the GRUB screen ( https://askubuntu.com/questions/16042/how-to-get-to-the-grub-menu-at-boot-time ) * Flash the latest BIOS:  Download bios.rpm file  bios download link rpm2cpio aero-bios-01.00.16-r1.corei7_64.rpm | cpio -idmv   sudo mv BIOSUPDATE.fv /boot sudo aero-bios-update sudo reboot 手動 (參:  First flight ): 連接好所有配件 開啟Intel AERO電源,開啟遙控器 等待開機完畢,開車 (左邊搖桿往右下) 加油門,起飛 (Position Hold Mode) 關車 (左邊搖桿往左下),關掉Intel AERO電源,最後關掉遙控器 *  The transmitter should always be powered on before the receiver (which is normally powered together with the vehicle). If powered on after the vehicle it won’t connect. To overcome this you can simply disconnect the cable from the receiver, or go through the binding...

CMake & make

Keys: CMakeList.txt檔負責分配source code彼此間的關係。 Include directory Files path (source, output ) Set library and executable (connection) Install setting (在 linux 底下預設的 CMAKE_INSTALL_PREFIX = /usr/local) 執行指令cmake後會產生Makefile檔(組態檔),再輸入make指令compile後,若compile無誤,make install指令將自動安裝CMakeList.txt設定好的東西(install rules)。 Makefile example: # General parameters CC  := g++ EXE := main # Advanced parameters INC_DIR := -I../include -I/usr/include -I/usr/include/m3api -I/usr/include/eigen3/Eigen -I/usr/include/opencv -I/usr/include/opencv2 -I/usr/local/cuda-10.0/include `pkg-config --cflags opencv` CPPSOURCES += $(wildcard *.cpp)  #Get all .c files OBJECTS := $(CPPSOURCES:.cpp=.o) #Replace all .cpp files as .o files  CFLAGS = -c -Wall -g $(INC_DIR) LIBS = -L/usr/lib -lm3api -lvisionworks -lvisionworks_sfm -lvisionworks_tracking `pkg-config --libs opencv` DEBUG_DIR := ../Debug EXE_DIR := ../Debug/ all: $(EXE) mkdir -p $(DEBUG_DIR) ...

RANSAC

圖片
Concept: 隨機選擇一組資料的子集,計算這個子集的轉換式,找出符合此轉換式的所有資料,稱之為inliers,反覆隨機選取子集直到inliers數量多到足以代表整組資料時。 RANSAC Line fitting example: RANSAC computer vision applications: RANSAC for feature matching RANSAC for homography Reference: 交大開放式課程: 機器人視覺 (單元9 Sensor Data, RANSAC, FORVIS )

Matchmoving related issues

圖片
1. Feature tracking: Harris + KLT (一般常用的組合),  SIFT (比較穩,但計算時間也較長) , Controlled environment (可確保特徵點匹配準確) Challenges: Removing false corners (需濾掉匹配錯誤的特徵點), assuming stationary background (物體靜止較方便相機姿態估算), deleting short tracks (盡量用會一直出現的特徵點), growing matches (盡可能增加穩健特徵點數量). 2. Essential matrix: 當已知相機參數時,Fundamental matrix可簡化為Essential matrix。對Essential matrix進行SVD分解可進一步求得兩相機座標系統之間的R和T (假設兩張圖由不同位置之相機所拍攝)。 解法參:   淺談基礎矩陣,本質矩陣與相機移動 3. Singular value decomposition (SVD): 用於解一個非對稱矩陣的eigenvalues, eigenvectors. 4. Triangulation: 探討當已知兩張從不同角度拍攝的物體影像,如何建構出3D物體資訊。 理論上: 簡單數學幾何關係即可找出物體在3D中的位置 實際上: 兩個相機不會剛好平行 需要在影像上找到確定地相對特徵點 解決方法: 相機事先校正 在epipolar line上找對應特徵點 (Sum of Squared Differences (SSD) algorithm, Energy minimization algorithm) Image rectification使相對應特徵點平行 OpenCV function: trinagulatePoints (參:  triangulate 3d points from a stereo camera and chessboard. ) 實際雙眼視覺reconstruction流程: Calibrate cameras (得到相機參數) Rectify images (對齊特徵點) Com...

Epipolar Geometry

圖片
1. Epipolar Geometry Two images taken at the same time, in different positions, by different cameras. Don't need to search across the entire image to estimate the motion vector Only one degree of freedom for the possible correspondence 假設有兩張連續拍攝的影像 I1, I2 ,則物體 P 在 I2 上的成像點必落在一條線上,稱之為Epipolar line(因為不知道P與 I1 的距離),而 I2 上所有的 Epipolar line會相交在一點,稱之為epipole。 2. The fundamental matrix 在 I1及 I2 上相對應的特徵點,滿足: which is: We can build an linear system with n corresponding feature points located on two images: 找到最佳解f即為Fundamental matrix。 Basic algorithm: normalized 8-points algorithm 重要觀念: Normalized特徵點。 雖然無法找到唯一解使得Af = 0,但可對A做SVD特異值分解,D之中最小eigenvalue對應的eigenvector即為使Af最小的向量。(Af = 0 => Af = λf = 0, satisfied when λ=0 ) 到Step4算出來的F可能不是Rank2,所以需要再做一次SVD,令D之中最小eigenvalue為0,使F變為Rank2。 RANSAC可用來濾掉outliers。 Image rectification可用來對齊兩張影像的epipolar line,方便我們搜尋特徵點。(homography transformation) 參: Hartley.

Using the xfOpenCV library on a Xiinx FPGA board

xfOpenCV包含許多硬體加速函數,幫助開發者於SDx,使用類OpenCV的呼叫方式,快速實現基於FPGA的影像處理。 1. xfOpenCV function (Refer to :  Xilinx OpenCV User Guide ,  OpenCV on Zynq Webinar 1 )       (1) Read the image using cv::imread().       (2) Copy the data to xf::Mat.       (3) Call the processing function(s) in xfOpenCV.       (4) Copy the data from xf::Mat to cv::Mat.       (5) Write the output to image using cv::imwrite(). Note: For reVISION platform , there is no need to explicitly add the xfOpenCV library as an additional source locally in the SDx project.  For ZCU102 based platforms, the xfOpenCV library is available in the <platform_root>/sw/a53_linux/inc/xfopencv folder. For the ZC702 based platforms, the xfOpenCV library is available in the   <platform_root>/sw/a9_linux/inc/xfopencv  folder.                      ...