Optik-Fokus- & MTF-Testkarten
Exportieren Sie reine Vektor-Siemenssterne, ISO-12233-Schrägkanten-MTF-Tafeln und USAF-1951-Auflösungskarten in exaktem mm-PDF, SVG, CAD-DXF und High-DPI-PNG.
Exportdateien kodieren exakte Zielmaße (1 mm = 72/25,4 pt). PDF immer mit 100 % / Tatsächliche Größe drucken („An Seite anpassen“ deaktivieren) und vor der Kalibrierung X- und Y-Prüfmaßstab real nachmessen.
import cv2
import numpy as np
# ISO 12233-style Slanted-Edge MTF50 Quick Verification (OpenCV 4.13 + NumPy)
img = cv2.imread("captured_mtf.png", cv2.IMREAD_GRAYSCALE)
assert img is not None, "Failed to load slanted-edge chart image"
# Locate central tilted dark square contour and measure vertical edge gradient
_, bw = cv2.threshold(img, 128, 255, cv2.THRESH_BINARY_INV)
contours, _ = cv2.findContours(bw, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
largest = max(contours, key=cv2.contourArea)
x, y, w, h = cv2.boundingRect(largest)
roi = img[y + h // 4 : y + 3 * h // 4, max(0, x - 20) : min(img.shape[1], x + 20)].astype(np.float64)
esf = roi.mean(axis=0)
lsf = np.abs(np.diff(esf))
mtf = np.abs(np.fft.rfft(lsf))
mtf = mtf / max(mtf[0], 1e-9)
freqs = np.fft.rfftfreq(len(lsf), d=1.0) # cycles / pixel
idx50 = int(np.argmax(mtf < 0.5))
mtf50 = float(freqs[idx50]) if mtf[idx50] < 0.5 else 0.5
print(f"Slanted-edge ROI={roi.shape[1]}x{roi.shape[0]}px, approx MTF50={mtf50:.3f} cy/px")
Siemensstern für Fokus & Astigmatismus
Radiale Speichen decken kontinuierlich Frequenzen bis ins Zentrum ab, wodurch Schärfepunkt und Astigmatismus direkt im Livebild erkennbar sind.
ISO-12233-Schrägkanten-MTF
Eine um 5° gekippte Kante liefert unterschiedliche Subpixel-Phasen pro Bildzeile für ESF, LSF und FFT-basierte MTF50-Bestimmung.
USAF-1951-Formel & Druckergrenzen
Die Ortsfrequenz folgt 2^(G + (E-1)/6) lp/mm. 600-DPI-Bürodrucker stoßen unter ~0,085 mm Strichbreite (~6 lp/mm) an physikalische Grenzen.