Eliminating Shading in a Lamp

1 次查看(过去 30 天)
Mark Robertson
Mark Robertson 2020-9-14
Is there any way for me to eliminate the shading in this lamp? I want to remove the darker portion at the bottom and the lighter portion at the top, so it only shows the neutral green color throughout the entire lamp.

回答(1 个)

Image Analyst
Image Analyst 2020-9-14
First I'd get a mask of just the circle. The mask should contains just the middle of the lamp where you want to change the color. For example threshold the image to find the largest blob that is not gray, then call imerode to erode away the edges of the lamp a little bit. Then I'd get the median of all three color channels. That should be your middle green color at the middle.
[r,g,b] = imsplit(rgbImage);
meanr = median(r(mask));
meang = median(g(mask));
meanb = median(n(mask));
% Now assign that color
r(mask) = meanr;
g(mask) = meang;
b(mask) = meanb;
% Combine into rgb image.
rgbImage = cat(3, r, g, b);
imshow(rgbImage);
  3 个评论
Image Analyst
Image Analyst 2020-9-15
Then if it's a built-in widget for App Designer, you're stuck with it probably, unless it exposes a property that allows you to specify different image(s) for it.
Otherwise the work around is to not use that widget, but just use a regular axes control and load a custom image into it that looks exactly the way you want.
Mark Robertson
Mark Robertson 2020-9-16
Would I be able to control for color then? The idea is that the color of the lamp should change based on reflectance data, and it sounds like I would only be able to upload a generic green colored circle in the location of the lamp rather than get the precise RGB values that way.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Denoising and Compression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by