# How to increase resolution of an image generated from a sparse pointcloud?

**URL:** <https://discourse.julialang.org/t/how-to-increase-resolution-of-an-image-generated-from-a-sparse-pointcloud/85461>\
**Category:** New to Julia\
**Created:** [August 8, 2022, 5:52am UTC](https://discourse.julialang.org/t/how-to-increase-resolution-of-an-image-generated-from-a-sparse-pointcloud/85461 "2022-08-08T05:52:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![momo1](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@momo1](https://discourse.julialang.org/u/momo1)\
**Post date:** [August 8, 2022, 5:52am UTC](https://discourse.julialang.org/t/how-to-increase-resolution-of-an-image-generated-from-a-sparse-pointcloud/85461/1 "2022-08-08T05:52:07Z")

</div>

Hi  
I’ve an image form pointcloud which is sparse, Using UNet can be an issue because there will not be many points in its window.  
Its pixel values are basically classes. e.g. [3,4]=11 where pixel 3,4 has class 11.  
My image looks like

 ![Screenshot 2022-08-08 155233](https://global.discourse-cdn.com/julialang/original/3X/7/2/72606ed6532961e5f0b1314dce2c16d74c1f9807.png)

I’ve tried using

> `imgg = imfilter(img, Kernel.gaussian(3))`

but that will change classification assigned per pixel.  
Is there an increase resolution function in julia? Thanks

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [August 9, 2022, 4:28pm UTC](https://discourse.julialang.org/t/how-to-increase-resolution-of-an-image-generated-from-a-sparse-pointcloud/85461/2 "2022-08-09T16:28:49Z")

</div>

If it is important that the output pixels have classes drawn from the input labels, perhaps you could use a nearest-neighbor interpolation. Assuming your pointcloud is stored as an array of `points[N, 3]` where the first two columns are the coordinates and `points[1:end, 3]` are the labels:

```julia
using Interpolations
itp = interpolate(
    (points[1:end, 1], points[1:end, 2]),
    points[1:end, 3],
    (Gridded(Constant()), Gridded(Constant())))
# itp can be queried by (x,y) to retrieve the class at a particular position,
# perhaps in a loop to generate an output image at a desired resolution.
itp(5.5, 6.3)
```

---

<div class="post-metadata">

**Author:** ![momo1](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@momo1](https://discourse.julialang.org/u/momo1)\
**Post date:** [August 15, 2022, 12:19am UTC](https://discourse.julialang.org/t/how-to-increase-resolution-of-an-image-generated-from-a-sparse-pointcloud/85461/3 "2022-08-15T00:19:26Z")

</div>

Thanks, i’ll give it a try

---

<div class="post-metadata">

**Author:** ![momo1](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@momo1](https://discourse.julialang.org/u/momo1)\
**Post date:** [August 16, 2022, 1:58am UTC](https://discourse.julialang.org/t/how-to-increase-resolution-of-an-image-generated-from-a-sparse-pointcloud/85461/4 "2022-08-16T01:58:43Z")

</div>

Using a higher meters per pixel setting for the point cloud reduces the resolution and the gaps
