Repository: opencv
Issue: TypeError: Expected Ptr<cv::UMat> for argument 'src'
Labels: question (invalid tracker),category: python bindings

##### System information (version)
<!-- Example
- OpenCV => 4.5.1
- Operating System / Platform => Windows 64 Bit
- Compiler => Jupyter Notebook
-->

- OpenCV => :grey_question:
- Operating System / Platform => :
- Compiler => :grey_question:

##### Detailed description
 I am trying to add warPolar (LogPolar) layer in my neural network model but opencv gives this error
I also converted the tensor into numpy still tis error is coming.
```
 TypeError: Expected Ptr<cv::UMat> for argument 'src'
```

##### Steps to reproduce

# My Log Polar Sampling function
```
   import tensorflow as tf
      from tensorflow.keras.layers import Dense, Conv2D, MaxPool2D, Lambda
      import matplotlib.pyplot as plt
      import pandas as pd
      import cv2
      import os
      import math
      from skimage.transform import warp_polar, rotate, rescale
      from skimage.util import img_as_float
      import numpy as np
    import tensorflow.experimental.numpy as tnp

   
    def log_polar_sampling(feature_maps):

    log_polar = tf.zeros((feature_maps.shape[1],feature_maps.shape[2],feature_maps.shape[3]))
 
    for i in range(feature_maps.shape[-1]):

    image = tnp.asarray(feature_maps[:,:,:,i])
    
    print(f"Before {image[1].shape}")
    
    fh, fw = image[0].shape[1],image[0].shape[1]
    print(fh,fw)

    center  = (fh/2, fw/2 )
    radius  = np.int32(fw*0.9)
    M = fw / math.log(radius)
    
    flags = cv2.INTER_CUBIC + cv2.WARP_FILL_OUTLIERS

    dim = (fw,fh)
    
    log_polar_img = cv2.warpPolar(image,dim, center, M, flags+cv2.WARP_POLAR_LOG)
    log_polar[:,:,i] = log_polar_img

    return log_polar
```   
# My Neural network model:

```
def sdd_lpnet():
    inputs = tf.keras.layers.Input(shape=(300,300,3))
    conv1_1 = Conv2D(filters=64,kernel_size=(3,3),padding="same",activation="relu")(inputs)
    conv1_2 = Conv2D(filters=64,kernel_size=(3,3),padding="same",activation="relu")(conv1_1)

    pool = MaxPool2D(pool_size=(2,2), strides=2)(conv1_2)

    conv2_1 = Conv2D(filters=128,kernel_size=(3,3),padding="same",activation="relu")(pool)
    conv2_2 = Conv2D(filters=128,kernel_size=(3,3),padding="same",activation="relu")(conv2_1)

    pool = MaxPool2D(pool_size=(2,2), strides=2)(conv2_2)

    conv3_1 = Conv2D(filters=256,kernel_size=(3,3),padding="same",activation="relu")(pool)
    conv3_2 = Conv2D(filters=256,kernel_size=(3,3),padding="same",activation="relu")(conv3_1)
    conv3_3 = Conv2D(filters=256,kernel_size=(3,3),padding="same",activation="relu")(conv3_2)

    pool = MaxPool2D(pool_size=(2,2), strides=2)(conv3_3)

    conv4_1 = Conv2D(filters=512,kernel_size=(3,3),padding="same",activation="relu")(pool)
    conv4_2 = Conv2D(filters=512,kernel_size=(3,3),padding="same",activation="relu")(conv4_1)
    conv4_3 = Conv2D(filters=512,kernel_size=(3,3),padding="same",activation="relu")(conv4_2)

    pool = MaxPool2D(pool_size=(2,2), strides=2)(conv4_3)

    conv5_1 = Conv2D(filters=512,kernel_size=(3,3),padding="same",activation="relu")(pool)
    conv5_2 = Conv2D(filters=512,kernel_size=(3,3),padding="same",activation="relu")(conv5_1)
    conv5_3 = Conv2D(filters=512,kernel_size=(3,3),padding="same",activation="relu")(conv5_1)

    lop_polar_feature_maps = Lambda(log_polar_sampling,name="log_polar")(conv5_3)
    

    fc6 = Conv2D(filters=1024,kernel_size=(3,3),padding="same")(log_polar_feature_maps)
    fc7 = Conv2D(filters=1024,kernel_size=(1,1),padding="same")(fc6)


    conv8_1 = Conv2D(filters=256,kernel_size=(1,1),padding="same")(fc7)
    conv8_2 = Conv2D(filters=256,kernel_size=(3,3),padding="same",strides=2)(conv8_1)
    
    conv9_1 = Conv2D(filters=128,kernel_size=(1,1),padding="same")(conv8_2)
    conv9_2 = Conv2D(filters=256,kernel_size=(3,3),padding="same",strides=2)(conv9_1)
    

    conv10_1 = Conv2D(filters=128,kernel_size=(1,1),padding="same")(conv9_2)
    conv10_2 = Conv2D(filters=256,kernel_size=(3,3),padding="same",strides=1)(conv10_1)
    
    conv11_1 = Conv2D(filters=128,kernel_size=(1,1),padding="same")(conv10_2)
    conv11_2 = Conv2D(filters=256,kernel_size=(3,3),padding="same",strides=1)(conv11_1)



    return tf.keras.Model(inputs=inputs,outputs=conv11_2)
```