2

I think what I would get from 1 in the picture with gaussian filter is 2. I want to get number 3. I want to get the derivate but just the absolute amount. what I want

I basically want to filter out the gradient of the big triangle and just get irregularities (arrow in the image) anotherpic

I could use sine instead of the triangle as well, would this make it easier? How can I implement this in python or halcon? What should I look into to get an better understanding in what I want and how to achieve it?

edit: I want to find the "defects" and get rid of the pattern theory: sampleimage

Real Image with real defects: realimage

2 Answers2

1

A Gaussian filter does not give you a derivative. It's a weigthed average.

Your assumption that a Gaussian would give you 2 for input 1 is incorrect.

Just suppress the low frequency of your background with a Notch filter for example.

Quick and dirty example:

enter image description here

Also see Find proper notch filter to remove pattern from image

Another simple approach is to use a row-wise threshold or background subtraction if the background is always aligned like that

Piglet
  • 27,501
  • 3
  • 20
  • 43
1

Agree with Piglet that if the frequency of your pattern is substantially lower than that of your defects, a notch filter is the tool of first choice.

Also agree that if you have multiple frames of calibrated fringe patterns, then you have an array of options available. Recent versions of Halcon have built-in deflectometry operators.

For quick-n-dirty, you could also exploit the general orientation of your pattern using rectangular kernels. This is equivalent to an orthotropic high-pass filter.

   read_image(imgInput, 'C:/Users/jpeyton/Documents/zzz_temp/FringePat_raw.jpg')
*smooth input image with mean using vertically oriented rectangular kernel
   mean_image (imgInput, imgMean, 3, 15)
*subtract smoothed image from raw image to get local / high frequency residuals
   abs_diff_image(imgMean,imgInput,imgAbsDiff, 1)
*threshold away background 
   threshold (imgAbsDiff, Regions, 8, 255)

Smooth with mean operator. Vertically oriented kernel (3x15 in this case) Smoothed image

Subtract smoothed image from raw image and threshold:

high frequency defects segmented

From there, you can run a connection operator and use region features to further accentuate defects. You'll notice this approach doesn't provide as strong a signal for the lower frequency defects (dents?).

So tradeoffs are that a FFT/DFT filter doesn't exploit direction of pattern, and leaves behind edge/harmonic artifacts. A highpass filter approach (like above) will not be sensitive to defects as the approach/exceed fringe frequency.

Jim
  • 56
  • 4