问题
When i'm trying to add pixel data to data created by gaussian randn() function it's spitting the error
??? Error using ==> plus Integers can only be combined with integers of the same class, or scalar doubles.
This is my code:
im = imread( 'ngc6543a.jpg' ); % matlab example image
x = randn( size (im) ); % create gaussian distributed values
t = im + x; % add them together, this throws the error
回答1:
Convert the integers (uint8) from your read image im to double:
t = double(im) + x;
来源:https://stackoverflow.com/questions/33300588/error-using-plus-integers-can-only-be-combined-with-integers-of-the-same