In Digital image processing, a colored image is represented in a 3-Dimensional matrix. Image can be represented in various color models such as RGB (Red, Green, Blue) model, HSV (Hue, Saturation, Value) model, YIQ (Luminance-Inphase Quadrature) model, CMYK (Cyan, Magenta, Yellow, Black) model. Generally, an image is represented in the RGB model. The first channel of the matrix is Red, the second channel is the Green and the third channel is Blue.
Approach to draw Sudan Flag:
- Create a zero matrix of 300X600X3.300 is the number of rows, 600 is the number of columns and 3 represent RGB color channel. Fill the matrix with (255, 255, 255). 255 represent white pixel and 0 represent black pixel.
img(:, :, :)=255
- Fill the matrix with crimson color(210, 16, 42) between rows from 1 to 100 and between columns from 151:600.
- Fill the matrix with black(0, 0, 0) between rows from 200 to 300 and between columns from 151:600.
- After these operations, our image looks like this
- Now, we have to draw one upper triangle and one lower triangle.
- For lower triangle, from row 1 to 150 and column 1 to 150 fill the matrix with green color(0, 114, 14)
- Similarly, for upper triangle, from row 150 to 300 and column 1 to 150 fill the matrix with green color(0, 114, 14)
Implementation is given below:
- Draw Austria flag using Matlab
- Draw Kuwait Flag using MATLAB
- Draw Thailand Flag Using MATLAB
- Draw Switzerland Flag Using Matlab
- Draw Bangladesh Flag Using Matlab
- Draw Sweden Flag using matlab
- How to draw Japan flag using MATLAB
- Draw Indian Flag using matlab
- Draw Seychelles Flag using MATLAB
- Introduction to MATLAB
- Applications of MATLAB
- Matlab | Erosion of an Image
- Image Complement in Matlab
- Reverse Video in Matlab
- Image Resizing in Matlab
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.