Mat :: ones()表现

时间:2015-05-06 19:54:35

标签: c++ opencv

我正在开发一个使用opencv在C ++中实时运行的软件,并且需要尽可能高的性能。 哪个更有效率?

if (localStorage) {
    var milisec = 0;
    var seconds = localStorage.seconds || 30;
    document.counter.d2.value = seconds;

    function displaytimer() {
        if (milisec <= 0) {
            milisec = 9;
            seconds -= 1;
        }

        if (seconds <= -1) {
            milisec = 0;
            seconds += 1;
        }

        else milisec -= 1;

        localStorage.seconds = seconds;
        document.counter.d2.value = seconds + "." + milisec;

        if (seconds > 0 || (seconds = 0 && milisec > 0)) {
            setTimeout(displaytimer(), 100);
        }

        if (seconds <=0) {
            window.location="./pages/fail.html";
            cleartimer();
        }

        function cleartimer() {
            localStorage.seconds = seconds;
            document.counter.d2.value =0;
        }

        window.location="./pages/2.html";
    }
}
else {
    document.write("dom storage not supported");
}

或此选项

Mat matrix = Mat::ones(m, n, CV_32SC1);

和索引

int** matrix = new int*[m];
for (int i = 0; i < m; i++)
{
    matrix[i] = new int[n];
    for (int j = 0; j < n; j++)
        matrix[i][j] = 1;
}

VS

matrix.at<int>(r,c) = 10;

0 个答案:

没有答案