python 日本就业
Read basics of the drawing/image processing in python: Drawing flag of Thailand
阅读python中绘图/图像处理的基础知识: 泰国的绘图标志
The national flag of Japan is a rectangular white banner bearing a crimson-red disc at its center. This flag is officially called Nisshōki but is more commonly known in Japan as Hinomaru. It embodies the country's sobriquet: Land of the Rising Sun.
日本的国旗是矩形的白色横幅,其中心带有深红色的圆盘。 该旗帜正式被称为Nisshōki,但在日本更广为人知。 它体现了该国的缩写:旭日之国。
Steps:
脚步:
First, we make a matrix of dimensions 300 X 600 X 3. Where the number of pixels of rows is 300, the number of pixels of columns is 600 and 3 represent the number of dimensions of the color coding in BGR format.
首先,我们制作一个尺寸为300 X 600 X 3的矩阵。如果行的像素数为300,则列的像素数为600,而3表示BGR格式的颜色编码的维数。
- Paint the complete image with white color. BGR code for White is (255,255,255). - 用白色绘制整个图像。 白色的BGR代码是(255,255,255)。 
- Apply loop on rows and columns and implement the equation of the circle such that we get a circle in the center of the flag and color it crimson glory using RGB format. - 在行和列上应用循环并实现圆的方程,这样我们就可以在标志的中心得到一个圆,并使用RGB格式为其着色为深红色。 
Equation of circle:
圆方程:
    ((x-h)^2 - (y-k)^2)=r^2
Where (h, k) are the centres, (x, y) are co-ordinates of x-axis and y-axis and r is the radius of the circle.
其中(h,k)是中心, (x,y)是x轴和y轴的坐标, r是圆的半径。
bgrcode for crimson glory color is (45, 0, 188).
深红色的荣耀颜色的bgrcode是( 45,0,188 )。
Python代码绘制日本国旗 (Python code to draw flag of Japan)
# import numpy library as np
import numpy as np
# import open-cv library
import cv2
# import sqrt function from the math module
from math import sqrt
# here image is of class 'uint8', the range of values  
# that each colour component can have is [0 - 255]
# create a zero matrix of order 300x600 of 3-dimensions
flag = np.zeros((300, 600, 3),np.uint8)
# take coordinate of the circle
center_x, center_y = 150, 300
# take radius of the circle
radius = 50
# fill whole pixels of dimensions
# with White color
flag[:, :, :] = 255;
# Draw a circle with crimson glory color
# loop for rows i.e. for x-axis
for i in range(101,201) :
# loop for columns i.e. for y-axis 
for j in range(251, 351) :
#applying the equation of circle to make the circle in the center. 
distance = sqrt((center_x - i)**2 + (center_y - j)**2)
if distance <= radius :
# fill the circle with crimson glory 
# color using RGB color representation. 
flag[i, j, 0] = 45
flag[i, j, 1] = 0
flag[i, j, 2] = 188
# Show the image formed
cv2.imshow("Japan Flag",flag);
Output
输出量

翻译自: https://www.includehelp.com/python/drawing-flag-of-japan-image-processing-in-python.aspx
python 日本就业