For instance, if someone is arrested for jaywalking because the cop objects to being filmed in public, the photography rights lobby would retaliate by petitioning the courts to force that entire department to apply an equal enforcement standard to any and all jaywalking infractions it observes thereafter.
If an ordinance generates one citation in a year when sampling (or even common sense) indicates it happens hundreds of times per day, the judge on that case might want to grow a pair and punish the use of the bullshit pretext to end-run around due process.
Schools were forced to desegregate largely through court orders, so requiring that law enforcement enforce the laws that they have recently chosen not to ignore uniformly rather than selectively is certainly possible via court order--but not very likely, in my opinion.
OTOH Selective enforcement is a real problem. A lot of the bad laws on the books would go away if they had to be enforced with even a modicum of impartiality (If 1 in 10 people that fail to yield to a pedestrian were arrested with their cars impounded, that law would go away real fast).