[問題] 三張影像RGB平均輸出已回收

看板MATLAB作者 (magicayu)時間15年前 (2009/06/03 02:35), 編輯推噓1(107)
留言8則, 5人參與, 最新討論串1/1
source1 = imread('1.jpg'); source2 = imread('2.jpg'); source3 = imread('3.jpg'); finel = (source1 + source2 + source3)/3; ans1 = impixel(source1,101,109); ans2 = impixel(source2,101,109); ans3 = impixel(source3,101,109); ansfinel = impixel(finel,101,109); 請問一下 最後結果 我去看 ans1 = 165 179 182 ans2 = 70 84 85 ans3 = 234 246 246 ansfinel = 85 85 85 他並沒有除以3 請問我哪裡有錯誤嗎 請指教 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.164.244

06/03 04:06, , 1F
變數型態問題 uint8最大只能到255 將型態變成double試試
06/03 04:06, 1F

06/03 04:15, , 2F
相加/3 最大應該也不會超過255不是嗎???
06/03 04:15, 2F

06/03 04:24, , 3F
加完最大只有255 還沒除之前就爆了
06/03 04:24, 3F

06/03 04:28, , 4F
感謝Z大跟P大 我在繼續試看看 感恩^_^
06/03 04:28, 4F

06/03 06:42, , 5F
fine1=(source1/3+source2/3+source3/3);
06/03 06:42, 5F

06/03 17:43, , 6F
感謝T大 以解決 3Q
06/03 17:43, 6F

06/04 05:01, , 7F
t大的方法會有小問題uint8只能有整數 會有小誤差
06/04 05:01, 7F

06/05 14:17, , 8F
感謝回應 先個別轉成DOUBLE 最後再轉成UINT8 輸出就OK
06/05 14:17, 8F
文章代碼(AID): #1A9N3MZ3 (MATLAB)