How to make partial screenshot via ADB

Viewed 278

Just for curiosity I'm trying to automatically control some app (simple game) which checks user reflex (similar dynamic gauge like in "Burrito Bison"). My approach was to capture game screen via ADB, analyze part of the screen and if some graphic appears in certain area, fire up fake touch the screen.

I figured out the fastest way for fake touch the screen (writing touch events directly to touch device "file"). My bottleneck now is capturing screens. After digging around I found that the fastest (so far) way to take the screen is to use screencap bin tool. My screen resolution is 720x1480 so it takes approx. 0.4s to take whole screen:

sta=time.time(); out, err = sp.Popen('adb shell screencap > /sdcard/scrs/scr.1', stdout=sp.PIPE).communicate(); sto=time.time(); sto-sta
0.4085681438446045

I need only to check area like 20x20 pix. I wonder if there is any way to capture only small part of the screen (framebuffer and seek function?). If it's possible, I would like to avoid creating some android java app and put it into my phone.

Is there anything similar to what screencap does but with parameters like x,y,w,z to set some ROI rectangular?

For any help, thanks!

0 Answers
Related