开发者

how to sort unordered images

开发者 https://www.devze.com 2023-01-26 01:12 出处:网络
i am trying to sort unordered images into correct sequence. Here i am not getting the correct sequence. For this example i have chosen an object walk. Code is developed on c#.net. This is my code.

i am trying to sort unordered images into correct sequence. Here i am not getting the correct sequence. For this example i have chosen an object walk. Code is developed on c#.net. This is my code.

        for (i = 1; i <imagecount; i++)
        {
            fir = getDifference(image[i], image[i + 1]);

            for (j = i + 2; j <= imagecount; j++)
            {
                if (i == j)
                    j = j + 1;
                sec = getDifference(image[i], image[j]);
                if (fir > sec)
                {
                    fir = sec;
                    tmp = image[j];
                    image[j] = image[i + 1];
                    image[i+1] = tmp;
                    j = 0;
                } 

I am following this approach. getDifference() method will give the difference between two images. Any simple开发者_如何学编程 logic on how to get sequenced images??


Without knowing about the getDifference() Method

Simple logic is OrderBy extesion method if using .net 3.5 or higher

or use Array.Sort() method in case of previous version.

0

精彩评论

暂无评论...
验证码 换一张
取 消