MCPcopy Create free account
hub / github.com/alibaba/MNN / setPolyToPoly

Method setPolyToPoly

source/cv/Matrix_CV.cpp:1106–1137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1104 return true;
1105}
1106bool Matrix::setPolyToPoly(const Point src[], const Point dst[], int count) {
1107 if ((unsigned)count > 4) {
1108 MNN_ERROR("---::setPolyToPoly count out of range %d\n", count);
1109 return false;
1110 }
1111
1112 if (0 == count) {
1113 this->reset();
1114 return true;
1115 }
1116 if (1 == count) {
1117 this->setTranslate(dst[0].fX - src[0].fX, dst[0].fY - src[0].fY);
1118 return true;
1119 }
1120
1121 typedef bool (*PolyMapProc)(const Point[], Matrix*);
1122 Matrix tempMap, result;
1123 const PolyMapProc gPolyMapProcs[] = {Matrix::Poly2Proc, Matrix::Poly3Proc, Matrix::Poly4Proc};
1124 auto proc = gPolyMapProcs[count - 2];
1125
1126 if (!proc(src, &tempMap)) {
1127 return false;
1128 }
1129 if (!tempMap.invert(&result)) {
1130 return false;
1131 }
1132 if (!proc(dst, &tempMap)) {
1133 return false;
1134 }
1135 this->setConcat(tempMap, result);
1136 return true;
1137}
1138///////////////////////////////////////////////////////////////////////////////
1139} // namespace CV
1140} // namespace MNN

Callers 7

getAffineTransformFunction · 0.80
getPerspectiveTransformFunction · 0.80
preprocessInputMethod · 0.80
convertImageMethod · 0.80
test_image_processMethod · 0.80
mainFunction · 0.80

Calls 4

resetMethod · 0.95
setTranslateMethod · 0.95
setConcatMethod · 0.95
invertMethod · 0.45

Tested by 1

test_image_processMethod · 0.64