Click here to Skip to main content
11,802,442 members (71,299 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript HTML5
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 22:09pm
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:
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 KrunalRohit 366
1 OriginalGriff 365
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CPallini 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,645
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 12 Mar 2013
Copyright © CodeProject, 1999-2015
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