当前位置: 首页>>代码示例>>Python>>正文


Python paths.list_images方法代码示例

本文整理汇总了Python中imutils.paths.list_images方法的典型用法代码示例。如果您正苦于以下问题:Python paths.list_images方法的具体用法?Python paths.list_images怎么用?Python paths.list_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在imutils.paths的用法示例。


在下文中一共展示了paths.list_images方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: animate

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def animate(src, gif_name, reshape=None, fps=25):

    if not isinstance(src, list):

        if os.path.isdir(src):

            src = list(paths.list_images(src))

            for idx, image in enumerate(src):
                src[idx] = cv2.imread(image)

    if reshape:

        for idx, image in enumerate(src):
            src[idx] = cv2.resize(image, reshape)

    for idx, image in enumerate(src):
            src[idx] = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

    src = np.array(src)
    
    imageio.mimsave(gif_name, src, fps=fps) 
开发者ID:arunponnusamy,项目名称:cvlib,代码行数:24,代码来源:utils.py

示例2: generateTrainingImages2

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def generateTrainingImages2():

    currentNumOfData = len(sorted(list(paths.list_images("generatedData/"))))

    print("[INFO] Type anything and press enter to begin...")
    input()

    startTime = time.time()

    i = 0

    while (True):

        if (time.time()-startTime > 1):
            print("--------Captured Data--------")

            im = ImageGrab.grab()
            im.save("generatedData/input" + str(i+1+currentNumOfData) + ".png")
            i += 1

            startTime = time.time() 
开发者ID:AmarSaini,项目名称:Clash-Royale-AI-Card-Tracker,代码行数:23,代码来源:load_train_test_2.py

示例3: loadTrainingImages1

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def loadTrainingImages1():
    x_train = np.zeros((96, 32, 32, 3))

    imagePaths = sorted(list(paths.list_images("trainData/")))

    for i in range(len(imagePaths)):

        img = cv2.imread(imagePaths[i])
        img = cv2.resize(img, (32, 32))
        img = img_to_array(img)
        x_train[i] = img

    y_train = np.zeros(len(x_train))

    for i in range(len(y_train)):
        y_train[i] = i

    return x_train, y_train 
开发者ID:AmarSaini,项目名称:Clash-Royale-AI-Card-Tracker,代码行数:20,代码来源:load_train_test_1.py

示例4: modelPredicts1

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def modelPredicts1():

    loadTestingImages1()

    imageNames = sorted(list(paths.list_images("trainData/")))

    for i in range(len(imageNames)):
        imageNames[i] = imageNames[i][imageNames[i].find('/')+1:-4]

    print("[INFO] loading network...")
    model = load_model("testNet.model")

    for i in range(8):
        img = cv2.imread("testData/output" + str(i+1) + ".png")
        orig = img.copy()

        img = cv2.resize(img, (32, 32))
        img = img.astype("float")/255.0
        img = img_to_array(img)
        img = np.expand_dims(img, axis=0)


        output = model.predict(img)[0]
        label = output.argmax()

        print(output)
        print(label)

        label = "{}: {:.2f}%".format(imageNames[label], output[label] * 100)

        print(label)

        orig = cv2.resize(orig, (400, 400))
        cv2.putText(orig, label, (10, 25), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2)

        cv2.imshow("Output", orig)
        cv2.waitKey(0) 
开发者ID:AmarSaini,项目名称:Clash-Royale-AI-Card-Tracker,代码行数:39,代码来源:train_predict_cards.py

示例5: labelTrainingData2

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def labelTrainingData2():

    imagePaths = sorted(list(paths.list_images("generatedData/")))
    currentNumOfLabeledData = len(sorted(list(paths.list_images("trainData2/"))))

    root = tkinter.Tk()
    myFrame = tkinter.LabelFrame(root, text="Unlabeled Data", labelanchor="n")
    myFrame.pack()

    labeledCount = 0

    for i in range(len(imagePaths)):
        img = Image.open(imagePaths[i])
        img.thumbnail((1500, 1500), Image.ANTIALIAS)
        img = ImageTk.PhotoImage(img)
        panel = tkinter.Label(myFrame, image = img)
        panel.image = img
        panel.grid(row=0, column=0)
        root.update()

        label = input()

        if (label != 'e'):
            copyfile(imagePaths[i], "trainData2/"+label+"input"+str(labeledCount+currentNumOfLabeledData)+".png")
            labeledCount += 1

        os.remove(imagePaths[i]) 
开发者ID:AmarSaini,项目名称:Clash-Royale-AI-Card-Tracker,代码行数:29,代码来源:load_train_test_2.py

示例6: createCardCollection

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def createCardCollection():
    imageNames = sorted(list(paths.list_images("trainData/")))

    for i in range(len(imageNames)):
        imageNames[i] = imageNames[i][imageNames[i].find('/')+1:-4]

    cardCollection = dict()

    for x in imageNames:
        print(x)
        cardCollection[x] = int(input())

    with open('cardCollection.txt', 'w') as f:
        for key, value in cardCollection.items():
            f.write('%s:%s\n' % (key, value)) 
开发者ID:AmarSaini,项目名称:Clash-Royale-AI-Card-Tracker,代码行数:17,代码来源:Clash_Royale_Helper.py

示例7: __init__

# 需要导入模块: from imutils import paths [as 别名]
# 或者: from imutils.paths import list_images [as 别名]
def __init__(self, img_dir, imgSize, lpr_max_len, PreprocFun=None):
        self.img_dir = img_dir
        self.img_paths = []
        for i in range(len(img_dir)):
            self.img_paths += [el for el in paths.list_images(img_dir[i])]
        random.shuffle(self.img_paths)
        self.img_size = imgSize
        self.lpr_max_len = lpr_max_len
        if PreprocFun is not None:
            self.PreprocFun = PreprocFun
        else:
            self.PreprocFun = self.transform 
开发者ID:sirius-ai,项目名称:LPRNet_Pytorch,代码行数:14,代码来源:load_data.py


注:本文中的imutils.paths.list_images方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。