An optical sensor device, comprising: an optical sensor including a set of sensor elements; an optical filter including one or more channels; a phase mask configured to distribute a plurality of light beams associated with a subject in an encoded pattern on an input surface of the optical filter; the set of sensor elements configured to receive one or more channels of light of respective different wavelength ranges from the optical filter; and one or more processors configured to: obtain, from the optical sensor, sensor data associated with the subject; characterised in that the optical filter has an angle-dependent wavelength characteristic, wherein the one or more processors are configured to, when determining a distance of the subject from the optical sensor device: process the sensor data, based on information associated with the encoded pattern, to identify respective angles of incidence on the optical filter of a set of light beams, of the plurality of light beams, that are associated with a point of the subject; and determine, based on the identified respective angles of incidence on the optical filter of the set of light beams, the distance of the subject from the optical sensor device; select, based on the distance of the subject from the optical sensor device, a processing technique to process the sensor data, wherein the processing technique is an imaging processing technique or a spectroscopic processing technique; process, using the selected processing technique, the sensor data to generate output data; and provide the output data. an optical sensor including a set of sensor elements; an optical filter including one or more channels; a phase mask configured to distribute a plurality of light beams associated with a subject in an encoded pattern on an input surface of the optical filter; the set of sensor elements configured to receive one or more channels of light of respective different wavelength ranges from the optical filter; and one or more processors configured to: obtain, from the optical sensor, sensor data associated with the subject; characterised in that the optical filter has an angle-dependent wavelength characteristic, wherein the one or more processors are configured to, when determining a distance of the subject from the optical sensor device: process the sensor data, based on information associated with the encoded pattern, to identify respective angles of incidence on the optical filter of a set of light beams, of the plurality of light beams, that are associated with a point of the subject; and determine, based on the identified respective angles of incidence on the optical filter of the set of light beams, the distance of the subject from the optical sensor device; select, based on the distance of the subject from the optical sensor device, a processing technique to process the sensor data, wherein the processing technique is an imaging processing technique or a spectroscopic processing technique; process, using the selected processing technique, the sensor data to generate output data; and provide the output data. process the sensor data, based on information associated with the encoded pattern, to identify respective angles of incidence on the optical filter of a set of light beams, of the plurality of light beams, that are associated with a point of the subject; and determine, based on the identified respective angles of incidence on the optical filter of the set of light beams, the distance of the subject from the optical sensor device; select, based on the distance of the subject from the optical sensor device, a processing technique to process the sensor data, wherein the processing technique is an imaging processing technique or a spectroscopic processing technique; process, using the selected processing technique, the sensor data to generate output data; and provide the output data.