python - Finding square centers from a picture -
python - Finding square centers from a picture -
after image processing, fft's, filters, , thresholding, obtained next image:
so, i'm wondering how extract centers. exist function opencv? (such houghcircles detecting circles?) or need utilize clustering methods?
maybe useful know code used:
import cv2 import numpy np import scipy.ndimage ndimage scipy.ndimage import maximum_filter img = cv2.imread("pic.tif",0) s = np.fft.fftshift(np.fft.fft2(img)) intensity = 20 * np.log(np.abs(s)) maxs = maximum_filter(intensity, 125) maxs[maxs < intensity] = intensity.max() ret, thresh = cv2.threshold(maxs.astype('uint8'),0,255,cv2.thresh_binary_inv+cv2.thresh_otsu) imshow(thresh)
ps: have question, useful of you. maximum_filter
function gave me "3 squares"(then i'll improve visualization of them using thresholding), there way utilize maximum_filter
function , obtain "3 circles"? can utilize houghcircles
obtain 3 centers circles.
you may need utilize image moments.
as pre-processing steps, threshold source create mask of squares, , pass findcontours.
python opencv image-processing detection
Comments
Post a Comment