Particle Swarm Optimization for object detection and segmentation