「unsigned char大小」的推薦目錄:
- 關於unsigned char大小 在 コバにゃんチャンネル Youtube 的精選貼文
- 關於unsigned char大小 在 大象中醫 Youtube 的精選貼文
- 關於unsigned char大小 在 大象中醫 Youtube 的最讚貼文
- 關於unsigned char大小 在 [問題] 關於unsigned char如何比大小- 看板C_and_CPP 的評價
- 關於unsigned char大小 在 About the size of unsigned char type in C++ - Stack Overflow 的評價
- 關於unsigned char大小 在 Raw data to unsigned char C array - gists · GitHub 的評價
- 關於unsigned char大小 在 Difference between char array and unsigned char array [closed] 的評價
- 關於unsigned char大小 在 signed and unsigned char | C Programming - YouTube 的評價
unsigned char大小 在 大象中醫 Youtube 的精選貼文
unsigned char大小 在 大象中醫 Youtube 的最讚貼文
unsigned char大小 在 About the size of unsigned char type in C++ - Stack Overflow 的推薦與評價
... <看更多>
相關內容
unsigned char大小 在 Raw data to unsigned char C array - gists · GitHub 的推薦與評價
Dump raw data to a unsigned char array. */. void c_array_dump(FILE *stream, const char *label, unsigned char *data, size_t size). ... <看更多>
unsigned char大小 在 [問題] 關於unsigned char如何比大小- 看板C_and_CPP 的推薦與評價
我想要讀入一個raw的512*512灰階圖檔作濾波
所以byte為單位將每個pixel存進矩陣裡
又因為pixel裡面的值應為0~255而非-128~127
所以我將矩陣宣告如下
unsigned char img[512][512];
接下來因為用3*3的mask與原圖作convolution後
我把它存到一個新的矩陣(512+3-1=514)
unsigned char newimg[514][514];
後來發現因為conv出來的數值有可能超過255或低於0
於是作了如下的for loop做修正
for (int i=0; i<514; i++)
for (int j=0; j<514; j++)
{
if (newimg[i][j]>255)
newimg[i][j]=255;
else if (newimg[i][j]<0)
newimg[i][j]=0;
}
但發現build會出現
warning: comparison is always false due to limited range of data type
我想可能是char無法跟整數直接比較大小
於是用了一個很笨的方法...
重新宣告一個double a
把img的值先assign給它再做比較
程式可以跑而且圖形也是正確的
但仍然會出現
warning: converting to `unsigned char' from `double'
想問大家要怎樣作才能讓warning不再出現
而且又可以讓unsigned char裡頭的值比大小?
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.35.1.66
... <看更多>