Giter VIP home page Giter VIP logo

grabel's Introduction

grabel

grab label!

goal

This repo was designed for quickly grabbing icons (or something like ImageView/TextView, etc.), as pictures, from Android screen.

I have used this repo to collect image data for training models.

usage

It's really lightweight but effective because of its powerful dependencies.

from grabel import Grabel
import cv2


# init your android device
grab = Grabel("123456F")
# a tree view
tree = grab.get_tree()
# and a screen shot
screen = grab.get_screen_array()

# flexible filter for different widgets, to get whatever you want
node_list = grab.node_filter(tree, {"@class": "android.widget.ImageView"})

# and, crop them out from screen
for i, each in enumerate(node_list):
    
    # get their locations
    location = grab.get_node_location(each)
    
    # and crop
    sub = grab.crop(screen, location[0], location[1])
    
    # sub is a np.ndarray
    # you can save it as a file
    cv2.imwrite(f"{i}.png", sub)

example

This is my screen:

temp.png

and get all the ImageView from it:

1.png

license

MIT

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.