python 日本就业_日本的绘图标志 Python中的图像处理

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

输出量

Drawing flag of Japan | Image processing in Python

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

python 日本就业

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/379757.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

[windows phone 7 ]查看已安装程序GUID

首先介绍下wp7RootToolsSDK,这个功能相当强大&#xff0c;适合研究wp7高级功能。 它支持File&#xff0c;Register操作&#xff0c;比之前的COM调用要简单&#xff0c;方便。 功能:查看已安装程序的guid 开发心得: 用的是mozart,rom多&#xff0c;刷机吧&#xff0c;最麻烦的是…

FreeRTOS任务挂起和恢复

任务挂起&#xff1a;暂停某个任务的执行 任务恢复&#xff1a;让暂停的任务继续执行 通过任务挂起和恢复&#xff0c;可以达到让任务停止一段时间后重新运行。 相关API函数&#xff1a; vTaskSuspend void vTaskSuspend( TaskHandle_t xTaskToSuspend );xTaskToSuspend &am…

向oracle存储过程中传参值出现乱码

在页面中加入<meta http-equiv"Content-Type" content"text ml;charsetUTF-8"/>就可以解决这一问题 适用情况&#xff1a; 1.中文 2.特殊符号 转载于:https://www.cnblogs.com/GoalRyan/archive/2009/02/16/1391348.html

Scala程序将多行字符串转换为数组

Scala | 多行字符串到数组 (Scala | Multiline strings to an array) Scala programming language is employed in working with data logs and their manipulation. Data logs are entered into the code as a single string which might contain multiple lines of code and …

SQL 异常处理 Begin try end try begin catch end catch--转

SQL 异常处理 Begin try end try begin catch end catch 总结了一下错误捕捉方法:try catch ,error, raiserror 这是在数据库转换的时候用的的异常处理, Begin TryInsert into SDT.dbo.DYEmpLostTM(LogDate,ProdGroup,ShiftCode,EmployeeNo,MONo,OpNo,OTFlag,LostTypeID,OffStd…

FreeRTOS中断配置与临界段

Cortex-M中断 中断是指计算机运行过程中&#xff0c;出现某些意外情况需主机干预时&#xff0c;机器能自动停止正在运行的程序并转入处理新情况的程序&#xff08;中断服务程序&#xff09;&#xff0c;处理完毕后又返回原被暂停的程序继续运行。Cortex-M内核的MCU提供了一个用…

vector向量容器

一、vector向量容器 简介&#xff1a; Vector向量容器可以简单的理解为一个数组&#xff0c;它的下标也是从0开始的&#xff0c;使用时可以不用确定大小&#xff0c;但是它可以对于元素的插入和删除&#xff0c;可以进行动态调整所占用的内存空间&#xff0c;它里面有很多系统…

netsh(二)

netsh 来自微软的网络管理看家法宝很多时候&#xff0c;我们可能需要在不同的网络中工作&#xff0c;一遍又一遍地重复修改IP地址是一件比较麻烦的事。另外&#xff0c;系统崩溃了&#xff0c;重新配置网卡等相关参数也比较烦人&#xff08;尤其是无线网卡&#xff09;。事实上…

java uuid静态方法_Java UUID getLeastSignificantBits()方法与示例

java uuid静态方法UUID类getLeastSignificantBits()方法 (UUID Class getLeastSignificantBits() method) getLeastSignificantBits() method is available in java.util package. getLeastSignificantBits()方法在java.util包中可用。 getLeastSignificantBits() method is us…

Google C2Dm相关文章

Android C2DM学习——云端推送&#xff1a;http://blog.csdn.net/ichliebephone/article/details/6591071 Android C2DM学习——客户端代码开发&#xff1a;http://blog.csdn.net/ichliebephone/article/details/6626864 Android C2DM学习——服务器端代码开发&#xff1a;http…

FreeRTOS的列表和列表项

列表和列表项 列表 列表是FreeRTOS中的一个数据结构&#xff0c;概念上和链表有点类型&#xff0c;是一个循环双向链表&#xff0c;列表被用来跟踪FreeRTOS中的任务。列表的类型是List_T&#xff0c;具体定义如下&#xff1a; typedef struct xLIST {listFIRST_LIST_INTEGRI…

string基本字符系列容器

二、string基本字符系列容器 简介&#xff1a;C语言只提供了一个char类型来处理字符&#xff0c;而对于字符串&#xff0c;只能通过字符串数组来处理&#xff0c;显得十分不方便。CSTL提供了string基本字符系列容器来处理字符串&#xff0c;可以把string理解为字符串类&#x…

正则表达式(一)

正则表达式概述 1.1什么是正则表达式&#xff1f; 正则表达式(Regular Expression)起源于人类神经系统的早期研究。神经生理学家Warren McCulloch和Walter Pitts研究出一种使用数学方式描述神经网络的方法。1956年&#xff0c;数学家Stephen Kleene发表了一篇标题为“神经…

42.有“舍”才有“得”

大干世界&#xff0c;万种诱惑&#xff0c;什么都想要&#xff0c;会累死你&#xff0c;该放就放&#xff0c;该舍就舍。人必须先有所舍&#xff0c;才能有所得&#xff0c;舍如同种子撒播出去&#xff0c;转了一圈&#xff0c;又带了一大群子子孙孙回来。“舍”永远在“得”的…

Java StringBuilder codePointCount()方法与示例

StringBuilder类codePointCount()方法 (StringBuilder Class codePointCount() method) codePointCount() method is available in java.lang package. codePointCount()方法在java.lang包中可用。 codePointCount() method is used to count the number of Unicode code point…

FreeRTOS时间管理

在使用FreeRTOS的过程中&#xff0c;我们通常会在一个任务函数中使用延时函数对这个任务延时&#xff0c;当执行延时函数的时候就会进行任务切换&#xff0c;并且此任务就会进入阻塞太&#xff0c;直到延时完成&#xff0c;任务重新进入就绪态。延时函数舒属于FreeRTOS的时间管…

set和multiset集合容器

三、①set集合容器 简介&#xff1a;set集合的目的就是为了快速检索。set集合容器实现了红黑树的平衡二叉检索树的数据结构。set集合里面不允许有重复的元素出现&#xff1b;使用set容器前&#xff0c;需要在程序的头文件中声明 #include < set >。 函数方法总结&#…

javascript获取select的值全解

获取显示的汉字 document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text 获取数据库中的id window.document.getElementById("bigclass").value 获取select组分配的索引id window.docume…

Java File类void deleteOnExit()方法(带示例)

文件类void deleteOnExit() (File Class void deleteOnExit()) This method is available in package java.io.File.deleteOnExit(). 软件包java.io.File.deleteOnExit()中提供了此方法。 This method is used to delete the file or directory when the virtual machine termi…

FreeRTOS队列

在实际应用中&#xff0c;我们会遇到一个任务或者中断服务需要和另一个任务进行消息传递&#xff0c;FreeRTOS提供了队列的机制来完成任务与任务、任务与中断之间的消息传递。 0x01 队列简介 队列是为了任务与任务、任务与中断之间的通信而准备的&#xff0c;可以在任务与任务…