how to converter negative integers to postive and then get back to negative

5 ビュー (過去 30 日間)
juveria fatima
juveria fatima 2018 年 9 月 27 日
コメント済み: KSSV 2018 年 9 月 27 日
rgb_image =(imread('baboon.tiff','tiff'));
LS = liftwave('cdf2.2','Int2Int');
[CA,CH,CV,CD] = lwt2(double(rgb_image),LS);
in CA,CH,CV,CD am getting negtive integers i want to convert negative to positive integers
then again positive to negative as original CA,CH,CV,CD and get back the baboon image
  • i thought of doing one's compliment but unable to itcan any help help

回答 (1 件)

KSSV
KSSV 2018 年 9 月 27 日
K = [-2 2 ; 2 -4] ;
% negative to positive
idx = K<0 ;
K(idx) = -K(idx) ;
% Agin to negative
K(idx) = -K(idx) ;
  2 件のコメント
juveria fatima
juveria fatima 2018 年 9 月 27 日
rgb_image =(imread('baboon.tiff','tiff'));
LS = liftwave('cdf2.2','Int2Int');
[CA,CH,CV,CD] = lwt2(double(rgb_image),LS);
idx = CD<0 ;
K(idx) = -CD(idx) ;
K1(idx) = -K(idx) ;
256*256*3
KA=reshape(K1,256,256,3)
am appling your code on CD after it in KA am not gettiong the postive terms are made zero i want back CD how to do it
KSSV
KSSV 2018 年 9 月 27 日
CD(idx) = -CD(idx) ;
CD(idx) = -CD(idx) ;

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

Community Treasure Hunt

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

Start Hunting!

Translated by