LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Niblack local thresholding

In my application the NI Vision Niblack local thresholding method gives different results than for example the implementation in the Python package skimage. I think that the NI Vision implementation has some errors.

 

For an example with 3x3 window size and a Niblack factor of zero to get comparable results I had to shift the threshold mask by one pixel to the right. Then I had to pad the 2 pixels wide border of the threshold mask with 3 pixels wide inner threshold values.

 

Can someone confirm, that the Niblack threshold mask is shifted by one pixel to the right? How does the border treatment work?

 

This is the corresponding python code:

 

from skimage.filters import threshold_niblack


window_size = 3
k_niblack = 0

 

threshold_local = threshold_niblack(scan, window_size, k_niblack)
threshold_local = np.roll(threshold_local, 1, axis=1)
threshold_local[:,0] = threshold_local[:,2]
threshold_local[:,1] = threshold_local[:,2]
threshold_local[:,-2] = threshold_local[:,-3]
threshold_local[:,-1] = threshold_local[:,-3]

threshold_local[-1, :] = threshold_local[-3,:]
threshold_local[-2, :] = threshold_local[-3,:]

0 Kudos
Message 1 of 3
(1,029 Views)

Please provide the VI (as a .vi file, not as a "picture of code") and an image you are using as "data" for this VI.

 

Bob Schor

0 Kudos
Message 2 of 3
(980 Views)

It just uses the IMAQ Local Threshold VI of LabView NI Vision:

https://documentation.help/NI-Vision-LabView/IMAQ_Local_Threshold.html

 

I attached a sample Image Src and Dst.

Download All
0 Kudos
Message 3 of 3
(951 Views)