How can I do Albanian flag using image processing toolbox ?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I have basic knowledge on using Matlab Image Processing Toolbox , but I am not quite good at it yet . I can only basically manipulate colours , but I am not skilled enough at creating shapes or forms . I wanted to know if there is any anyone who can help me create a code from Matlab Image Processing Toolbox for Albanian Flag. Thank you & Have a nice day.
0 commentaires
Réponses (2)
Walter Roberson
le 30 Mai 2015
The difference with color is you need to use a 3 dimension output array, AlFlag(x,y,C) where AlFlag(:,:,1) is for Red component, (:,:,2) for Green component, and (:,:,3) is for Blue component. Also you need to decide what to do if you paint two different colors at the same location: do you take the last color painted (as if you are painting in layers, later ones on top) or do you want to blend colors (like wet paint or like watercolors)
2 commentaires
Walter Roberson
le 30 Mai 2015
That is a binary flag, black and red. black = 0, red = 1. When you have the binary matrix, you can display it with
imshow(AlFlag,[])
colormap([0 0 0; 1 0 0]); %black then red
Image Analyst
le 30 Mai 2015
Altin, if you want to create this flag from scratch, the first step is to get the coordinates of the outline of the black diagram in the middle of the flag. It might be easiest if you took an existing flag image and used bwboundaries on it.
% Find black in the red channel:
binaryImage = rgbImage(:,:,1) < 128;
boundaries = bwboundaries(binaryImage);
% Extract x and y from the first blob.
x = boundaries{1}(:, 2);
y = boundaries{1}(:, 1);
Then save those out to a file. Then, to create a new one, you'd use poly2mask() and cat():
mask = poly2mask(x, y, rows, columns);
% Initialize color channel images.
redChannel = redValue * ones(rows, columns, 'uint8');
greenChannel = greenValue * ones(rows, columns, 'uint8');
blueChannel = blueValue * ones(rows, columns, 'uint8');
% Make mask area black in all channels
redChannel(mask) = 0;
greenChannel(mask) = 0;
blueChannel(mask) = 0;
% Combine into a true color RGB image
rgbImage = cat(3, redChannel, greenChannel, blueChannel);
For the reddish background, you need to know what redValue, greenValue, and blueValue are.
0 commentaires
Voir également
Catégories
En savoir plus sur Red dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!