dpivsoft.stereo_gui

dpivsoft.stereo_gui.read_grayscale_image(path)[source]

Load an image as a uint8 grayscale array, robust to >8-bit TIFFs.

OpenCV’s grayscale reader returns None on 12-bit TIFFs, so fall back to a depth-aware read and then scikit-image, rescaling deeper formats to uint8.

dpivsoft.stereo_gui.find_points_TSI(image)[source]

Detect the TSI target dots on a binary image.

Returns (cX, cY, center, None): sub-pixel float centroids plus the centre marker (the biggest blob). Blobs clipped by the image border are skipped – their centroids are biased by up to half a dot radius and poison the calibration fit.

dpivsoft.stereo_gui.find_points_LaVision(image)[source]

Detect LaVision calibration dots plus the two orientation fiducials.

The square and triangle markers are located by shape, removed from the returned dot list, and handed back together in fiducials ([square, triangle]). center is the world origin: the dot next to the square and on top of the triangle, chosen so both cameras pick the same physical dot.

dpivsoft.stereo_gui.sort_points(x, y, center, fiducial, pattern, org_height, showImages=1, camera=None, camera_config=None)[source]
dpivsoft.stereo_gui.calibration_mesh(x, y, index, idx_o, camera, pattern, dx, dy, dz, thickness, camera_config, q_rows=None, q_cols=None, z_plane=0.0)[source]
class dpivsoft.stereo_gui.StereoCalibrationApp(show_diagnostics=False)[source]

Bases: Tk

create_widgets()[source]
load_images()[source]

Load the right and left images of the Stereo Calibration and display them

resize_image(image)[source]
open_grid_menu()[source]
open_options_menu()[source]
reload_images()[source]
load_cpt_button_clicked()[source]
load_multi_cpt_button_clicked()[source]

Load several CPTs taken at different Z planes and combine them.

Each capture saved one left + one right CPT (with its absolute Z baked into the Z column via the ‘Z plane’ field). Stacking them gives a multi-plane calibration: extra Z levels constrain the parallax better and – for a flat target captured at >=2 depths – make Soloff possible at all. The combined matrices feed Run Calculation unchanged.

NOTE: all CPTs must share the same world (X, Y) origin, i.e. the target only moved in Z between captures. If it also shifted/rotated in plane, the frames do not align and the combined fit is invalid.

load_cpt_file(file_path)[source]
save_cpt_button_clicked()[source]
save_cpt_file(filename, final_matrix)[source]
apply_threshold(image)[source]
bwareaopen(img)[source]

Remove small objects from binary image (approximation of bwareaopen in Matlab for 2D images).

Parameters:

img (ndarray) – Binary image (dtype=uint8) to remove small objects from.

Returns:

The binary image with small objects removed.

Return type:

ndarray

start_blackbox()[source]
start_box_l(event)[source]
start_box_r(event)[source]
end_box(event)[source]
get_centroids()[source]
calibrationMesh(x, y, index, idx_o, camera)[source]
sort_points(x, y, center, fiducial, showImages=False, camera=None)[source]
get_coordinates()[source]
draw_circles()[source]
open_soloff_menu()[source]

Popup to pick the Soloff calibration model, then run the fit.

Reduced Soloff (the 9-parameter, linear-in-Z model) needs >=2 distinct Z planes. Full Soloff is the classic 19-term polynomial (cubic in-plane, for lens distortion; quadratic in Z) and needs >=3 distinct Z planes per camera; if that is not met the fit is refused with a warning instead of running.

run_calculation()[source]
stereo_calibration()[source]
save_calibration()[source]
dpivsoft.stereo_gui.calibration_GUI(show_diagnostics=False)[source]