フィルターのクリア

how to calculate pixel value differences?

2 ビュー (過去 30 日間)
Rezaur Rahman
Rezaur Rahman 2016 年 2 月 23 日
コメント済み: Rezaur Rahman 2016 年 2 月 23 日
let my image be
temp=
[5 10;
10 15]
if i want to calculate temp(1,1)-temp(1,2) or temp(1,1)-temp(2,1) it always shows 0. how can i store the value?? i have also tried abs(temp(1,1)-temp(1,2)); bt failed. thanx in advance

採用された回答

Guillaume
Guillaume 2016 年 2 月 23 日
In your example, it actually works the way you want. The most likely reason why it does not work with your real image is that your image is of type uint8 (or uint16). The range of uint8 is limited to [0, 255], any value below or above these values are clamped to 0 or 255.
The fix is simple, convert your image to double:
temp = uint8([5 10; 10 15]) %demo image
temp(1,1) - temp(1, 2) %output 0, since -5 is not allowed for uint8
temp = double(temp); %convert to double
temp(1,1) - temp(1, 2) %output -5 as it should
  1 件のコメント
Rezaur Rahman
Rezaur Rahman 2016 年 2 月 23 日
thnx.. :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by