public void clarifySolution(Data.Image image) { if (swingSharpness == null) { swingSharpness = new double[image.width(), image.height()]; for (int x = 0; x < image.width(); x++) { for (int y = 0; y < image.height(); y++) { swingSharpness[x, y] = 0; } } width = image.width(); height = image.height(); } List <Data.Point> listPoint = new List <Data.Point>(); Bitmap curentImage = image.image; curentImage = changeImage.translateToMonochrome(curentImage); matematical.setImage(curentImage); for (int x = 0; x < image.width(); x++) { for (int y = 0; y < image.height(); y++) { double gradient = matematical.gradientAtPoint(x, y); if (gradient > swingSharpness[x, y]) { listPoint.Add(new Data.Point(x, y)); swingSharpness[x, y] = gradient; } } } solution.setValue(listPoint, image); }
void calculateGradientImage(int sector) { int x_begin = 0, x_end = 0, y_begin = 0, y_end = 0; lock (curentImage) { switch (sector) { case 0: x_begin = 0; x_end = curentImage.Width / 2; y_begin = 0; y_end = curentImage.Height / 2; break; case 1: x_begin = curentImage.Width / 2; x_end = curentImage.Width; y_begin = 0; y_end = curentImage.Height / 2; break; case 2: x_begin = 0; x_end = curentImage.Width / 2; y_begin = curentImage.Height / 2; y_end = curentImage.Height; break; case 3: x_begin = curentImage.Width / 2; x_end = curentImage.Width; y_begin = curentImage.Height / 2; y_end = curentImage.Height; break; } } for (int x = x_begin; x < x_end; x += step) { for (int y = y_begin; y < y_end; y += step) { double gradient = matematical.gradientAtPoint(x, y); if (gradient > swingSharpness[x, y]) { swingSharpness[x, y] = gradient; } } } }
public void addImageAnalysis(Image image) { matematical3x3.setImage(image.image); matematical5x5.setImage(image.image); matematical7x7.setImage(image.image); foreach (var point in pointAnalysis) { gradients3x3[point].Add(matematical3x3.gradientAtPoint(point.x, point.y)); gradients5x5[point].Add(matematical5x5.gradientAtPoint(point.x, point.y)); gradients7x7[point].Add(matematical7x7.gradientAtPoint(point.x, point.y)); } }
public void clarifySolution(Data.Image image, List <IMathematical> coreGoodPoint, List <Data.Point> goodPoint) { if (swingSharpness == null) { swingSharpness = new double[image.width(), image.height()]; /* for (int x = 0; x < image.width(); x++) * for (int y = 0; y < image.height(); y++) * swingSharpness[x, y] = 0;*/ width = image.width(); height = image.height(); } List <Data.Point> listPoint = new List <Data.Point>(); Bitmap curentImage = image.image; curentImage = changeImage.translateToMonochrome(curentImage); HashSet <IMathematical> set = new HashSet <IMathematical>(coreGoodPoint); foreach (var i in set) { i.setImage(curentImage); } for (int i = 0; i < goodPoint.Count; i++) { int x = goodPoint[i].x; int y = goodPoint[i].y; matematical = set.First(item => item.GetType() == coreGoodPoint[i].GetType()); double gradient = matematical.gradientAtPoint(x, y); if (gradient > swingSharpness[x, y]) { listPoint.Add(new Data.Point(x, y)); swingSharpness[x, y] = gradient; } } solution.setValue(listPoint, image); }