Object orientation with respect to camera

Hi Everyone,

I want to implement a simple function which returns a bool or a value indicating whether camera with reference to the object in the scene is inverted.

In my application camera can be defined as x, y, z, tilt and pan. For instance when I change the tilt of the camera by 180 degrees followed by pan 180 degrees, then the object in the scene appears inverted/upside down. Position of the object in the scene is fixed but the camera moves and keeps on changing positions.