Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Change specific colors in image to other colors
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi,
I am trying to change the color in an image to another color. The image that I am working on is attached in the question. I am trying to change all the purple data points to other colored data points, say green. I have already worked out some code that is capable of doing this, the only problem is that the edges of the purple data points remain purple-ish. I am not sure whether this is resolvable since I have tried zooming in on the points and I can see a lot of variations of purple around the core of the dot... My code is:
[I,m] = imread('/Users/Dries/Desktop/iteration31.png');
%image = imshow(I,'Colormap',m);
rgbImage = ind2rgb(I,m);
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
purplePixels = redChannel ==1 & greenChannel == 0 & blueChannel == 1;
% MAKE THEM GREEN
redChannel(purplePixels) = 0;
greenChannel(purplePixels) = 1;
blueChannel(purplePixels) = 0;
rgbImage = cat(3, redChannel, greenChannel, blueChannel);
imshow(rgbImage);
댓글 수: 1
Walter Roberson
2017년 5월 5일
Duplicates https://www.mathworks.com/matlabcentral/answers/338924-change-specific-color-in-an-image-to-another-one
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!