Created a new module for this.
Step 1:
in app/code/local/Contact/Captcha/etc/config.xml,
<?xml version="1.0"?>
<config>
<modules>
<Contact_Captcha>
<version>0.1.0</version>
</Contact_Captcha>
</modules>
<default>
<captcha>
<frontend>
<areas>
<contact_page_captcha>
<label>Contact Page</label>
</contact_page_captcha>
</areas>
</frontend>
</captcha>
</default>
<global>
<models>
<contact_captcha>
<class>Contact_Captcha_Model</class>
</contact_captcha>
</models>
<events>
<controller_action_predispatch_contacts_index_post>
<observers>
<captcha>
<type>model</type>
<class>contact_captcha/observer</class>
<method>checkContactPage</method>
</captcha>
</observers>
</controller_action_predispatch_contacts_index_post>
</events>
</global>
</config>
Step 2:
in app/etc/modules/Contact_Captcha.xml
<?xml version="1.0"?>
<config>
<modules>
<Contact_Captcha>
<active>true</active>
<codePool>local</codePool>
</Contact_Captcha>
</modules>
</config>
Step 3:
in app/code/local/Contact/Captcha/Model/Observer.php
<?php
class Contact_Captcha_Model_Observer extends Mage_Captcha_Model_Observer
{
public function checkContactPage($observer)
{
$formId = 'contact_page_captcha';
$captchaModel = Mage::helper('captcha')->getCaptcha($formId);
if ($captchaModel->isRequired()) {
$controller = $observer->getControllerAction();
if (!$captchaModel->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) {
Mage::getSingleton('customer/session')->addError(Mage::helper('captcha')->__('Incorrect CAPTCHA.'));
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
$controller->getResponse()->setRedirect(Mage::getUrl('*/*/'));
}
}
return $this;
}
}
Step 4:
Create a local.xml in theme path.
app/design/frontend/theme/default/layout/local.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<contacts_index_index translate="label">
<reference name="contactForm">
<block type="core/text_list" name="form.additional.info">
<block type="captcha/captcha" name="captcha">
<reference name="head">
<action method="addJs"><file>mage/captcha.js</file></action>
</reference>
<action method="setFormId"><formId>contact_page_captcha</formId></action>
<action method="setImgWidth"><width>230</width></action>
<action method="setImgHeight"><width>50</width></action>
</block>
</block>
</reference>
</contacts_index_index>
</layout>
Step 4:
in app/design/frontend/theme/default/template/contacts/form.phtml
Add below code:
<?php echo $this->getChildHtml('form.additional.info'); ?>
Step 5:
Admin Settings:
Dashboard - > Customers - > Customer Configuration - > CAPTCHA - > Forms - > Select Contact Page
Step 6:
Clear cache. Refresh contact us page.