How would we use Euclidean Distance Method to assign colours to specific pixels of an image ? For eg. i want to add rainbow in the given image !
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos

0 comentarios
Respuestas (1)
Image Analyst
el 27 de Feb. de 2015
First get an image of a rainbow. Then get a binary mask of where it is in the image. Then separate your two images into color channels.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Do the above for each color image. Then do
redChannel(binaryMask) = rainbowRed(binaryMask);
greenChannel(binaryMask) = rainbowGreen(binaryMask);
blueChannel(binaryMask) = rainbowBlue(binaryMask);
rgbout = cat(3, redChannel, greenChannel, blueChannel);
By the way a rainbow in that image would look totally unrealistic. Do you know when you get rainbows? Actually that was my very first homework problem in optics graduate school. We had to find the angle of a rainbow. It's 42 degrees. You need the sun at your back and rain or mist in front of you.
2 comentarios
Image Analyst
el 27 de Feb. de 2015
What is the Euclidean distance method? Describe it. To set a single pixel, just set it
rgbImage(row, column, :) = [r,g,b];
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!