Image Processing Toolbox: Subtracting 2 images
显示 更早的评论
Hi everyone! I am working with an image of a cone. Attached:

As you can see, there is a lot of imperfections and I will like to remove them and leave only the black outline of the cone. My first thought was to take the same picture, but without a cone and the substract them. I attach the second image without the cone.

Nevertheless, the operation isnt working as I will expect. The results of the operation are the following, each accounting for different substractions.

In this image imperfections are still present.

And in this image I tried increasing the brightness but didnt work.
Am I thinking the method wrong? Or is there any other better method to process this images?
Thank you in advance!
采纳的回答
更多回答(1 个)
Image Analyst
2021-4-21
What I'd do is to make a template of the bright spot without the cone. Then determine the means and scale them, then subtract.
% Get the mean of each image.
mean1 = mean(refimage(mask))
mean2 = mean(testImage(mask));
% Scale test image's mean to be the same as the reference image's mean.
testImage = double(testImage) * mean1 / mean2;
% Cast it back to the same image type as refImage.
testImage = cast(testImage, 'like', refimage);
% Now subtract.
subtractionImage = imabsdiff(refImage, testImage);
Now they should subtract much closer to zero than with what you did.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
