Matlab imfilter uint8 overflow

2 ビュー (過去 30 日間)
RuiQi
RuiQi 2016 年 4 月 9 日
コメント済み: Walter Roberson 2016 年 4 月 10 日
Hello,
I created a gaussian filter. Then I divide every element by the smallest element so my gaussian filter is in integer. When i convolve an image with it, I get 255 for everything. How do I fix this ? I want to convolve using integer values not decimals. Thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 4 月 9 日
double() the data before convolving.
  5 件のコメント
Guillaume
Guillaume 2016 年 4 月 9 日
編集済み: Guillaume 2016 年 4 月 9 日
With doubles, by default imshow assumes the range [0 1] for intensities. Convert the data back to uint8, or specify the DisplayRange in imshow to be [0 255]:
imshow(uint8(yourimage));
%or
imshow(yourimage, [0 255]);
Walter Roberson
Walter Roberson 2016 年 4 月 10 日
imagesc(yourimage)
to display it automatically scaled according to the data it contains. This will not be the same as either of Guillaume's suggestions (which would normally be valid) because your filters are producing values larger than 255.

サインインしてコメントする。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by