oren
December 26, 2022, 3:12pm
1
Wanted to verify that cv2.createThinPlateSplineShapeTransformer
does not work with 3D points correct?
Is there a way (or a different function) to extend it to 3D points?
e.g. tshape
and sshape
need to be 2Dxnumber_points
tps = cv2.createThinPlateSplineShapeTransformer()
...
tps.estimateTransformation (tshape, sshape, matches)
Thanks
berak
December 27, 2022, 10:15am
2
yes, that’s correct
(it is part of a 2d shape matching algorithm, and probably not meant to be used “standalone”)
just curious, – which problem are you trying to solve here ?
oren
January 6, 2023, 4:03pm
3
BTW,
Here is an example with simpleITK:
Hi @bogovicj , @oren , Here is a draft Python example for applying a thin plate spline transform: Your review is appreciated! 🙏 This could be modified to use a different kernel transformation model: This is also the option to use a b spline...
berak
January 6, 2023, 5:16pm
4
btw,
there’s also a (not so simple, and well hidden) 3d tps here:
bounds_horiz, kk_horiz, ksize_horiz = self._precompute_coeffs(width, xsize)
bounds_vert, kk_vert, ksize_vert = self._precompute_coeffs(height, ysize)
out_hor = np.empty((img.shape[0], xsize), dtype=np.uint8)
self._resample_horizontal(out_hor, img, ksize_horiz, bounds_horiz, kk_horiz)
out = np.empty((ysize, xsize), dtype=np.uint8)
self._resample_vertical(out, out_hor, ksize_vert, bounds_vert, kk_vert)
return out
class CpVton(object):
def __init__(self, gmm_model, tom_model, backend, target):
super(CpVton, self).__init__()
self.gmm_net = cv.dnn.readNet(gmm_model)
self.tom_net = cv.dnn.readNet(tom_model)
self.gmm_net.setPreferableBackend(backend)
self.gmm_net.setPreferableTarget(target)
self.tom_net.setPreferableBackend(backend)
self.tom_net.setPreferableTarget(target)
def prepare_agnostic(self, segm_image, input_image, pose_map, height=256, width=192):
oren
January 6, 2023, 7:17pm
5
just curious, – which problem are you trying to solve here ?
Sorry I missed that, I need to register one stack to another stacks, I use Deep Learning to get landmarks.