Error using .* Integers can only be combined with integers of the same class, or scalar doubles.

2 Ansichten (letzte 30 Tage)
How can I add a weighted version of an image to the original image to create a sharpened image. I did:
image1 = imn'.*mean(image,2);
figure, imshow(image);
but something it is wrong..
Error using .* Integers can only be combined with integers of the same class, or scalar doubles.

Akzeptierte Antwort

Stephen23
Stephen23 am 29 Feb. 2016
Bearbeitet: Stephen23 am 29 Feb. 2016
Assuming that imn and image are both of the same integer class, then use the third input argument of mean:
mean(image,2,'native')
Then mean will return values of the same class as the input image, which can then be multiplied with imn (also of the same integer class).
Or, if you want to retain any fractional values, simply convert all of the images to double before performing your calculation.
Important DO NOT call any variable image, as this is the name of a very important and useful function image, which will stop working when you use that name. For the same reason do not use cell, size, i, j, length, etc.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by