0

I have this need: I want to copy selected parts of a video image (they're gauges or other intrument from a flight sim) and replicate them on little LCD displays. Each LCD display has to physically replicate one instrument, thus a selected area from the source image. I'm planning to use python, but also other languages are possible. But I have no experience at all with graphics, I don't know how to read the original image from the video board memory. Many years ago, with EGA and VGA cards, it was quite easy, even if I never had this need. Now I read that windows locks any attempt to directly access the video memory. Is it true? If yes, how to do it? I'm planning to use an integrated video board. Thanks for your attention

Salrandazzo
  • 111
  • 2
  • You mentioned Windows... You can use winapi to directly take screen content in form of bitmap in memory. In OpenGL there is old `glReadPixels` or use `FBO` or render to bitmap but that involves tampering with rendering code which is unclear if you can or can not do. You did not specify source of video (image/video file, real video feed from some 3th party App, IPC, LAN ... ?) You did not specify platform (gfx access is tightly bounded to platform) – Spektre Jun 13 '17 at 07:59
  • You're right. The source is a flight simulator, so that the image is like a video. The OS depends on the user, I will start with my own application, that is Win10. The purpose is to transfer selected parts of the flight simulation, i.e. instrument, to many different devices, each one composed by a little touchscreen and a board like Arduino or Raspberry. The board will display the section of the selected instument (imagine a compass, or a radar) on the LCD, and the touch part will be used to send commands related to the instument to the simulator. – Salrandazzo Jun 18 '17 at 18:54
  • So I assume you can not tamper with app code ... Use winapi ... obtain app's handle (or entire desktop) and copy canvas content into your app once in a while ... for instruments there is no need to do this with too big fps ... see [Getting screenshot of a child window running OpenGL in it (Windows)](https://stackoverflow.com/a/18107834/2521214) – Spektre Jun 18 '17 at 21:21
  • Finally I found the **QA** related to this topic I was looking for take a look at it [How can I access a graphics card's output directly?](https://stackoverflow.com/a/38549548/2521214) – Spektre Jun 20 '17 at 09:08

1 Answers1

0

Depending on your overall solution, you might actually find it easier to simply send the whole video to each of the small screens and simply scale/crop the playback to only show the parts your want.

This is less efficient in bandwidth terms (probably - depends how your compress any videos you extract), but avoids having to do any complicated video manipulation which is processor and battery hungry.

If your system were Android based you can use the TextureView SetTransform to do this: https://developer.android.com/reference/android/view/TextureView.html#setTransform(android.graphics.Matrix)

In HTML5 you can achieve a similar thing using CSS and video transform: https://www.w3schools.com/cssref/css3_pr_transform.asp

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Thanks for answering. Target system will be a simple LCD display plus an Arduino or Raspberry board, with no battery issues. Bandwidth could be an issue. But I'll think about your advice, thanks again. – Salrandazzo Jun 12 '17 at 19:06
  • Following your advice I could stream the whole simulation image (video) and each remote device could just grab it's part, related to the instrument to display. I could use python + OpenCV on the sending side. And still don't know what on the receiving side, depending on the device (Arduino or Raspberry). – Salrandazzo Jun 13 '17 at 06:41