I first installed opencv and opencv-contrib from below link
https://github.com/opencv
Then I tried cmake with visual c++ but it failed because it cannot find the file "MSBuild.exe" even though I have Visual C++2017 installed in my PC.Then I tried it with mingw makefile and it generated files sucessfully.But to my suprise there is no .pyd or any python linked file.
I am now clueless how to go further linking it with python3. :(