I'm 28 (oops, 29 now) and I want to be C literate by the time I'm 30. That's two (one) years to become competent at something I've been wanting to do nearly my whole life. No pressure.
Saturday, March 19, 2011
First test
Jeez, I blocked out the whole day to get this far...
http://imgur.com/6xRVa
So all this does so far is pop up a window with the active webcam and it snaps a picture when I hit the space bar. I started off with the example program that OpenCV comes with that just pops open the camera window until you hit "esc". I added another "cv.WaitKey()" statement and then read the documentation to figure out how to use "cv.SaveImage()". The part that took the longest was figuring out the filename string handling. I googled how to get the time and then figured out with trial and error how to get individual elements of the returned structure (very c-like) and then read a bit into "Dive Into Python" to figure out how to put it all together (I needed a "sprintf" type function).
Total time? Maybe an hour not counting the several hours last night getting Python+numpy+OpenCV installed.
Complaints: No brackets, very white-space sensitive (but this is a big feature of the language so whatever). There seem to be many ways of doing the same thing. I could have handled the string shoveling in line 14 in a thousand different ways. The way I used makes sense to me because it's C-like (printf, sprintf).
Compliments: RAPID development. Notepad++ on the left, command console on the right. Edit, run, edit, run.
For the future: Right now it's just dumping the .jpg files into the same directory it's being run in. I need to learn how to not only point to directories, but MAKE directories (called the date) and then put the files in the right place.
Labels:
python
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment