Try to crop the boxes away. Detect sub-boxes and store them (for processing) separately. Additionally: remove shadows (e.g. by using contrast enhancing methods) before applying the threshold mechanism.