Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テキスト画像を読み取り、グレースケール画像に変換し、ソーベル演算子を適用しました。ここで、「画像を量子化」したいと思います。
uint8 イメージを double に変換し、255 で割ります。必要な量子量 (たとえば 50) を掛けて、uint8 に変換します。これで量子化されました。正しく表示するには、再度 double に変換してから 50 で割り、imshow を使用します。サンプルコード:
img = imread("image.jpg"); quanta = 50; img = double(img) / 255; img = uint8(img * quanta); img = double(img) / quanta;