Below is the code by using we can get product collection filter by category id in Magento
$category = Mage::getModel('catalog/category')->load('category_id');
$productCollection = $category->getProductCollection();
$productCollection
->addStoreFilter()
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addUrlRewrite();