A sensing method, adapted for a structured light depth sensor, the structured light depth sensor comprising a projector, a camera, a processor, and a storage device, the sensing method comprising:
- generating structured lights with different codes;
- sequentially projecting the structured lights to an object to obtain a plurality of coded images;
- capturing the structured lights reflected by the object to obtain a plurality of captured images;
- integrating the plurality of coded images into a coded image group according to a projection order, and integrating the plurality of camera images into a captured image group according to a capture order;
- setting a detecting block;
- extracting a coding block in each of the plurality of coded images according to the position and size of the detecting block;
- integrating a plurality of coding blocks into a coding block group in a same order as the coded image group;
- extracting a capturing block in each of the plurality of captured images according to the position and size of the detecting block;
- integrating a plurality of capturing blocks into a capturing block group in a same order as the captured image group;
- matching the coding block group and the capturing block group;
- calculating a disparity between the coding block group and the capturing block group matched with the coding block group;
- and
- calculating a depth of the object.