Error using .* Integers can only be combined with integers of the same class, or scalar doubles.
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
Stephen23
2016 年 2 月 29 日
編集済み: Stephen23
2016 年 2 月 29 日
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.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!