public DTOBinaryObject(int label, int x, int y) { Points = new DTOCoordinate(x,y); BottomPoint = new DTOCoordinate(x,y); Label = label; }
public void setCenterOfMass() { int sumX = 0, x = 0; int sumY = 0, y = 0; totalActivePixels = 0; for (int iteratorHeight = 0; iteratorHeight < Height; iteratorHeight++) { for (int iteratorWidth = 0; iteratorWidth < Width; iteratorWidth++) { if (Pixels[iteratorHeight * Width + iteratorWidth] != -1) { totalActivePixels++; sumY += iteratorHeight; sumX += iteratorWidth; x++; y++; } } } CenterOfMass = new DTOCoordinate( (int)Math.Round( (float)sumX / (float)x) , (int)Math.Round( (float)sumY / (float)y) ); }