You can use the category__not_in
parameter to exlude categories.
get_posts
uses the WP_QUERY
parameters
Your code will be :
$related = get_posts( array(
'category__in' => wp_get_post_categories($post->ID),
'numberposts' => 5,
'post__not_in' => array($post->ID),
'category__not_in' => array(1,2,3,4)'
) );