티스토리 뷰
728x90
반응형
python 은 이미지 데이터 세트 의 RGB 평균 값 을 자동 으로 계산 합 니 다.
[BOJ] 백준 4673 - 셀프 넘버 👩🏻💻 문제 👩🏻💻 정답 코드 numbers 집합에 1부터 10000까지를 넣고, for문을 돌리면서 각 자릿수와 숫자 자체를 generated 집합에 넣어 준다. 집합을 사용함으로써
intrepidgeeks.com
'''
qhy
2018.12.3
'''
import os
import numpy as np
import cv2
ims_path = './photo/sorted_by_data/2022-04-05/' #
ims_list = os.listdir(ims_path)
R_means = []
G_means = []
B_means = []
for im_list in ims_list:
print(ims_list)
im = cv2.imread(ims_path + im_list)
# extrect value of diffient channel
im_R = im[:, :, 0]
im_G = im[:, :, 1]
im_B = im[:, :, 2]
# count mean for every channel
im_R_mean = np.mean(im_R)
im_G_mean = np.mean(im_G)
im_B_mean = np.mean(im_B)
# save single mean value to a set of means
R_means.append(im_R_mean)
G_means.append(im_G_mean)
B_means.append(im_B_mean)
print("mean",im_list,im_R_mean,im_G_mean,im_B_mean)
# three sets into a large set
a = [R_means, G_means, B_means]
mean = [0, 0, 0]
# count the sum of different channel means
mean[0] = np.mean(a[0])
mean[1] = np.mean(a[1])
mean[2] = np.mean(a[2])
print( "",mean[0],mean[1],mean[2])
나는 폴더별로 해야하니까 ...
다음이시간에
728x90
반응형
'Coding > Python' 카테고리의 다른 글
python _ image 평균 (0) | 2022.12.10 |
---|---|
python_ Touchdesigner : txt을 csv 파일로, 그래프로 표현하기 (0) | 2022.09.19 |
python: 단어 빈도수 통계 (0) | 2022.09.08 |
python : 사진 분류 정리 (0) | 2022.06.22 |
Python_vi편집기 (0) | 2022.03.10 |
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- ai film
- houdini
- Express
- Python
- Java
- ai image generator
- sequelize
- MQTT
- 후디니
- oculuspro
- docker
- Arduino
- krea
- AI
- 유니티
- Unity
- 라즈베리파이
- DeepLeaning
- runwayai
- google ai studio
- three.js
- node.js
- CNC
- VR
- TouchDesigner
- colab
- Midjourney
- RNN
- imgtoimg
- opencv
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함
반응형