Closed resident12 closed 2 months ago
Please try it with two (i.e. left and right) camera images as described in https://zeissiqs.github.io/zeiss-inspect-addon-api/2023/python_examples/point_pixel_transformations.html. There are cases where a single image is sufficient, I am currently investigating the background.
Thank you for the reply. Yes, I can confirm it does work with two images. But, then the relation between left and right image-pixels must be known. We need the single image solution. A big thank you in advance. Your help is very much appreciated.
The topic is not sorted out completely yet. What I learned now, is that a single image works only with 2D projects in ZEISS INSPECT Correlate. In this case, the measuring object must have a flat surface and the camera axis must be orthogonal to this surface.
Unfortunately, a preceding step is required in this case. You use the function gom.api.imaging.compute_epipolar_line as a helper. You supply a set of tuples (pixel, image) and an additional image and get an epipolar line for the second image for each tuple. The wanted pixel-match is located on this epipolar line. (see https://en.wikipedia.org/wiki/Epipolar_geometry) As the final step, you have to search for the wanted pixel on the epipolar line. This is typically done by gray value comparison of the surrounding pixels. As a prerequisite, the pixels must be located at distinct position, i.e. not on a uniformly colored surface. In the best case, the surface has been prepared with a speckle pattern.
Thank you. Please hold on. I'm still chewing on this one :-). Yes, the Epipolar-line is an option, but then the pixel matching must be redone.
Perhaps it can be done easier. For, in the Zeiss Inspect GUI I can switch on/off the visual overlay of the 2D-image, 3D-mesh and Reference-Points of a saved project => the sensor calibration matrix is stored with the data and is reread with the data from disk. I could apply that calibration matrix to solve the issue. But somehow I can't use the export via File->Export->Sensor Calibration. To be used under specific conditions only?
May I ask you to refer to the ZEISS Quality Forum? This way, more people would be able to see and hopefully answer your question.
Closing due lack of activity.
Applying the example code of gom.api.imaging.compute_point_from_pixels() to lookup the 3D coordinates of a 2D point alas results in an error. Would appreciate to be able to utilize the described functionality as stated in the documentation. Or should the data be pre-processed somehow to make it work? Please advise me.
see https://zeissiqs.github.io/zeiss-inspect-addon-api/2023/python_api/python_api.html#gom-api-imaging-compute-point-from-pixels
import gom
DIRNAME = 'c:/data/' MEASUREMENT_SERIES = 'Scan 1' MEASUREMENT = 'M1'
gom.script.sys.close_project() #Start by closing all current projects gom.script.sys.load_project(file= DIRNAME + 'ATOSQ12_1.ginspect') gom.script.view.toggle_image_mapping(enable=True, use_animation=False) #Show it to me in the UI
measurement = gom.app.project.measurement_series[MEASUREMENT_SERIES].measurements[MEASUREMENT]
left = gom.api.project.get_image_acquisition(measurement, 'left camera', [0])[0]
p = gom.api.imaging.compute_point_from_pixels([[(gom.Vec2d (10, 10), left)]], False)
print(p)
Error in line 18
GomApiError: Computation of 2D points is not allowed in 3D projects.
Stacktrace:
Line 18 in 'gom-api-imaging-compute-point-from-pixels.py' ()