Yes and no. Friendly troops and terrain features (forests, hills, buildings) block the line of sight for the cannon/stone thrower crew. Enemy troops do not block the line of sight for the crew. If the crew has line of sight at a enemy target, they may shoot at it.
Additionally, an elevated war machine gains line of sight over friendly troops. War machines that fit this description include: Organ Gun, Great Cannon, Catapults, and Mortars, and Doom Divers.
Due to the nature of the weapon, it does not make sense to allow the Flame Cannon and Hellblaster volley gun to fire over friendly troops.