05-27-2023 04:37 PM
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,:]
05-28-2023 09:57 AM
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
05-28-2023 10:45 PM
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.