c++ - GetPixel is WAY too slow -
i have bunch of squares , each has specific identity/symbol need identify. far have like:
#include <iostream> #include <windows.h> using namespace std; int main() { hdc dc = getdc(0); colorref color; int sum, x, y; while (true) { sum = 0; sleep(100); (x = 512; x < 521; x++) { (y = 550; y < 565; y++) { color = getpixel(dc, x, y); sum = getrvalue(color) + getbvalue(color) + getgvalue(color); } } cout << "sum: " << sum << endl; } return 0; }
obviously scans 1 block far. problem somehow though it's on 100 pixels, takes insanely long time. can't imagine going on. takes on second, maybe 2 seconds, each repetition. can do? there has faster way this. if can't query individual pixels, there way region of screen? zone not inside program's window.
Comments
Post a Comment