MCPcopy Create free account
hub / github.com/creatale/node-dv / perspectiveTransform

Method perspectiveTransform

deps/opencv/modules/core/src/matmul.cpp:1939–1974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1937}
1938
1939void cv::perspectiveTransform( InputArray _src, OutputArray _dst, InputArray _mtx )
1940{
1941 Mat src = _src.getMat(), m = _mtx.getMat();
1942 int depth = src.depth(), scn = src.channels(), dcn = m.rows-1;
1943 CV_Assert( scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F));
1944
1945 _dst.create( src.size(), CV_MAKETYPE(depth, dcn) );
1946 Mat dst = _dst.getMat();
1947
1948 const int mtype = CV_64F;
1949 AutoBuffer<double> _mbuf;
1950 double* mbuf = _mbuf;
1951
1952 if( !m.isContinuous() || m.type() != mtype )
1953 {
1954 _mbuf.allocate((dcn+1)*(scn+1));
1955 Mat tmp(dcn+1, scn+1, mtype, (double*)_mbuf);
1956 m.convertTo(tmp, mtype);
1957 m = tmp;
1958 }
1959 else
1960 mbuf = (double*)m.data;
1961
1962 TransformFunc func = depth == CV_32F ?
1963 (TransformFunc)perspectiveTransform_32f :
1964 (TransformFunc)perspectiveTransform_64f;
1965 CV_Assert( func != 0 );
1966
1967 const Mat* arrays[] = {&src, &dst, 0};
1968 uchar* ptrs[2];
1969 NAryMatIterator it(arrays, ptrs);
1970 size_t i, total = it.size;
1971
1972 for( i = 0; i < it.nplanes; i++, ++it )
1973 func( ptrs[0], ptrs[1], (uchar*)mbuf, (int)total, scn, dcn );
1974}
1975
1976/****************************************************************************************\
1977* ScaleAdd *

Callers

nothing calls this directly

Calls 9

getMatMethod · 0.45
depthMethod · 0.45
channelsMethod · 0.45
createMethod · 0.45
sizeMethod · 0.45
isContinuousMethod · 0.45
typeMethod · 0.45
allocateMethod · 0.45
convertToMethod · 0.45

Tested by

no test coverage detected