看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: Win10, Linux, ...) VS2013 編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出) 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) opencv 問題(Question): 測試opencv affine的程式,中間想取用計算出來的矩陣的數值,但取出後數值不正確 餵入的資料(Input): [0.5009784735812133, -0.5009784735812133, 256; 0.5009784735812133, 0.5009784735812133, 0] 預期的正確結果(Expected Output): 0.500978 -0.500978 256 0.500978 0.500978 0 錯誤結果(Wrong Output): 9.47757e-038 1.75024 9.47757e-038 -1.75024 0 3.75 程式碼(Code):(請善用置底文網頁, 記得排版) 完整程式碼 http://codepad.org/EwDkpPJ2 問題點: cout << warpMat << endl; 輸出如上面餵入資料 cout << ((float*)warpMat.data)[0 * warpMat.cols + 0] << endl; 應該是陣列的第一個值 想請問各位大大,warpMat是32位元的資料,為什麼用float取出來的值會不同? 改用double數值卻是正確的,不知道問題出在哪裡 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.124.44.195 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1479887063.A.753.html
Zero0910: 你定義的warpMat被getAffineTransform回傳的覆蓋掉了吧 11/23 16:23
Zero0910: getAffineTransform應該是回傳double格式的mat 11/23 16:23
laladeer: 我要怎麼知道他回傳的是double還是float呢? 11/23 22:03
nh60211as: .type() 11/24 00:23
laladeer: 謝謝 大大 我再試試看這個 11/24 18:41