implementing different region detection within an image