c# - How to find the difference between two images? -



c# - How to find the difference between two images? -

i'm developing screen-sharing application. in project need transport images on internet. obviously, can't send new image on net every few seconds, extremely slow. want send 1 image of server's screen client, , afterwards, instead of sending new image sending pixels have been changed since lastly image (the 1 client has).

i have written code:

private list<color> comparebitmaps(image old, image _new) { list<color> returnlist = new list<color>(); for(int = 0; < old.width; i++) (int j = 0; j < old.height; j++) { if (((bitmap)old).getpixel(i, j) != ((bitmap)_new).getpixel(i, j)) { returnlist.add(((bitmap)_new).getpixel(i, j)); } } homecoming returnlist; }

however, works way slow.

i'm looking faster algorithm, 1 improve complexity.

note: don't want built library that. need algorithm.

you need homecoming changed pixels, complexity have m*n.

(bitmap)_new).getpixel(i, j) called twice, utilize temp value store might little better.

the pixel should have several values right? can seek create function called compraretwopixel(color a, color b)? , compare values 1 one, if 1 of them false, don`t need compare rest, homecoming false. (not sure if create faster or not though.)

like:

bool compraretwopixel(color a, color b) { if(a.a!=b.b) homecoming false; if(a.b!=b.b) homecoming false; if(a.c!=b.c) homecoming false; homecoming true; }

c#

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -