五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【Python】關(guān)于圖片操作(續(xù))

2023-03-30 23:06 作者:RhinoCode  | 我要投稿

與上篇內(nèi)容區(qū)別:將導入圖片的分別率大小改變再進行操作。

__author__ = "RhinoCode BiliBili"

__version__ = "2023.03.30"

import System.Drawing as sd

import Rhino.Geometry as rg


#導入圖片

image_path = "D:\LG\Record\C_封面\gg.jpg"

image = sd.Bitmap(image_path)


#獲取圖片分辨率

width, height = image.Width, image.Height


#改變圖片分別率

re_width, re_height = int(width/10), int(height/10)

resize_image = sd.Bitmap(re_width,re_height)

graphics = sd.Graphics.FromImage(resize_image)

graphics.DrawImage(image,0,0,re_width,re_height)

graphics.Dispose()


#在圖片范圍內(nèi)生成點,點的z值為點對應(yīng)圖片位置顏色RGB的B通道值

colors = []

points = []

for x in range(re_width):

? ? for y in range(re_height):

? ? ? ? color = resize_image.GetPixel(x,y)

? ? ? ? colors.append(color)

? ? ? ? point = rg.Point3d(x,y,color.B/100)

? ? ? ? points.append(point)


#輸出

a = colors

b = points


【Python】關(guān)于圖片操作(續(xù))的評論 (共 條)

分享到微博請遵守國家法律
沈阳市| 苍溪县| 酒泉市| 平江县| 金昌市| 罗田县| 开江县| 沽源县| 深州市| 乌拉特中旗| 通河县| 丰台区| 北川| 筠连县| 新邵县| 安阳市| 子洲县| 扎赉特旗| 望城县| 黑水县| 安龙县| 长宁区| 济阳县| 襄樊市| 信丰县| 桃源县| 普兰县| 延庆县| 象山县| 钟祥市| 隆安县| 都匀市| 枣强县| 双江| 阿拉善盟| 库车县| 铜梁县| 武邑县| 那坡县| 驻马店市| 嘉义县|