OpenCV+WebCAM+Jetson Xavier

Install v4l-utils with this command:-

sudo apt-get install v4l-utils

Verify WebCAM

Create python program with width and height from v4l2-ctl result.

import cv2
print(cv2.__version__)
width=640
height=480
flip=2
#camSet='nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=3264, height=2464, framerate=21/1,format=NV12 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(width)+', height='+str(height)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
camSet ='v4l2src device=/dev/video0 ! video/x-raw,width='+str(width)+',height='+str(height)+',framerate=24/1 ! videoconvert ! appsink'
cam=cv2.VideoCapture(camSet)
while True:
    _, frame = cam.read()
    cv2.imshow('myCam',frame)
    cv2.moveWindow('myCam',0,0)
    if cv2.waitKey(1)==ord('q'):
        break
cam.release()
cv2.destroyAllWindows()

Resurrection of my old DOS Program

Install emscripten

 git clone https://github.com/emscripten-core/emsdk.git
 cd emsdk
 git pull
 ./emsdk install latest
 ./emsdk activate latest
 source ./emsdk_env.sh

Due to some browser such as Chrome and Safari will mute the sound when start. We can fixed the problem by go to emsdk directory, modify “./fastcomp/emscripten/src/shell.html” as shown below:-

        Module.setStatus('Exception thrown, see JavaScript console');
        spinnerElement.style.display = 'none';
        Module.setStatus = function(text) {
          if (text) Module.printErr('[post-exception status] ' + text);
        };
      };
    </script>
    <!-- REF: https://developers.google.com/web/updates/2018/11/web-audio-autoplay -->
    <script type='text/javascript'>
        function resumeAudio() {
          if (typeof Module === 'undefined'
              || typeof Module.SDL2 == 'undefined'
              || typeof Module.SDL2.audioContext == 'undefined')
              return;
          if (Module.SDL2.audioContext.state == 'suspended') {
              Module.SDL2.audioContext.resume();
          }
          if (Module.SDL2.audioContext.state == 'running') {
              document.getElementById('canvas').removeEventListener('click', resumeAudio);
              document.removeEventListener('keydown', resumeAudio);
          }
        }
      document.getElementById('canvas').addEventListener('click', resumeAudio);
      document.addEventListener('keydown', resumeAudio);
    </script>

    {{{ SCRIPT }}}
  </body>
</html>

Check out em-dosbox

git clone https://github.com/dreamlayers/em-dosbox.git
cd em-dosbox

Add “-s FORCE_FILESYSTEM=1” to src/Makefile.am since we also required filesystem support.

EXTRA_DIST = winres.rc dosbox.ico

if EMSCRIPTEN_BUILD
dosbox_LDFLAGS=-s TOTAL_MEMORY=134217728 -s ALLOW_MEMORY_GROWTH=0 -s FORCE_FILESYSTEM=1
CLEANFILES=dosbox.js dosbox.html.mem dosbox.js.orig.js dosbox.js.tmp.js

Configure and build em-dosbox.

cd ~/emsdk
source ./emsdk_env.sh
cd ~/em-dosbox
emconfigure ./configure
make

Put all DOS files inside a directory under em-dosbox/src, in this case “praditww” and start creating dosbox application.

cd ~/em-dosbox/src
./packager.py pradit praditww PRADITWW.EXE

This will create files that will be use to run dosbox with browser ie:- pradit.html and pradit.data. To test it, issue the following command “python -m SimpleHTTPServer” and access this URL “http://localhost:8000/pradit.html”.