public QuadTreeNode( int startX, int startY, int height, int width, int data[][] ){

		// set coordination
		this.height = height;
		this.width = width;
		
		// Initialize white pixel number and black pixel number
		whitePixelNum = 0;
		blackPixelNum = 0;
		
		// Count white pixels and black pixels
		for(int i=startX; i<startX+height; i++){
			for(int j=startY; j<startY+width; j++){
				if(data[i][j] >= 1) { whitePixelNum++; }
				else { blackPixelNum++; } 
			}
		}
		
		// If pixels are all white pixels
		if(blackPixelNum == 0 && whitePixelNum == height*width){
			isWhite = true;
			isBlack = false;
			isGrey = false;}
		// If pixels are all black pixels
		else if(whitePixelNum == 0 && blackPixelNum == height*width){
			isBlack = true;
			isWhite = false;
			isGrey = false;}
		// Otherwise there are both black pixels and white pixels
		else{
			isGrey = true;
			isWhite = false;
			isBlack = false;}
		
		// If this node is grey, create four children
		// each child represents one forth
		if( isGrey ){
			nw = new QuadTreeNode(startX, startY, height/2, width/2, data);
			ne = new QuadTreeNode(startX, startY+width/2, height/2, width/2, data);
			sw = new QuadTreeNode(startX+height/2, startY, height/2, width/2, data);
			se = new QuadTreeNode(startX+height/2, startY+width/2, height/2, width/2, data);
		}
		else{
			nw = null;
			ne = null;
			sw = null;
			se = null;
		}
	}