Optical photometric variable stars towards the Galactic H II region NGC 2282