Error using bitxor Inputs must be signed or unsigned integers of the same class or scalar doubles.

4 views (last 30 days)
CODE:
info = dicominfo('brain_001.dcm');
t = dicomread(info);
figure(4)
imshow(t,[]);
title('ORIGINAL IMAGE')
p=randi([0 65536],256,256);
c=int16(p);
[a1,a2]=size(t);
for i=1:a1 %ENCRYPTION
for j=1:a2
x(i,j)=bitxor(t(i,j),c(i,j));
Error occurred:
Error using bitxor
Inputs must be signed or unsigned integers of the same class or scalar doubles.
Error in RDHEDIBSBDE (line 14)
x(i,j)=bitxor(t(i,j),c(i,j));
  1 Comment
Walter Roberson
Walter Roberson on 8 May 2021
What is class(t)?
Warning: randi 0 65536 is a span of 65537 values. You then int16 the values but int16 can only store -32768 to +32767 and half of your values are above that.

Sign in to comment.

Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!