projekte:vector_graphics_adapter_en

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
projekte:vector_graphics_adapter_en [2015/12/13 01:04] – angelegt da1l6projekte:vector_graphics_adapter_en [2024/12/30 12:18] (aktuell) da1l6
Zeile 1: Zeile 1:
 {{ :projekte:vga-miku.jpg?direct&200|Vectorgraphics output on an Oscilosscope using the PC VGA Port}}==== VGA: Vector Graphics Adapter ==== {{ :projekte:vga-miku.jpg?direct&200|Vectorgraphics output on an Oscilosscope using the PC VGA Port}}==== VGA: Vector Graphics Adapter ====
  
-Using an Oscilloscope for Vector graphcis is propably an idea as old as the X/Y-Mode. Apart from  [[https://en.wikipedia.org/wiki/Lissajous_curve|Lissajous-Curves]] the PC soundcard has become a popular method for drawing [[https://www.youtube.com/watch?v=s1eNjUgaB-g|vector graphics on oscilloscopes]]. Left and right channel of the soundcard are connected to the x and y inputs of the scope to drive the electron beam.+Using an Oscilloscope for Vector graphcis is propably an idea as old as the X/Y-Mode. Apart from  [[https://en.wikipedia.org/wiki/Lissajous_curve|Lissajous-Curves]]the PC soundcard has become a popular method for drawing [[https://www.youtube.com/watch?v=s1eNjUgaB-g|vector graphics on oscilloscopes]]. Left and right channel of the soundcard are connected to the x and y inputs of the scope to drive the electron beam.
  
-While a sound card is essentiall a digital to analog converter, it also includes low pass filters and coupling capacitors for remving the DC part of the signal. This improve the audio quality and save your speakers from harmful DC. Howerver for our purpose it is harmful because the low pass filter limits the speed at which the beam can move and the loss of the DC offset makes the animation whobble around on the screen. The animation must be carefully designed to work around these limitations.+While a sound card is essentially a digital to analog converter, it also includes low pass filters and coupling capacitors for removing the DC part of the signal. This improve the audio quality and save your speakers from harmful DC. Howerverfor our purpose these are harmful because the low pass filter limits the speed at which the beam can move and the loss of the DC offset makes the animation whobble around on the screen. The animation must be carefully designed to work around these limitations.
 {{ :projekte:vga-scope-hallo-welt.png?180|Vector output using VGA}} {{ :projekte:vga-scope-hallo-welt.png?180|Vector output using VGA}}
  
-The solution comes from the other analog to digital converter still commonly found on modern PCs: The VGA-Port.+The solution comes from the other digital to analog converter still commonly found on modern PCs: The VGA-Port.
 While it may be intended to drive raster screens, it essentially a 3 Channel, High-speed (> 100MHz) DAC. While it may be intended to drive raster screens, it essentially a 3 Channel, High-speed (> 100MHz) DAC.
 Using 2 of these channels (Red and Green) the electron beam of an Oscolloscop can be driven in X and Y directions much like the soundcard method, but much faster and without the harmful filter stages. This makes it almost ideal for drawing vector graphics on a scope. Using 2 of these channels (Red and Green) the electron beam of an Oscolloscop can be driven in X and Y directions much like the soundcard method, but much faster and without the harmful filter stages. This makes it almost ideal for drawing vector graphics on a scope.
Zeile 17: Zeile 17:
 ==== Software operation ==== ==== Software operation ====
   * The vectorization is implemented as a set of [[https://mpv.io/|mpv]] video filters.   * The vectorization is implemented as a set of [[https://mpv.io/|mpv]] video filters.
-  * I made a [[https://github.com/da1l6/mpv|fork of mpv]] which contains these filters.+  * I made a [[https://gitlab.warpzone.ms/da1l6/vga|fork of mpv]] which contains these filters.
     - The input video (or image) is passed through the [[https://en.wikipedia.org/wiki/Canny_edge_detector|Canny edge detector]]     - The input video (or image) is passed through the [[https://en.wikipedia.org/wiki/Canny_edge_detector|Canny edge detector]]
-      * The fork contains a canny filter that uses the [[http://opencv.org/|OpenCV]]-Canny implementation (--vf canny). +    - The edgedetect filter from ffmpeg/libavfilter is used (-vf lavfi=edgedetect) to extract edges from the image
-      * The edgedetect filter from ffmpeg/libavfilter can also be used (-vf lavfi=edgedetect). This gives slightly better results but only works with ffmpeg, not libav+    - Following the edge detection a second filter is used to extract the contours from the image. The FindContours function from openCV takes the image and extracts its contours as paths of vectors (--vf vector). 
-    - Follwing the edge detection a second filter is used to extract the contours from the image. The FindContours function from openCV takes the image and extracts its contours as paths of vectors (--vf vector). +  * The vector filter also iterates over these paths to create a "vector image". In this image the red and green color channels of each pixel contain the coordinates of the edge path vectors. 
-  * The same filter iterates over these paths to create a "vector image". In this image the red and green color channels of each pixel contain the coordinates of the edge path vectors. +    * The available "pixels" of the vector image are distributed among the vectors to draw by writing the same value multiple times. This ensures the entire image and thus VGA scanout time is used.
-    * The availiable "pixels" of the vector image are distributed among the vectors to draw by writing the same value multiple times. This ensures the entire image and thus VGA scanout time is used.+
     * The ffmpeg edgedetect filter provides an intensity value in its output depending on how sharp an edge is.     * The ffmpeg edgedetect filter provides an intensity value in its output depending on how sharp an edge is.
       * This is used to give more vector image "pixels" to more prominent edges to make them brighter on the scope output.       * This is used to give more vector image "pixels" to more prominent edges to make them brighter on the scope output.
-      * Less prominent edges get less scanout time and will apear dimmer because the electron beam moves over these spots more quickly.+      * Less prominent edges get less scanout time and will appear dimmer because the electron beam moves over these spots more quickly.
       * This method works without the use of a dedicated intensity (Z) input on the oscilloscope.       * This method works without the use of a dedicated intensity (Z) input on the oscilloscope.
   * A problem of using the VGA port is the blanking periods during which the VGA Port will output 0 volts on all channels and thus move the electron beam to the lower left corner of the scope screen.   * A problem of using the VGA port is the blanking periods during which the VGA Port will output 0 volts on all channels and thus move the electron beam to the lower left corner of the scope screen.
-    * A bright dot appears there and can potentially damage the phosphor coating of the CRT. It should be moved outside the visible area using the horizonal/vertical controls of the scope.+    * A bright dot appears there and can potentially damage the phosphor coating of the CRT. It should be moved outside the visible area using the horizontal/vertical controls of the scope.
   * Example vector image for direct output on the VGA port: {{:projekte:vga-scope-vector-image.png?800|Example vector image}}   * Example vector image for direct output on the VGA port: {{:projekte:vga-scope-vector-image.png?800|Example vector image}}
  
Zeile 37: Zeile 36:
 xrandr --addmode VGA1 scope xrandr --addmode VGA1 scope
 xrandr --output VGA1 --mode scope --right-of <PRIMARY-MONITOR></code> xrandr --output VGA1 --mode scope --right-of <PRIMARY-MONITOR></code>
-  * ffmpeg is needed (libav lacks the edgedetect filter) +  * ffmpeg is needed 
-  * opencv is also needed +  * opencv3 is also needed 
-  * The modified mpv media player with the custom filters can retrived with ''git clone https://github.com/da1l6/mpv''+  * The modified mpv media player with the custom filters can retrived with ''git clone https://gitlab.warpzone.ms/da1l6/vga.git''
   * Example usage command:   * Example usage command:
-    * With ffmpeg edge detection:<code>/path/to/build/mpv --fs --geometry=<WIDTH-PRIMARY-MONITOR>:0 --loop --vf scale=576:512,lavfi=[edgedetect=high=0.04:low=0.03],vector:width=2048:height=200 <VIDEO></code> +    <code>/path/to/build/mpv --fs --geometry=<WIDTH-PRIMARY-MONITOR>:0 --loop --vf scale=576:512,lavfi=[edgedetect=high=0.04:low=0.03],vector:width=2048:height=200 <VIDEO></code> 
-    * With openCV edge detection:<code>/path/to/build/mpv --fs --geometry=<WIDTH-PRIMARY-MONITOR>:0 --loop --vf scale=576:512,canny:t1=128:t2=130,vector:width=2048:height=200 <VIDEO></code> +    * The optimal values for low and high can depend on video source. Just try a few.
-    * The optimal values for t1 (bzw. lowand t2 (bzw. highcan depend on source video. Just try a few.+
     * The canny edge detection is a CPU hog. Because of this ''--vf scale:w:h'' is used to scale down the image before running it.     * The canny edge detection is a CPU hog. Because of this ''--vf scale:w:h'' is used to scale down the image before running it.
  
Zeile 58: Zeile 56:
 <code>/path/to/build/mpv --fs --geometry=<PRIMARY-MONITOR-WIDTH>:0 --loop --vf scale=256:256,vectorraster:width=2048:height=300 <VIDEO></code> <code>/path/to/build/mpv --fs --geometry=<PRIMARY-MONITOR-WIDTH>:0 --loop --vf scale=256:256,vectorraster:width=2048:height=300 <VIDEO></code>
  
 +==== Screen Capture ====
 +{{ :projekte:vga-scope-raster-smb1.jpg?200|}} mpv can capture the screen contents with the help of ffmpeg. This way it is possible to show screen contents (e.g. Games) on the oscilloscope screen.
 +
 +This works with both raster and pure vector mode. The Image on the right is made using raster mode.
 +
 +<code>/path/to/build/mpv av://x11grab::0 --demuxer-lavf-o='video_size=<WIDTH>x<HEIGHT>,grab_y=<XPOS>,grab_x=<YPOS>,framerate=30' ...</code>
 +
 +Video input devices like TV, Webcams and more can be accessed as well:
 +<code>/path/to/build/mpv tv:// ...</code>
  
 ===== Digital oscilloscopes ===== ===== Digital oscilloscopes =====
Zeile 75: Zeile 82:
   * Use a low memory depth (e.g. ~7kPoints).   * Use a low memory depth (e.g. ~7kPoints).
   * Try adjust the DSO sample rate to find the spot of minimal noise.   * Try adjust the DSO sample rate to find the spot of minimal noise.
 +
 +===== Our other VGA to Oscilloscope Projects =====
 +  * [[https://github.com/ands/vga2scope|An OpenCV-based video player/webcam video streamer]]
  
  • projekte/vector_graphics_adapter_en.1449968688.txt.gz
  • Zuletzt geändert: 2017/03/01 19:04
  • (Externe Bearbeitung)