Creating a P&ID from a pictorial representation