@kislayabhi you are missing a line of code here and thats why this isn't working for mismatch type conversions. For example from my gist here is how to do a type change conversion using the constructor:

```cpp
Mat cvMat = Mat::eye(3,3,CV_32FC1);
cvMat.at<float>(0,1) = 3;
cvMat.convertTo(cvMat,CV_64FC1);
SGMatrix<float64_t> sgMat((float64_t*)cvMat.data,3,3,false);
```

You should put the convertTo code inside an `if` statement and only use it if required, ie. detect if there is a type mismatch and if there is run the convertTo