contar coordenadas de pixel xey

Eu tento este código para somar as coordenadas de pixels (x, y) na imagem

este é o código

#include<cv.h>
#include<cvaux.h>
#include<stdio.h>
#include<highgui.h>
#include<iostream>
#include<cxtypes.h> // for cvarr 
using namespace std;
// This program to count the pixel value in the gray image
void main()
{
    IplImage* image;
    int w,h;
    char* filename;
    filename="D:\\Recognition\\Image Crop\\7.jpg";
    image=cvLoadImage(filename,0); //for grayscal image
    // Get image attribute
    w=image->width; //image width
    h=image->height; //image height
    cout<<"1. image width "<<w<<"\n2. image height "<<h<<"  \n";
    int Sx,Sy;
    const CvArr* arr;
    CvScalar se; // to store the num
    for(int x=0;x>image->width;x++)
    {
        for(int y=0;image->height;y++)
        {
            se=cvGet2D(image,x,y);
            Sx=se.val[y];
            Sx+=Sx;
        }
        Sy=se.val[x];
        Sy+=Sy;
    }
    cout<<"3. sum x ="<<Sx<<"\n4. sum y ="<<Sy<<" \n";
}

Eu estou tentando calcular a soma das coordenadas de pixel xe y.

questionAnswers(1)

yourAnswerToTheQuestion