[繪圖] uint8轉化 畫圖的問題
讀取圖片檔(tif) 假設圖片檔是叫a
A=imread(a.tif)
所以舉陣A 裡面都是uint8的格式 (都是整數)
但我需要運算 比如 B=(36*A)/23 之類的
總之就是做加減乘除 會出現小數
因為我想保留這些小數 (因為需要這小數去分析 才會比較明顯)
為了要保留小數 所以加了double這個指令
不然uint8的格式 怎麼加減乘除都還只保留整數
所以我在運算的時候 變成這樣 B=36*double(A)/23
問題來了 加了double 卻出現的這個錯誤
??? Error using ==> image
Error using ==> image
TrueColor CData contains element out of range 0.0 <= value <=
1.0
Error in ==> imagesc at 19
hh = image(varargin{1},'CDataMapping','scaled');
Error in ==> Untitled_Tb at 45
imagesc(B);
拜託 高手幫忙解決
以2000p當小小的回饋了
-------------------
這是我大體的程式
B=imread(A);
rad61 = (Lmax61-Lmin61)./(Qcalmax61-Qcalmin61).*((B)-Qcalmin61)+Lmin61;
|加double的地方
(Lmax61 Lmin61 Qcalmax61 Qcalmin61) 這些都是常數
idx = find(real(rad61) <= 0.);
rad61(idx) = NaN;
T61=K2./(log((double(K1./rad61))+1))-273.16;
T61(T61<=-5)=NaN;
T61(T61>35)=NaN;
figure(1);
imagesc(T61);
因為我畫是跟地區溫度有關的圖 所以會需要到0~35左右
然後真的用手去驗算 值也差不多是0~35
所以感覺是畫圖的指令 imagesc(T61); 錯誤
想請問 還有其他畫圖推薦的指令
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.184.86
→
04/16 21:49, , 1F
04/16 21:49, 1F
→
04/16 21:52, , 2F
04/16 21:52, 2F
→
04/16 21:52, , 3F
04/16 21:52, 3F
推
04/16 21:52, , 4F
04/16 21:52, 4F
→
04/16 21:53, , 5F
04/16 21:53, 5F
→
04/16 21:53, , 6F
04/16 21:53, 6F
恩恩 很像真的是後面我畫imagesc(B) 需要在0~1之間
但我的圖 希望能顯示 0~35之間 就是溫度的 可以不要只能在0~1之間嗎??
感謝
→
04/16 21:53, , 7F
04/16 21:53, 7F
※ 編輯: y1027330 來自: 114.32.184.86 (04/16 22:03)
推
04/16 21:59, , 8F
04/16 21:59, 8F
推
04/16 22:08, , 9F
04/16 22:08, 9F
→
04/16 22:08, , 10F
04/16 22:08, 10F
推
04/16 22:09, , 11F
04/16 22:09, 11F
※ 編輯: y1027330 來自: 114.32.184.86 (04/16 22:14)
→
04/16 22:14, , 12F
04/16 22:14, 12F
→
04/16 22:14, , 13F
04/16 22:14, 13F
※ 編輯: y1027330 來自: 114.32.184.86 (04/16 22:16)
→
04/16 22:17, , 14F
04/16 22:17, 14F
※ 編輯: y1027330 來自: 114.32.184.86 (04/16 22:19)
推
04/16 22:21, , 15F
04/16 22:21, 15F
→
04/16 22:22, , 16F
04/16 22:22, 16F
→
04/16 22:22, , 17F
04/16 22:22, 17F
→
04/16 22:23, , 18F
04/16 22:23, 18F
→
04/16 22:23, , 19F
04/16 22:23, 19F
→
04/16 22:23, , 20F
04/16 22:23, 20F
→
04/16 22:25, , 21F
04/16 22:25, 21F
推
04/16 22:36, , 22F
04/16 22:36, 22F
→
04/16 22:37, , 23F
04/16 22:37, 23F
→
04/16 22:38, , 24F
04/16 22:38, 24F
推
04/16 22:45, , 25F
04/16 22:45, 25F
→
04/16 22:45, , 26F
04/16 22:45, 26F
→
04/16 22:46, , 27F
04/16 22:46, 27F
→
04/16 22:47, , 28F
04/16 22:47, 28F
→
04/16 22:47, , 29F
04/16 22:47, 29F
→
04/16 22:48, , 30F
04/16 22:48, 30F
→
04/16 22:48, , 31F
04/16 22:48, 31F
推
04/16 22:49, , 32F
04/16 22:49, 32F
→
04/16 22:51, , 33F
04/16 22:51, 33F
推
04/16 22:53, , 34F
04/16 22:53, 34F
→
04/16 22:53, , 35F
04/16 22:53, 35F
→
04/16 22:54, , 36F
04/16 22:54, 36F
→
04/16 22:54, , 37F
04/16 22:54, 37F
→
04/16 22:54, , 38F
04/16 22:54, 38F
→
04/16 22:55, , 39F
04/16 22:55, 39F
→
04/16 22:55, , 40F
04/16 22:55, 40F
→
04/16 22:56, , 41F
04/16 22:56, 41F
推
04/16 22:56, , 42F
04/16 22:56, 42F
→
04/16 22:56, , 43F
04/16 22:56, 43F
→
04/16 22:57, , 44F
04/16 22:57, 44F
→
04/16 22:57, , 45F
04/16 22:57, 45F
→
04/16 22:58, , 46F
04/16 22:58, 46F
→
04/16 22:59, , 47F
04/16 22:59, 47F
→
04/16 22:59, , 48F
04/16 22:59, 48F
<--這之前沒錯 後面有點不懂
→
04/16 23:00, , 49F
04/16 23:00, 49F
→
04/16 23:01, , 50F
04/16 23:01, 50F
有點聽不懂 把B的data 調整為 0~1 or 0~255
※ 編輯: y1027330 來自: 114.32.184.86 (04/16 23:02)
→
04/16 23:01, , 51F
04/16 23:01, 51F
推
04/16 23:04, , 52F
04/16 23:04, 52F
→
04/16 23:04, , 53F
04/16 23:04, 53F
→
04/16 23:05, , 54F
04/16 23:05, 54F
→
04/16 23:06, , 55F
04/16 23:06, 55F
推
04/16 23:06, , 56F
04/16 23:06, 56F
→
04/16 23:07, , 57F
04/16 23:07, 57F
推
04/16 23:09, , 58F
04/16 23:09, 58F
→
04/16 23:10, , 59F
04/16 23:10, 59F
→
04/16 23:11, , 60F
04/16 23:11, 60F
推
04/16 23:15, , 61F
04/16 23:15, 61F
→
04/16 23:16, , 62F
04/16 23:16, 62F
→
04/16 23:26, , 63F
04/16 23:26, 63F
→
04/16 23:30, , 64F
04/16 23:30, 64F
→
04/16 23:32, , 65F
04/16 23:32, 65F
→
04/16 23:33, , 66F
04/16 23:33, 66F
→
04/16 23:56, , 67F
04/16 23:56, 67F
推
04/17 08:53, , 68F
04/17 08:53, 68F
→
04/17 08:57, , 69F
04/17 08:57, 69F
→
04/17 08:58, , 70F
04/17 08:58, 70F
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章