Python streaming to MEAN

One of the more interesting issues I’ve had is that all of the work I’ve done with video processing, image processing, etc has been in Python. I don’t know Python well.  However, I can easily look at Python code and find my way around.  When I look at opencv4nodejs it’s not the same.  That’s not the fault of opencv4nodejs.  It’s simply that with any wrapper around an original library there will be differences.  I’m, dare-I-say, eager and in a hurry to get my work off the ground so I’m getting frustrated having to find answers with parts that should be a one-to-one relationship and yet aren’t.  Again, no fault of opencv4nodejs I love what has been done.

I’ve thought since day one of my MEAN stack work that I’d love to be able to use the Python code directly, but I’ve also decided that I wanted to go with the web route.  I think that I thought this was the better option to keep all of the frameworks similar in nature.  I don’t think that’s a requirement though.  I have had several thoughts that I could write some components in C++ or even C# on Windows and compile them to be run as DLLs or SOs or even given NPM wrappers.  So I think sometimes I get trapped by a specific way of thinking and I am so focused on a goal that had a challenge that I have excluded everything else.  Which leads me back to my original pursuit of using Python for my OpenCV, Tesseract, and other work.

What is the Angular, Node, and Express (even the MongoDB or SQLite DB) for?  Just to display and manipulate easier for the user.  That’s it.  Display what the user wants.  Allow the user to manipulate the display however the user wants.

So the video, image processing, tesseract, any of the rest, doesn’t have to be done in NodeJS or with a Javascript library.  I control the whole computer.  This is designed to be used as a whole computer.  It is not designed (at this time) to be anything other than run as a wearable computer.  The video feed is already being run and displayed via websockets.  My thought is that instead of doing that through opencv4nodejs I’ll run the camera through Python the way I was originally doing it but pipe it through websockets.  There’s a great tutorial here with the git repo here.  I’ll swing back and look at this later.  Also, if you’re interested, I was attempting to use python-shell node wrapper, but ended up just using the plain child_process.spawn which you can read more about here.

This does clean up a lot of items for me on my list.  I have a lot more code in Python.  There are a lot more references in Python.  My image processing is all in Python.  Barcode scanner, Sudoku reader, Tesseract processing, and more.  I’m not sure, yet, how I’m going to change filters in video and images on the fly, but that’s all part of the challenge.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.