[問題] opencv sift color descriptors extract

看板C_and_CPP (C/C++)作者 (LMY)時間12年前 (2013/10/10 01:58), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) c++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) opencv 2.3.1 問題(Question): 目的: 計算 Opponent color SIFT descriptors 1. 使用SiftFeatureDetector.detect取出keypoint 2. 把input image 轉成 Opponent color space 3. 使用SiftDescriptorExtractor.compute計算descriptors (3個channel各做一次) 結果發現 1.算出來的keypoints 跟 3. 算出來的每個descriptors數量都不一樣 3. 不是應該根據1. 算出來的點去取features而已嗎? 為什麼點會不一樣多呢? 另外,順便想請問大家,讀入bitmap到底是rgb還是bgr呢? google大家都眾說紛紜 Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.Img); Mat mat_bmp = new Mat(bmp.getHeight() , bmp.getWidth(), CvType.CV_8UC4); mat_bmp = Utils.bitmapToMat(bmp); 餵入的資料(Input): 預期的正確結果(Expected Output): keypoint 數量 = des1.rows = des2.rows = des3.rows 錯誤結果(Wrong Output): keypoint 數量 = 558 des1.rows = 490 des2.rows = 481 des3.rows = 561 程式碼(Code):(請善用置底文網頁, 記得排版) cv::SiftFeatureDetector Siftdetector; cv::SiftDescriptorExtractor Siftextractor; // detect keypoints Siftdetector->detect(img, keypoints); // compute descriptors Siftextractor.compute(O1, keypoints, des1); Siftextractor.compute(O2, keypoints, des2); Siftextractor.compute(O3, keypoints, des3); (O1,O2,O3 是img根據Opponent color space算出來的值) 補充說明(Supplement): 附上轉color space的方法 // To Opponent color space Mat R, G, B, O1, O2, O3, des1, des2, des3; vector<Mat> channels(3); split(img, channels); B = channels[0]; G = channels[1]; R = channels[2]; O1 = (R - G) / sqrt(2); O2 = (R + G - B*2) / sqrt(6); O3 = (R + G + B) / sqrt(3); -- ██ ╔═╗ ═╦═ ╭═╩═╮ ╦ ↘ ╠═╣ ═╬═ ╭═╩═╮ ═╦═ ○ ╬═╬ ╚═╝ ╣║╠ ═╦═ ═╬═ ╬ ╬ ═╦═ ╯║╰ ║ ║ ╯ ║ ╭╠ ║ ═╬═ ═╩╩ by qetesh╠╩═╯ ═╩╩ <(▔︶▔)> ◢█ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.32.20.147

10/11 12:41, , 1F
RGB
10/11 12:41, 1F
文章代碼(AID): #1ILPbCJc (C_and_CPP)
文章代碼(AID): #1ILPbCJc (C_and_CPP)