Created
March 31, 2024 10:01
-
-
Save TomoG29/fab591cfdb90caa6e26853aa313bb8ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import glob | |
import os | |
import getpass | |
# 入出力フォルダのパス | |
import_file = os.path.join("インポートしたい画像のフォルダパス") | |
export_file = os.path.join("エクスポートしたい画像のフォルダパス") | |
def main(): | |
# 対象画像のファイルパス取得 | |
files = glob.glob(os.path.join(import_file, '*.png')) | |
# ファイルごとに処理 | |
for file in files: | |
# 画像を読み込む | |
image = cv2.imread(file) | |
basename = os.path.basename(file) | |
## | |
## 処理 | |
## | |
# 画像を保存 | |
cv2.imwrite(os.path.join(export_file, 'result_' + basename), image) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment