Videoma’lumotlarga raqamli ishlov berish


Download 1.12 Mb.
Sana09.03.2023
Hajmi1.12 Mb.
#1255012
Bog'liq
lab2

VIDEOMA’LUMOTLARGA RAQAMLI ISHLOV BERISH

Begmatov Shoxrux, PhD

Toshkent 2023


2. Kadrdagi piksellar qiymatini aniqlash
2-laboratoriya

Rasmlarni kichiklashtirish natijalari


444x444
24x24
12x12
2-laboratoriya

Dastur kodi


import cv2 from matplotlib import pyplot as plt img = cv2.imread("imgs/amir temur.jpg") img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.resize(img, (12,12)) fig, ax = plt.subplots(figsize=(10, 10)) ax.imshow(img) ax.axis('off') plt.show()
1
2
3
4
5
6
7
8
9
10
11
2-laboratoriya
cv2.imread("../input/test-imgs/amir temur.jpg")

Qo’llanilgan funksiyalar

cv2.imread([add],[kod]) - Bu funksiya ikkita argument qabul qiladi. Birinchisi argument ‘add’ rasmning addresi. Rasm ishchi addresda bo’lishi yoki rasmning to’liq addresi ko’rsatilishi zarur.

Ikkinchi argument ‘kod’ rasmni o’qish rejimi bayrog’i. U uch xil bo’lishi mumkin:

cv2.IMREAD_COLOR: rangli o’qish rejmi. Alfa kanal inkor qilinadi.

cv2.IMREAD_GRAYSCALE : oq-qora rejimda o’qish

cv2.IMREAD_UNCHANGED: o’zgartirishsiz o’qish. Alfa kanal ham o’qiladi.


2-laboratoriya

Qo’llanilgan funksiyalar

cv2.cvtColor([img],[kod]) funskiyasi yordamida chiziq chizish mumkin. Funksiya quyidagi parametrlarni qabul qiladi:

img – kiruvchi rasm nomi;

kod- rasmni o’zgartirish rejimi raqami;


2-laboratoriya

Dastur natijasi


2-laboratoriya

Topshiriq

  • O’zingizni yirik o’lchamda rasmga oling va yuqorida ko’rsatilgan dastur yordamida 12x12 o’lchamga o’tkazib oling.
  • Xar bir piksel ranglarni RGB kanallari bo’yicha qiymatlarni aniqlang quyidagi namunadagi kabi natijaga olib keling.

2-laboratoriya

ADD4FB AFD2FA AFD2FA B0D3FB B1D2F5 B3D4FD B0D1FA B5CDF1 AACBF4 ABCAF6 ACCDF8 B2CEF3
B7D5F9 B5D6F9 B5D6F5 BAD9F6 07060B C6DFFD 807C7B C7DAFB C6DAF5 C7D8F4 C0D5F4 B6D3F5
C8DDFC CBDCF8 CEDFFB DBE2E8 FDFDF5 221D1A B9B1A6 0D0D0F 76736E FFFFFF FEFFFF FFFFFD
C6D8FC D1D6DC F5F3F4 A49576 E7DFCA 050409 151320 020100 FEFEFE FEFDF9 FFFFF7 ECE4C0
C4C5C0 C5C5C5 E9EAE5 F6F7F2 FFFFFB 111119 41423D 000000 B3B4AF D5D6D1 DEDFDA E8E9E4
FEFEFE FEFEFE FEFEFE FEFEFE FEFEFE 010000 5F564D 6C5F56 FEFEFE FEFEFE FEFEFE FEFEFE
FBFBF9 FDFDFF FEFEFC FDFDFB 232122 010002 232122 070508 77814F FEFEFC FEFEFE FFFFFF
FDFDFF 303C52 FDFDFD 353B51 090909 000000 050000 333F33 A9B98A BDCDA8 C5C4C9 96A3B3
FEFCFF 40525E FEFEFE 515D6B FDFDFD 4E4035 8B8279 596774 041000 536154 D0D3D8 50606F
FDFDFD 273649 F1F4E1 4C584C FEFEFE 3E4D60 060604 3B4755 D0D1D3 313F48 DBDADF 404C5A
FCFCFC 31452A C3C8A8 43544C 343436 0B0A0F 33291F 503B26 D8D8DA 44525F E0DEE3 394754
FEFEFF 4A555B 95927F 333B23 2D271B 15150D 9E887B AC9283 977C69 FEFEFC D8D8DA 39484F
2-laboratoriya

E’TIBORINGIZ UCHUN RAHMAT


Download 1.12 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling