os.walk

Detection of certain pixels of a grayscale image

ぃ、小莉子 提交于 2020-12-13 07:08:18
问题 I have this code that allows you to detect pixels of a vertain value. Right now I'm detecting pixels over a certain value (27). My idea would be to still detect them but to detect another pixel values (I want to detec pixels from 65 to 75, another interval of pixels). How can I do this? As you may see, T'm detecting grayscale images, so I have this same value for red, green and blue. Any idea to improve this program in order to work faster would be really appreciated. Sucha as using os.walk

Detection of certain pixels of a grayscale image

走远了吗. 提交于 2020-12-13 07:03:36
问题 I have this code that allows you to detect pixels of a vertain value. Right now I'm detecting pixels over a certain value (27). My idea would be to still detect them but to detect another pixel values (I want to detec pixels from 65 to 75, another interval of pixels). How can I do this? As you may see, T'm detecting grayscale images, so I have this same value for red, green and blue. Any idea to improve this program in order to work faster would be really appreciated. Sucha as using os.walk

Detection of certain pixels of a grayscale image

为君一笑 提交于 2020-12-13 07:03:26
问题 I have this code that allows you to detect pixels of a vertain value. Right now I'm detecting pixels over a certain value (27). My idea would be to still detect them but to detect another pixel values (I want to detec pixels from 65 to 75, another interval of pixels). How can I do this? As you may see, T'm detecting grayscale images, so I have this same value for red, green and blue. Any idea to improve this program in order to work faster would be really appreciated. Sucha as using os.walk

Python 3.5 OS.Walk for selected folders and include their subfolders

大城市里の小女人 提交于 2020-03-26 07:54:08
问题 I'm writing a python script where I search a specific string across a tree directory. I ask the end-user to define which folders they would like to include in the search, and once the script finds one of the folders that the user would like to scan, the script is supposed to also scan all the sub-folders for this selected folder. I'm trying to do a couple of for loops, but I can't get it to work. The beginning of the script looks like: startTime = datetime.datetime.now() option = input("Do

Why does this recursive copy function copy all files into every directory above the correct one?

爱⌒轻易说出口 提交于 2020-02-07 09:08:34
问题 I write a function to copy files from directory A to directory B recursive. The code is like this: import os import shutil import sys from os.path import join, exists def copy_file(src, dest): for path, dirs, files in os.walk(src, topdown=True): if len(dirs) > 0: for di in dirs: copy_file(join(path, di), join(dest, di)) if not exists(dest): os.makedirs(dest) for fi in files: shutil.copy(join(path, fi), dest) In my test, the input args are like this: src = d:/dev and it have one sub directory