Feature extraction for defect detection