Mech-Vision step "Calc Mean Gray Value" is unstable

In some cases, it’s necessary to detect whether the incoming material is black or white. Even though the lighting conditions on-site remain constant, there’s significant deviation in the results, making it difficult to obtain stable outcomes. How can we stabilize the results of this process? Or are there alternative methods for black-and-white detection?

  1. Switching the background to green could potentially enhance the result.
  2. Using deep learning to separate colors is recommended over relying solely on 2D images; this approach requires less training time.