I learned quite a bit of good things with OpenCV on my first day. The library was quite nice to work with, simplicity at least at the beginning of it all. I worked with opening images, displaying those images, working with video, webcam, basic functions (image colorization, finding edges, resizing and cropping) I fiddled around with working with shapes and text, and of course, face detection. Face detection was really fun, and easier to do that originally thought. I was using a data set that was already trained and available through OpenCV.
Opening and displaying images in OpenCV is rather easy to do.
Easy right?
Opening and displaying video in OpenCV is easy as well. It follows the same ‘protocol’ that images do. We need to run a loop due to each frame.
The difference here is that the webcam (if you only have one) should default to ‘0’. I believe they show up as a list, so ‘0’ would be the first instance of a camera. I ran into an issue here as I have multiple and have software that blocks external usage of it.
A webcam is exactly the same as running a video in the sense that you need to run a loop for the frames.
Set up your app.py and app.route
With Flask, I learned you will need to set up an @app.route() for every page. I have used Django before, so its a little familiar. Django was a little bit more confusing to me, but I think its because I didn’t really build a whole lot of things with it. I imagine I will go back to it at some point, build some things, and see where I get. There is definitely less ‘out of the box’ things with Flask. Django has quite a bit more baked in.
Content for the pages was minimal and I used bootstrap for all the HTML jazz and forms. Everything was split apart and pulling from base.html which makes a ‘template’ for every page.
©2021 The North Cole