Text Line Detection Based on Cost Optimized Local Text Line