I think the answer is 4, not 5.
When the light from the source hits the sensor, the brightness is high.
When the box is blocking the light, the light detected by the sensor is zero.
So there are 4 “zero” gaps in the chart (2-4s, 6-8s, 10-12s, 14-16s), so that should be the 4 boxes passing by.
Did the answer sheet state 5 wooden boxes?