How to color an image

3 ビュー (過去 30 日間)
Vladut Neagovici
Vladut Neagovici 2022 年 7 月 1 日
回答済み: Simon Chan 2022 年 7 月 1 日
I have this photo and I have to color every hexagon from her with a different color.

回答 (2 件)

SlipperyGnome
SlipperyGnome 2022 年 7 月 1 日
You can go through this link to create coloured hexagons using patch- https://www.mathworks.com/matlabcentral/answers/282942-colored-hexagons-using-patch
You can also see here to understand how to find the boundaries of each hexagon in the image- https://www.mathworks.com/matlabcentral/answers/110871-how-to-detect-the-hexagon-in-imageprocessing
Hope this helps.

Simon Chan
Simon Chan 2022 年 7 月 1 日
Try the following:
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1052130/image.png');
BW = imbinarize(rgb2gray(I));
[L,n] = bwlabel(BW);
J1 = label2rgb(L);
J2 = imoverlay(J1,~BW,'black'); % Make sure the background is black color
imshow(J2);

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by