Monday, April 22, 2013

Manually Focusing a Logitech Pro 9000 on Ubuntu or Raspbian with Python

The Logitech Pro 9000 is a cute little plug-n-play webcam that will work with Linux systems (in my case, Ubuntu on my Giada and Raspbian on my Raspberry Pi). Below are command line instructions to set it up and use the webcam.

To set it up, open a terminal and simply run from command line:
$sudo apt-get install fswebcam

Then, you should search to see where the camera hardware is: 
$ls /dev

Once you find where your device is, you can now call your camera from the proper directory to capture and save an image with (NOTE: every time you run this code, you write over the same jpg file): 
$fswebcam -d /dev/video0 "image.jpg"

To be safe, check to see if your image was saved with: 
$ls

If you are unable to click and open your image to view it, I have been using the default Eye of Gnome image viewer: 
$eog image.jpg


In my efforts to test the Logitech webcam for my engineering design project, I ran into the issue of getting my webcam to focus at short focal lengths. My test subject placed inches away from the camera lens was super blurry but things at infinite distance were focused. Took me some time, but I finally figured out how to control the focus of the webcam. 

If you have been Googling "Logitech Pro 9000 Linux Focus" or anything like that, don't even bother trying to follow any tutorials that direct you to the QuickCamTeam website. It's shut down and you can't get their logitech.xml file. Fuck it. 

Download the Video4Linux Utilities library with: 
$sudo apt-get install v4l-utils

With Video4Linux, you will be able to manually control your webcam. I needed to turn off the auto focus on mine and set it to a fixed focus length. So where should you start?

To see a list of all the common options:
$v4l2-ctl --help

To see a list of things you can control on the webcam:
$v4l2-ctl --list-ctrls

To alter your webcam controls, your command should look like:
$v4l2-ctl --set-ctrl=<ctrl>=<value>

I needed to play around with my camera's ability to focus. To set it to autofocus, I used:
$v4l2-ctl --set-ctrl=focus=0

But that's not what I need my camera to do for my project since the device will be at a set distance from its subject. So, I can use any value from 0 to 255 to set my focus. I used a value of 200, which makes my camera focus clearly on objects 2 inches away.


If you want to call these bash command lines from Python code:
import os
os.system('v4l2-ctl --set-ctrl=<ctrl>=<value>')
os.system('fswebcam -d /dev/video0 image.jpg')


If you have SimpleCV installed and would like to display your camera for more adjusting purposes:
import os
from SimpleCV import *
os.system('v4l2-ctl --set-ctrl=<ctrl>=<value>')
cam = Camera()
disp = Display()
while disp.isNotDone()
  img = cam.getImage()
  img.save(disp)

Monday, April 8, 2013

New Favorite Snack

Bought two packs of 99cents strawberries at the Grocery Outlet today. I put one box in the freezer. Was looking for a snack and decided to chop up some strawberries from the fridge and mix them with honey nut Cheerios in low-fat vanilla yogurt. Found my new favorite healthy snack. 

Changing my diet to help me lose weight/slim down/ tone that ass will be fun. 

Tuesday, April 2, 2013

Sevendust, Coal Chamber, and Lacuna Coil Concert

For my partner's birthday, I bought tickets for us to go see a Sevendust, Coal Chamber, and Lacuna Coil concert. It had been a long time since I saw a metal concert. So, I decided now or never. We arrived right on time; however, because I forgot my ID, I wasn't able to hit up the venue bars. Boo. But that was fine since I drove. Anyway, here are some pictures and videos that I was able to take/record. Qualities are not great, but that's fine for me. The experience is what matters, and the concert was fucking great. Lacuna Coil's female singer stole my heart and my love of Coal Chamber was resurrected. Coal Chamber is soooo good live.



Lacuna Coil

Lacuna Coil - "To the Edge" clip

Coal Chamber 

Coal Chamber - "Loco" clip

 
Coal Chamber - "Big Truck" clip

Coal Chamber - "Fiend"

Coal Chamber - "Drove" clip

More Coal Chamber

Sevendust (had moved to the back)



Howdy Partner Happy Birthday!

Today, April 2nd, is my partner's birthday. So, I ran over to him, interrupted his WoW game, gave him a hug, and screamed, "Yay!!! Guess whose birthday it is?! You came out of your mom's vagina today!"

And all he could do was laugh and say, "Awkward." I'm pretty sure he was probably Skyping with other players. 

Time to make his first day of being 26 hell... I mean one hell of an awesome day.