Week 1 Overview


Day 1 – OpenCV

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.


Day 2-7 – Flask
To be fairly honest, I really didn’t want to do web work. I had my own business building websites and frankly, my clients were ‘difficult’. I don’t know if that had much to do with them really, but I didn’t know (I was pretty young) and really didn’t know how to charge and work with change orders, etc. so I can’t blame it all on my clients.
I had a bit more fun with Flask than I imagined, with the exception of day 3 and 4. I was running through a tutorial and the tutor really didn’t break things down the way they needed. I wound up finally using a tutorial from the tried-and-true John Elder at Codemy.com.

OpenCV

Opening and Displaying Images

Opening and displaying images in OpenCV is rather easy to do.

Opening and displaying images with OpenCV

Easy right?

Opening and Displaying Video

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.

Opening and displaying video with OpenCV
Opening and Displaying a Webcam

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.

Opening and displaying a webcam with OpenCV
Flask
Ok, so here we go. Forsaking the issues that I had with the initial tutorial, what I have went over on a surface level is the following:
– Jinja
– Extending your base page and ‘URL for’
– Webforms
– Handling Webform errors with Flask
– Sending Email from Webforms

With Codemy, I never seem to have a problem, John generally does a spectacular job in getting his work across.

Here is the project hierarchy as it sits now:

Set up your app.py and app.route

Setting up Flask

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.

base-html page

Conclusion

OpenCV is really fun, and I am having a much better time with Flask than previously thought. I imagined that it was not going to be pleasant, but I was happily surprised. In the coming week I will continue with more Flask work, and will get the hang of this blogging deal. I will try getting this a little more in depth as far as a step by step process goes to alleviate time on the backend for creating the content in a blog. If there is something you would like to see expounded on in the process let me know!