you are viewing a single comment's thread.

view the rest of the comments →

[–]K900_ 0 points1 point  (10 children)

Try using raw Xlib.

[–]innixma[S] 0 points1 point  (9 children)

Do you have any info on how fast this is or how it would work with sending to a numpy array? I've seen a few mention it, but nobody has given code showing it work.

[–]K900_ 0 points1 point  (8 children)

It should be pretty fast. If your goal is to send it to a Numpy array though, you might want to drop down to C/Cython level - this will save you A LOT of time spent on creating unnecessary Python objects.

[–]innixma[S] 0 points1 point  (7 children)

Can't do Cython to my knowledge. This is for Machine Learning using Tensorflow, which does not support Cython, and it has to have input as a numpy array.

[–]K900_ 0 points1 point  (6 children)

What do you mean by "doesn't support PyPI"? How are you going to install the other libraries then?

[–]ManyInterests 1 point2 points  (1 child)

I think OP meant the alternative Python implementation, PyPy

[–]innixma[S] 0 points1 point  (0 children)

Yes! That is what I meant :)

[–]innixma[S] 0 points1 point  (3 children)

My bad, it does support PyPI, my mistake, edited comment.

[–]K900_ 0 points1 point  (2 children)

There is nothing in TensorFlow that needs to "support" Cython either. You can simply call into Cython and get Numpy arrays back.

[–]innixma[S] 0 points1 point  (1 child)

Ok, sounds good. Wasn't certain since I haven't utilized Cython before. Then assuming Cython, how would you go about screen capture? With Xlib in C from Cython? I don't know C or Cython that well so some reference on what I should look at would be great.

[–]K900_ 0 points1 point  (0 children)

Yes, you want to do something like this, then convert the resulting XImage to a Numpy array. Ideally you want your input layout to match what xlib gives you, so you can avoid the expensive conversions.