Code Monkey home page Code Monkey logo

imggenerater's Introduction

基于Opencv 的图片生成器

  • 使用json文件配置,生成图片, 目前仅仅支持直线 和 矩形

依赖

  • python
  • opencv-python

json 文件格式

  • 导出的坐标系约定:原点在左上角,x正轴往右, y正轴往下
{
    width: 图片宽度,
    heigh: 图片高度,
    title: 图片标题,
    
    lines: [
        {
            color : 颜色(可选){r:?, g:?, b:?}
            points : [
                x1,
                y1,
                x2,
                y2,
                ...
            ]
        },
        ...
    ],
    rects: [
        {
            color : 颜色(可选){r:?, g:?, b:?}
            x : x,
            y : y,
            w : width,
            h : heigh,
            id: 矩形id(string), 会在矩形左上角显示
        },
        ...
    ]
}

Getting started

  • 基本用法
    python3 generate.py <json文件路径或目录>
  • 测试, 将test_res 目录的所有json文件生成对应的图片
    python3 generate.py ./test_res

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.