日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

在Python中升级灰度图像

發布時間:2025/3/11 python 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在Python中升级灰度图像 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Upscaling of an image refers to enlarging the size of an image.

圖像放大是指放大圖像的大小。

In this program, we will be using two functions of OpenCV-python (cv2) module.. let's see their syntax and descriptions first

在此程序中,我們將使用OpenCV-python(cv2)模塊的兩個函數。.讓我們首先查看它們的語法和描述。

1) imread():
It takes an absolute path/relative path of your image file as an argument and returns its corresponding image matrix.

1)imread():
它以圖像文件的絕對路徑/相對路徑作為參數,并返回其對應的圖像矩陣。

If flag value is:

如果標志值為:

  • 1: Loads a color image.

    1 :加載彩色圖像。

  • 0: Loads image in grayscale mode.

    0 :以灰度模式加載圖像。

  • -1: Loads image as such including alpha channel.

    -1 :加載圖像,包括alpha通道。

If the flag value is not given then show the original image, which path is given.

如果未給出標志值,則顯示原始圖像,并給出哪個路徑。

2) imshow():
It takes window name and image matrix as an argument in order to display an image in a display window with a specified window name.

2)imshow():
它以窗口名稱和圖像矩陣為參數,以便在具有指定窗口名稱的顯示窗口中顯示圖像。

Also In this program, we will be using one function of numpy module.

同樣在此程序中,我們將使用numpy模塊的一個功能。

median(): It takes array and returns the median of the array .

平均():它接受array并返回array的中位數。

Also, in this program we are using the concept of array slicing

另外,在此程序中,我們使用數組切片的概念

Let, A is 1-d array:
A[start:stop:step]

設A為一維數組:
A [開始:停止:步驟]

  • start: Starting number of the sequence.

    start:序列的起始編號。

  • stop: Generate numbers up to, but not including this number.

    停止:生成不超過此數字的數字,但不包括此數字。

  • step: Difference between each number in the sequence.

    步驟:序列中每個數字之間的差。

  • Example:

    例:

    A = [1,2,3,4,5,6,7,8,9,10]print(A[ 1: 5])Output:[2,3,4,5]

    用于在Python中放大灰度圖像的Python程序 (Python program for upscaling the grayscale image in Python)

    # open-cv library is installed as cv2 in python # import cv2 library into this program import cv2# import numpy as np name import numpy as np# read an image using imread() function of cv2 # we have to pass only the path of the image img = cv2.imread(r'C:/Users/user/Desktop/pic6.jpg',0)# displaying the image using imshow() function of cv2 # In this : 1st argument is name of the frame # 2nd argument is the image matrix cv2.imshow('original image',img)# upscaling code# Upscaling the image x,y times along row and column x,y = 2, 2# 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 of x,y times # of previous image of 3-dimensions upscale_img = np.zeros((x*img.shape[0],y*img.shape[1]),np.uint8)i, m = 0, 0while m < img.shape[0] :j, n = 0, 0while n < img.shape[1]:# We assign pixel value from original image matrix to the# new upscaling image matrix in alternate rows and columnsupscale_img[i, j] = img[m, n]# increment j by y timesj += y# increment n by onen += 1# increment m by onem += 1# increment i by x timesi += xcv2.imshow('upscaling image',upscale_img)

    Output

    輸出量

    翻譯自: https://www.includehelp.com/python/upscaling-the-grayscale-image.aspx

    總結

    以上是生活随笔為你收集整理的在Python中升级灰度图像的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 欧美高清性| 美女扒逼 | 日韩三级理论 | 国产日本精品 | 天堂中文在线视频 | 嫩草在线看 | 5d肉蒲团之性战奶水 | 成人在线观看黄色 | 日韩欧美高清片 | 狠狠干2022 | 99热这里只有精品4 精品国产黄色 | 97色伦97色伦国产欧美空 | 第一毛片 | 成年在线观看视频 | av高清一区| 成人午夜精品视频 | 在线少妇| 国产youjizz| a免费在线 | av鲁丝一区二区鲁丝 | 中文字幕日韩欧美 | 女人张开腿让男人插 | 久草成人在线视频 | 成人欧美一区二区三区黑人 | 欧美123| 久草手机在线观看 | 美国一级片网站 | 综合视频一区 | 四季av在线一区二区三区 | 亚洲精品av中文字幕在线在线 | 加勒比不卡视频 | 国产aaa级片 | 在线香蕉 | 中文字幕被公侵犯的漂亮人妻 | 高潮一区二区三区 | 国产精品第八页 | 日韩av片在线播放 | www.四虎影视.com | 三级中文字幕 | 国产精品国产三级国产 | 中文字字幕在线中文乱码 | 国产一区福利 | 乳女教师の诱惑julia | 91精品国产综合久久久蜜臀粉嫩 | 邻居少妇张开腿让我爽了在线观看 | 深夜福利成人 | 操人网| 亚洲毛片在线播放 | 欧美在线视频网站 | 色老头av| 精品亚洲一区二区三区四区五区高 | 在线观看国产免费av | 国产精品黄网站 | 成人午夜高清 | 色狠狠一区二区三区 | 国产精品人八做人人女人a级刘 | 久久这里只有精品6 | 日韩在线亚洲 | 日本猛少妇色xxxxx | 欧美色图国产精品 | 大片av | 午夜福利理论片在线观看 | 中文字幕观看在线 | av在线不卡网 | av永久免费在线观看 | 美国三级a三级18 | 致命弯道8在线观看免费高清完整 | 大地资源在线观看免费高清版粤语 | 99国产精品欲 | 国产乱子伦一区二区 | 啪啪的网站| 国产精品一区二区三区不卡 | 日韩色综合 | 亚洲天堂首页 | 国产高清在线视频观看 | 丰满孕妇性春猛交xx大陆 | 久久综合伊人77777蜜臀 | 九九热精品在线视频 | 成人资源在线观看 | 美女自卫网站 | 国产精品久久免费视频 | 手机看片午夜 | 国产精品成人无码 | 国产精品久久久久久久久岛 | 9l视频自拍蝌蚪9l视频 | 久草91 | 热久久免费视频 | 亚洲欧美国产高清va在线播放 | 欧美日韩一区二区三区在线 | 一级做a视频 | 污到下面流水的视频 | 琪琪色在线视频 | 男女操操 | 精品久 | 国外成人性视频免费 | 亚洲AV无码精品色 | 人人综合网 | 五月天在线 | 欧美日韩啪啪 |