#!/usr/bin/env python

from PIL import Image

img = Image.open("./screen.png")

maps = [[] for i in range(11)]
for i in range(11):
    for j in range(11):
        maps[i].append(0)

PURPLE = (197,61,255,255)
RED = (230, 69, 115,255)
BLUE = (74,190,255,255)
GREEN = (107,202,33,255)
YELLOW = (255,186,16,255)

COLORS = [PURPLE, RED, BLUE, GREEN, YELLOW]

for i in range(1, 11):
    for j in range(1, 11):
        x = 104 + 144 * (j - 1)
        y = 945 + 144 * (i - 1)
        c = img.getpixel((x, y))
        if c in COLORS:
            maps[i][j] = COLORS.index(c) + 1

f = open('maps.rslt', 'w')
for i in range(1, 11):
    tmp = ''
    for j in range(1, 11):
        tmp += str(maps[i][j]) + ' '
    f.writelines(str(tmp))
    f.write('\n')
f.close()

print('maps.rslt Generate DONE.')

analysis_screencap的更多相关文章

  1. Get_init_color_map

    #!/bin/bash./simulate_screencap.sh./analysis_screencap.py

随机推荐

  1. Dockerfile自动制作Docker镜像(二)—— 其它常用命令

    Dockerfile自动制作Docker镜像(二)-- 其它常用命令 前言 a. 本文主要为 Docker的视频教程 笔记. b. 环境为 CentOS 7.0 云服务器 c. 上一篇:Dockerf ...

  2. POJ3061——Subsequence(尺取法)

    Subsequence POJ - 3061 给定长度为n的数列整数a0,a1,a2-an-1以及整数S.求出总和不小于S的连续子序列的长度的最小值,如果解不存在输出0. 反复推进区间的开头和末尾,来 ...

  3. 【PHP】保留两位小数并向上取整

    问题: 一开始我想着数值*100然后向上取整然后再除以一百 $num = 1000 * 0.9634; echo $num; echo '</br>'; $res = ceil($num ...

  4. 【PHP】数组按照字母排序

    /** * 将数组按字母A-Z排序 * @return [type] [description] */ private function chartSort($list) { // $user=$th ...

  5. Docker系列(2)- Docker中的名词概念

    Docker工作流程 名词概念 镜像(image): docker镜像就好比一个模板,可以通过这个模板来创建容器服务,tomcat镜像===>run===>tomcat01(提供服务器) ...

  6. sonar-scanner命令参数分析

    C:\Users\huang>sonar-scanner -h INFO: INFO: usage: sonar-scanner [options] INFO: INFO: Options: I ...

  7. verifycode验证码模版

    # -*- coding:utf-8 -*- from django.shortcuts import HttpResponse def verifycode(request): # 引入绘图模块 f ...

  8. Abp vNext 番外篇-疑难杂症丨浅谈扩展属性与多用户设计

    说明 Abp vNext基础篇的文章还差一个单元测试模块就基本上完成了我争取10.1放假之前给大家赶稿出来,后面我们会开始进阶篇,开始拆一些东西,具体要做的事我会单独开一个文章来讲 缘起 本篇文章缘起 ...

  9. Windows 10、Windows Server 定时任务(定时关机)

    前言 在测试过程中,有些测试机每天都需要关机,一台台很麻烦,于是想起了Windows的任务计划程序,想着试一试,就将具体过程记录一下. 过程 Windows 搜索任务计划程序 创建任务(不要选错了) ...

  10. C语言练习:hackerrank十五关

    第一关:Hello World C 输入一行字符串(可能含空格),输出hello world\n,字符串 Sample Input 0 Welcome to C programming. Sample ...