[問題] bmp的RGB轉HSI問題

看板C_and_CPP (C/C++)作者 (揪4i56)時間12年前 (2013/10/11 14:52), 編輯推噓1(105)
留言6則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Dev C++ 問題(Question): BMP讀檔之後將RGB的值轉換成HSI 但寫出來的圖片全黑的 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) http://pastebin.com/Chy6aqwk 補充說明(Supplement): 前面讀檔的部分是照著網路上的bmp讀檔教學網頁打的 http://blog.xuite.net/edxid/note/18088900 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.217.49 ※ 編輯: jo4i5566 來自: 140.113.217.49 (10/11 14:53)

10/11 19:09, , 1F
123 到 125 行要轉型為 unsigned char, 即
10/11 19:09, 1F

10/11 19:09, , 2F
input_imageVec[y][x].B = (unsigned char) chB;
10/11 19:09, 2F

10/11 19:09, , 3F
input_imageVec[y][x].G = (unsigned char) chG;
10/11 19:09, 3F

10/11 19:09, , 4F
input_imageVec[y][x].R = (unsigned char) chR;
10/11 19:09, 4F

10/11 19:10, , 5F
否則放進去的 RGB 就可能變負的.
10/11 19:10, 5F

10/11 20:01, , 6F
謝謝樓上 讀檔正確了
10/11 20:01, 6F
文章代碼(AID): #1ILw0O5A (C_and_CPP)
文章代碼(AID): #1ILw0O5A (C_and_CPP)