Skip to content

Add Spherical curvature distortion transformation - #51

Open
bogovicj wants to merge 3 commits into
masterfrom
spherical-curv-distortion
Open

Add Spherical curvature distortion transformation#51
bogovicj wants to merge 3 commits into
masterfrom
spherical-curv-distortion

Conversation

@bogovicj

@bogovicj bogovicj commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

This PR adds a SphericalCurvatureDistortionTransform that can serve to model a particular kind of distortion in optical systems.

This example code:

final int numDimensions = 2;
final int dimensionToTransform = 1;
final double radiusOfCurvature = 250;
final SphericalCurvatureDistortionTransform tform = new SphericalCurvatureDistortionTransform(
		numDimensions,
		dimensionToTransform,
		radiusOfCurvature);

final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes(256,256);
img.view().interval(Intervals.createMinMax(36,128,164,164)).forEach( x -> x.set(255) );

final RandomAccessibleIntervalView<UnsignedByteType> imgTform = RealViews.transform(
	img.view()
		.extend(Extension.zero())
		.interpolate(Interpolation.nLinear()),
	tform).realView().raster().view().interval(img);

ImageJFunctions.show(img, "toy tile");
ImageJFunctions.show(imgTform, "toy tile distorted");

produces this output:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant