i have passed a lot of time searching on how to convert from cv::Mat or CvMat to CvArr but with no gain ,please help me in that,thanks.
If I recall correctly, CvMat IS a CvArr so you can just cast it into a CvArr, and the first bytes of the now CvArr tell the function that it is actually a CvMat: http://opencv.willowgarage.com/documentation/basic_structures.html#cvarr