Halcon::threshold 利用HTuple一次二值化两组区域比两次Halcon::threshold略快,不到5%。
测试环境:VC2013 halcon10
CWatch watch; for (int i = 0; i < 100; i++) { Halcon::threshold(imgCoatCheck, &m_regions.m_regionCoatLightNG, dMedialCoatCheckGray + iNGDiffGray, 255); Halcon::threshold(imgCoatCheck, &m_regions.m_regionCoatDarkNG, 0, dMedialCoatCheckGray - iNGDiffGray); } watch.Watch(); for (int i = 0; i < 100; i++) { Hobject region; Halcon::HTuple tMin, tMax; tMin.Append(0.0).Append(dMedialCoatCheckGray + iNGDiffGray); tMax.Append(dMedialCoatCheckGray - iNGDiffGray).Append(255.0); Halcon::threshold(imgCoatCheck, ®ion, tMin, tMax); } watch.Watch();