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.pswp.cn/news/379757.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/379757.shtml
英文地址,請注明出處:http://en.pswp.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;可以在任務與任務…