# Nvdewarper dewarp 360 into one image

**URL:** <https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040>\
**Category:** DeepStream SDK\
**Created:** [March 4, 2021, 8:54am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040 "2021-03-04T08:54:08Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [March 4, 2021, 8:54am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/1 "2021-03-04T08:54:08Z")

</div>

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson Xavier AGX)**  
**• DeepStream Version 5.0.0**  
**• JetPack Version 4.5**  
**• TensorRT Version 7.1.3**

In the deepstream-dewarper-test, we divide the 360 image into 4 region as shown below:  
 ![image](https://global.discourse-cdn.com/nvidia/original/3X/4/d/4df14c964d31189ef6ca9e92e02a32edd8d06d54.jpeg)

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/b/3/b3fd77e9b5ea03ebbc8b40f5b847171d3b3c90f7.jpeg)  
Is it possible dewarp it into just 1 panaromic image?

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [March 8, 2021, 1:44am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/3 "2021-03-08T01:44:02Z")

</div>

Ok, we will check internally and update you ASAP.

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [March 12, 2021, 9:27am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/4 "2021-03-12T09:27:28Z")

</div>

In deepstream-dewarper-test, in config\_dewarper.txt, set only [surface0] section, remove [surface1/2/3] groups. Set [surface0] parameters as per the need. Also disable aisle-calibration-file=csv\_files/nvaisle\_2M.csv and spot-calibration-file=csv\_files/nvspot\_2M.csv from config file as these are for 4 surfaces

In addition, please try to use the latest DS5.1 version if possible.

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [March 12, 2021, 10:22am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/5 "2021-03-12T10:22:49Z")

</div>

@bcao If you were able to config the dewarp-test for one output, can you share the example config? That would save a lot of work for me. Thank you!

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [March 12, 2021, 10:26am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/6 "2021-03-12T10:26:36Z")

</div>

Sorry, I don’t have a camera locally, could you try as my last comment and share your configs with us if you still have issues.

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [March 15, 2021, 7:05am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/7 "2021-03-15T07:05:36Z")

</div>

@bcao Can you provide some more in-depth explanation of the parameters? I was able to dewarp the image with trial-and-error but I can’t fix the orientation. Now I would like to rotate it to get panaromic image.

 ![Screenshot from 2021-03-15 17-27-49](https://global.discourse-cdn.com/nvidia/original/3X/9/c/9c6b8db23fbf50bf3a3d1f2765b54adec6efb937.jpeg) ![Screenshot from 2021-03-15 17-30-00](https://global.discourse-cdn.com/nvidia/original/3X/2/5/251a121f3bb95f3840f6773b64673646edc6f3a1.jpeg)

My surface config:

> ```
> [surface0]
> projection-type=2
> surface-index=0
> width=1000
> height=1500
> top-angle=-180
> bottom-angle=180
> pitch=90
> yaw=0
> roll=90
> focal-length=318
> 
> ```

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [March 16, 2021, 6:21am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/8 "2021-03-16T06:21:15Z")

</div>

> [@batzor](#):
>
> Can you provide some more in-depth explanation of the parameters?

Which parameters?  
And have you checked [Gst-nvdewarper — DeepStream documentation](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvdewarper.html) firstly?

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [March 16, 2021, 6:53am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/9 "2021-03-16T06:53:46Z")

</div>

Yes. I also checked the dewarp-test example pdf but it had no information about top-angle, bottom-angle, pitch, yaw, roll. After playing around with this parameters, I am still not sure what exactly these parameters indicate and how to set so that my resulting image is oriented horizontally.

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [March 16, 2021, 7:03am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/10 "2021-03-16T07:03:27Z")

</div>

OK, I see, will check and reply you ASAP.

---

<div class="post-metadata">

**Author:** ![conall.laverty1](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@conall.laverty1](https://forums.developer.nvidia.com/u/conall.laverty1)\
**Post date:** [March 19, 2021, 11:28am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/11 "2021-03-19T11:28:12Z")

</div>

I had issues too with the examples. It’s a little lacking in detail to understand the different ways dewarping can be use and applied. Would love to see more!

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [March 24, 2021, 7:09am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/12 "2021-03-24T07:09:57Z")

</div>

@bcao any updates?

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [March 31, 2021, 12:56am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/13 "2021-03-31T00:56:19Z")

</div>

@bcao bump

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [April 5, 2021, 6:46am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/14 "2021-04-05T06:46:11Z")

</div>

@bcao bump

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [April 7, 2021, 5:34am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/15 "2021-04-07T05:34:38Z")

</div>

Hi @bcao ! I wonder if it is possible to do it using pad probe. I tried it with no success. My probe function and its resulting image is appended below. I would expect 1000x2000 → 500x2000 crop, rotate and scale to 1200x300 image output but I still get 1000x2000.

```
static GstPadProbeReturn
dewarper_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer u_data)
{
  GstBuffer *buf = (GstBuffer *) info->data;
  GstMapInfo outmap = GST_MAP_INFO_INIT;
  gst_buffer_map (buf, &outmap, GST_MAP_WRITE);
  NvBufSurface* surface = (NvBufSurface *)outmap.data;

  NvBufSurfTransformRect src_rect, dst_rect;
  src_rect.top = 0;
  src_rect.left = 0;
  src_rect.width = (guint) surface->surfaceList[0].width / 2;
  src_rect.height= (guint) surface->surfaceList[0].height;

  dst_rect.top = 0;
  dst_rect.left = 0;
  dst_rect.width = 1200;
  dst_rect.height= 300;

  NvBufSurface *dst_surface = NULL;
  NvBufSurfaceCreateParams create_params;

  create_params.gpuId = surface->gpuId;
  create_params.width = 1200;
  create_params.height = 300;
  create_params.size = 0;
  create_params.colorFormat = surface->surfaceList[0].colorFormat;
  create_params.layout = surface->surfaceList[0].layout;
  create_params.memType = surface->memType;

  NvBufSurfaceCreate(&dst_surface,1,&create_params);

  NvBufSurfTransformParams transform_params;
  transform_params.src_rect = &src_rect;
  transform_params.dst_rect = &dst_rect;

  NvBufSurfTransformConfigParams transform_config_params;
  NvBufSurfTransform_Error err;

  transform_config_params.compute_mode = NvBufSurfTransformCompute_Default;
  transform_config_params.gpu_id = surface->gpuId;
  transform_config_params.cuda_stream = NULL;
  transform_params.transform_flag = NVBUFSURF_TRANSFORM_CROP_SRC | NVBUFSURF_TRANSFORM_FLIP;
  transform_params.transform_flip = NvBufSurfTransform_Rotate270;
  err = NvBufSurfTransformSetSessionParams (&transform_config_params);
  // crop and rotate 270 to dst surface
  err = NvBufSurfTransform (surface, dst_surface, &transform_params);
  if (err != NvBufSurfTransformError_Success) {
    g_print("NvBufSurfTransform failed with error %d while converting buffer", err);
    return GST_PAD_PROBE_DROP;
  }

  // copy back to original surface
  transform_params.transform_flag = 0;
  err = NvBufSurfTransform (dst_surface, surface, &transform_params);
  if (err != NvBufSurfTransformError_Success) {
    g_print("NvBufSurfTransform failed with error %d while converting buffer", err);
    return GST_PAD_PROBE_DROP;
  }
  surface->surfaceList[0].height = 300;
  surface->surfaceList[0].width = 1200;
  NvBufSurfaceDestroy(dst_surface);

  gst_buffer_unmap (buf, &outmap);
  return GST_PAD_PROBE_OK;
}

```

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/c/4/c4bab1987543e88ca4bf37ba3d7ed3c5b136d381.jpeg)

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [April 20, 2021, 9:09am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/16 "2021-04-20T09:09:54Z")

</div>

Hey customer,  
We have a sample [GitHub - NVIDIA-AI-IOT/Deepstream-Dewarper-App: This project demonstrate how to infer and track from a 360 videos by using the dewarper plugin.](https://github.com/NVIDIA-AI-IOT/Deepstream-Dewarper-App) , could you check it and see if any help?

---

<div class="post-metadata">

**Author:** ![batzor](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@batzor](https://forums.developer.nvidia.com/u/batzor)\
**Post date:** [April 21, 2021, 1:43am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/17 "2021-04-21T01:43:18Z")

</div>

It seems the updated library is only supported for x86 for now. When it supports Jetson devices, it would definitely help me a lot. Thank you for the update!

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [April 21, 2021, 2:11am UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/18 "2021-04-21T02:11:39Z")

</div>

Jeston lib had been uploaded now [Deepstream-Dewarper-App/plugin\_libraries/jetson\_bin at main · NVIDIA-AI-IOT/Deepstream-Dewarper-App · GitHub](https://github.com/NVIDIA-AI-IOT/Deepstream-Dewarper-App/tree/main/plugin_libraries/jetson_bin)

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 4:14pm UTC](https://forums.developer.nvidia.com/t/nvdewarper-dewarp-360-into-one-image/170040/20 "2021-10-12T16:14:28Z")

</div>


