A Perth judge says a 37-year-old man caught on security footage masturbating and defecating outside a Midvale hairdresser needed to get "assistance" for the community's benefit.

West Swan's Jason Jupp, pleaded guilty in the Midland Magistrates court on Friday for committing two lewd acts outside the WA Salon Supplies business in the early hours of August 8.

He was given a nine-month supervision order.

Mr Jupp, who appeared to be wearing high heels and a bra, was captured on CCTV footage masturbating, then defecating in the car park before reaching for toilet paper - a used portion of which he casually tossed away.