Best thing to first find out just how "imperfect" your credit is.
This can be done by meeting with a loan officer and asking him to give you a copy of your credit report (some will do this for free and some will charge). You will see a lot of good info there - besides all three credit scores, you'll see what type of "derogatory" info you have to fix.
Some of it may not be reported correctly, so it could be removed - by yourself, contacting the credit bureau and requesting the wrong info to be removed (their contact info will be on the credit report also or you can google them). You might need to also reduce your used to available credit ratio on each credit line (to be below 30% on each line of credit). With new FHA guidelines, starting April 1, 2012, you will need to pay down all collections (below $1,000 total on all collection accounts).
When meeting with a reputable loan officer, ask more questions on how to fix your credit.
You may have to fix your credit first, before buying though.
Hope this helps,
Beachfront Realty, Inc.