I'm currently working on image processing for detecting rectangular ceramic tile defect. I'm going to take a picture of perfect tile and also a picture of defect tile, then use subtraction to know the difference between that two picture in order to detect whether there is any corner defect. However, there are always shadow & light illumination in those pictures which cause inaccuracy. Attached below is another two defect tile pictures I had taken previously with iPhone and also Raspberry Pi Camera Module to try on. Main focus is on the picture taken using Raspberry Pi Camera Module. What is the code/step needed to automatically remove the shadow near the edge of the tile every time when a photo is taken? I know that there is a Color Thresholding app in Matlab that can help on this but it needs to be used manually.
Picture A - using iPhone
Picture B - using Raspberry Pi Camera Module
I had try coding using Picture A. Below is the binary image obtained. Notice that the binary image actually included all the shadows near the right edge of the tile, causing inaccuracy. (Most of the code refer to the code made by Image Analyst)
Result obtained for picture A.
For picture B, maybe due to green background use, I can't have a good binary image. However, we can see that the effect of shadow is causing inaccuracy. Im using graythresh and imbinarize function.
So, how can I solve this? Thank you.