Skip to main content
deleted 5 characters in body
Source Link

I want to overlay a set of points onto a distance transform of them. But, I don't really like the black default color of the distance transform. Is there a way to change this?

Given the points pts:

pts = RandomReal[{-1, 1}, {1000, 2}];

pts = RandomReal[{-1, 1}, {1000, 2}]; 

We can compute their distance transform image (+ ImageAdjust):

Dpts = DistanceTransform[Graphics[Point[pts]]] // ImageAdjust;

Dpts = DistanceTransform[Graphics[Point[pts]]] // ImageAdjust; 

Then, compose this image with the points (say, red points):

ImageCompose[Dpts, Graphics[{RGBColor[0.82, 0., 0.34], Point[pts]}]]

ImageCompose[Dpts, Graphics[{RGBColor[0.82, 0., 0.34], Point[pts]}]] 

To obtain a nice overlay, but it's not pretty (it's, well, too "dark"):

enter image description heredistance transform

Can we change the color appearance of the distance transform?

Additionally, can we adjust the image resolution? Zooming in just makes evident that the image is not very high res-res.

Thanks!

I want to overlay a set of points onto a distance transform of them. But I don't really like the black default color of the distance transform. Is there a way to change this?

Given the points pts:

pts = RandomReal[{-1, 1}, {1000, 2}];

We can compute their distance transform image (+ ImageAdjust):

Dpts = DistanceTransform[Graphics[Point[pts]]] // ImageAdjust;

Then, compose this image with the points (say, red points):

ImageCompose[Dpts, Graphics[{RGBColor[0.82, 0., 0.34], Point[pts]}]]

To obtain a nice overlay, but it's not pretty (it's, well, too "dark"):

enter image description here

Can we change the color appearance of the distance transform?

Additionally, can we adjust the image resolution? Zooming in just makes evident that the image is not very high res.

Thanks!

I want to overlay a set of points onto a distance transform of them. But, I don't really like the black default color of the distance transform. Is there a way to change this?

Given the points pts:

pts = RandomReal[{-1, 1}, {1000, 2}]; 

We can compute their distance transform image (+ ImageAdjust):

Dpts = DistanceTransform[Graphics[Point[pts]]] // ImageAdjust; 

Then, compose this image with the points (say, red points):

ImageCompose[Dpts, Graphics[{RGBColor[0.82, 0., 0.34], Point[pts]}]] 

To obtain a nice overlay, but it's not pretty (it's, well, too "dark"):

distance transform

Can we change the color appearance of the distance transform?

Additionally, can we adjust the image resolution? Zooming in just makes evident that the image is not very high-res.

Thanks!

edited tags
Link
Source Link
TumbiSapichu
  • 1.7k
  • 12
  • 20

How to change color of DistanceTransform image?

I want to overlay a set of points onto a distance transform of them. But I don't really like the black default color of the distance transform. Is there a way to change this?

Given the points pts:

pts = RandomReal[{-1, 1}, {1000, 2}];

We can compute their distance transform image (+ ImageAdjust):

Dpts = DistanceTransform[Graphics[Point[pts]]] // ImageAdjust;

Then, compose this image with the points (say, red points):

ImageCompose[Dpts, Graphics[{RGBColor[0.82, 0., 0.34], Point[pts]}]]

To obtain a nice overlay, but it's not pretty (it's, well, too "dark"):

enter image description here

Can we change the color appearance of the distance transform?

Additionally, can we adjust the image resolution? Zooming in just makes evident that the image is not very high res.

Thanks!