This is the first code i tried:
public static List<PointF> cloudalert(Bitmap bmp, float kilometers) { float distance = kilometers / (float)1.09; List<PointF> clouds = Load(); bmp = FastComparison(bmp, Properties.Resources.clean_radar_image); for (int x = 0; x < bmp.Width; x++) { for (int y = 0; y < bmp.Height; y++) { Color color = bmp.GetPixel(x, y); int dR = (int)color.R; int dG = (int)color.G; int dB = (int)color.B; if (dR == 0 && dG == 0 && dB == 0) { } else { if (clouds[x] && clouds[y]) { } } } }
clouds contain in this case 107 indexs in each there is a coordinate of a pixel at X and Y. kilometers is now set to 6. distance is 5.504587
I need to move the List clouds the coordinates to the left according to the distance by 5.504587 pixels. Then i need to scan on this are where the coordinates of the List are if the pixels of the variable bmp there are black nothing and anything else is a cloud.
So for now using messagebow.show will be find to throw a message if there is a cloud show "Cloud at: location here" if no cloud if its black "No cloud at: location here"
How can i do it ? First i need to move the points to the left by the distance then scan the bmp and then to check if its black or not on the coordinates locations after moved them.
Then i tried this code:
public static List<PointF> cloudalert(Bitmap bmp, float kilometers) { PointF point; PointF point1; float g = 0; float h = 0; float distance = kilometers / (float)1.09; List<PointF> clouds = Load(); for (int i = 0; i < clouds.Count; i++) { g = clouds[i].X + distance; h = clouds[i].Y + distance; bmp = FastComparison(bmp, Properties.Resources.clean_radar_image); for (int x = 0; x < bmp.Width; x++) { for (int y = 0; y < bmp.Height; y++) { point = new PointF(g, h); point1 = new PointF(x, y); Color color = bmp.GetPixel(x, y); int dR = (int)color.R; int dG = (int)color.G; int dB = (int)color.B; if (dR == 0 && dG == 0 && dB == 0) { } else { if (point == point1) { MessageBox.Show("Found a cloud at: " + point.X + "," + point.Y); } } } } }
Both codes are not working as excepted.
Also tried to move the List of clouds by the distance doing :
g = clouds[x].X + distance; h = clouds[y].Y + distance;
But im getting out of index exception on this.
How can i do it ?