Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript HTML5/CSS
for(i=0,j=0;i<firstCanvasPixels.width, j<firstCanvasPixels.height;i+=4,j+=4)
        {
            for (p = 0, q = 0; p < secondCanvasPixels.width, q < secondCanvasPixels.height; p+=4, q+=4) {
                if (firstCanvasPixels[i][j] != secondCanvasPixels[p][q]) {
                    document.getElementById("showError").value = "Detected";
                }
                else {
                    document.getElementById("showError").value = "Not detected";
                }
            }
 
        }
 

I am working on windows 8 app development. I need to compare two images data in pixels. so please help me to correct this code. or tell me that code is feasible or not. I am writing code in HTML5, JavaScript.
Posted 11-Mar-13 23:09pm
Comments
Zoltán Zörgő at 12-Mar-13 4:30am
   
Comparing captured images pixel by pixel? Are you serious?
NachiketM at 12-Mar-13 4:36am
   
yes actually i wanted to detect motion, if any help is there tell me
Zoltán Zörgő at 12-Mar-13 4:44am
   
It is not that simple. Look here first: http://experiments.davidhunterdesign.com/?p=226
NachiketM at 12-Mar-13 6:46am
   
thank you, its just a demo. What can I use to do such program?
Zoltán Zörgő at 12-Mar-13 8:19am
   
Might be just a demo, but it is better than yours. So just view it's source and see how it is made - and copy what you need.
NachiketM at 13-Mar-13 1:41am
   
Is it possible to use jquery?
Zoltán Zörgő at 13-Mar-13 2:47am
   
For what exactly? Of course you can use jquery for what is in it's scope.
NachiketM at 13-Mar-13 3:06am
   
I am developing a game based on augmented reality for windows 8 using HTML5, JavaScript and CSS3. I captured a camera, for comparison purpose I took two frames into canvas on interval of 10 milliseconds and shown into 2 different canvas. Now I wanted to compare those two canvas images and difference will be shown into new canvas.
I need to have co-ordinates of difference.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 12 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100