/// <summary> /// does the orientation of this corner intersect with another corner? /// </summary> /// <param name="other_corner">the other corner feature</param> /// <param name="ix">x coordinate of the intersection point</param> /// <param name="iy">y coordinate of the intersection point</param> /// <returns>true if an intersection exists</returns> public bool intersects(FASTcorner other_corner, ref float ix, ref float iy) { bool result = sluggish.utilities.geometry.intersection(x,y,x+direction_x,y+direction_y, other_corner.x, other_corner.y, other_corner.x+other_corner.direction_x, other_corner.y+other_corner.direction_y, ref ix, ref iy); return(result); }
/// <summary> /// does the orientation of this corner intersect with another corner? /// </summary> /// <param name="other_corner">the other corner feature</param> /// <param name="ix">x coordinate of the intersection point</param> /// <param name="iy">y coordinate of the intersection point</param> /// <returns>true if an intersection exists</returns> public bool intersects(FASTcorner other_corner, ref float ix, ref float iy) { bool result = sluggish.utilities.geometry.intersection(x, y, x + direction_x, y + direction_y, other_corner.x, other_corner.y, other_corner.x + other_corner.direction_x, other_corner.y + other_corner.direction_y, ref ix, ref iy); return(result); }
public void Add(FASTcorner neighbour) { if (neighbours == null) { neighbours = new ArrayList(); } neighbours.Add(neighbour); }
/// <summary> /// returns true if the points given are on a line /// </summary> /// <param name="img"></param> /// <param name="img_width"></param> /// <param name="img_height"></param> /// <param name="p1"></param> /// <param name="p2"></param> /// <returns></returns> public static bool isLine(Byte[] img, int img_width, int img_height, int bytes_per_pixel, FASTcorner p1, FASTcorner p2, int line_threshold) { bool line = true; int diff_x = 0, diff_y = 0, sample_number = 0; const int max_samples = 100; const int radius = 10; int dx = p2.x - p1.x; int dy = p2.y - p1.y; while ((sample_number < max_samples) && (line)) { line = false; int x = p1.x + (dx * sample_number / max_samples); int y = p1.y + (dy * sample_number / max_samples); if ((x > radius) && (x < img_width - radius) && (y > radius) && (y < img_height - radius)) { int n = ((y * img_width) + x) * bytes_per_pixel; int r = radius * bytes_per_pixel; diff_x = (img[n - r] + img[n - r + bytes_per_pixel]) - (img[n + r] + img[n + r - bytes_per_pixel]); if (diff_x < 0) { diff_x = -diff_x; } if (diff_x < line_threshold) { r = radius * img_width * bytes_per_pixel; diff_y = (img[n - r] + img[n - r + bytes_per_pixel]) - (img[n + r] + img[n + r - bytes_per_pixel]); if (diff_y < 0) { diff_y = -diff_y; } } if ((diff_x > line_threshold) || (diff_y > line_threshold)) { line = true; } } else { line = true; } sample_number++; } return(line); }
private FASTcorner[] local_nonmax(FASTcorner[] corners, int radius_x, int radius_y) { FASTcorner[] corners2 = null; if (corners != null) { for (int i = 0; i < corners.Length - 1; i++) { FASTcorner c1 = corners[i]; if (c1 != null) { for (int j = i + 1; j < corners.Length; j++) { if (i != j) { FASTcorner c2 = corners[j]; if (c2 != null) { int dx = c1.x - c2.x; if ((dx > -radius_x) && (dx < radius_x)) { int dy = c1.y - c2.y; if ((dy > -radius_y) && (dy < radius_y)) { if (c2.score < c1.score) { corners[j] = null; } else { corners[i] = null; j = corners.Length; } } } } } } } } int count = 0; for (int i = 0; i < corners.Length; i++) if (corners[i] != null) count++; corners2 = new FASTcorner[count]; int n = 0; for (int i = 0; i < corners.Length; i++) if (corners[i] != null) { corners2[n] = corners[i]; n++; } } return (corners2); }
/// <summary> /// update the directionality of this corner /// </summary> /// <param name="corners">array of detected corner features</param> /// <param name="radius">neighbourhood radius</param> public void updateDirection(FASTcorner[] corners, int radius) { float tot_x = 0, tot_y = 0; int hits = 0; neighbours = null; for (int i = 0; i < corners.Length; i += 5) { FASTcorner corner = corners[i]; if (corner != this) { int dx = corner.x - x; if (dx > -radius) { if (dx < radius) { int dy = corner.y - y; if (dy > -radius) { if (dy < radius) { tot_x += dx; tot_y += dy; hits++; Add(corner); } } } } } } if (hits > 0) { direction_x = tot_x / hits; direction_y = tot_y / hits; direction_magnitude = (float)Math.Sqrt((direction_x * direction_x) + (direction_y * direction_y)); } else { direction_x = 0; direction_y = 0; direction_magnitude = 0; } }
/// <summary> /// update the directionality of this corner /// </summary> /// <param name="corners">array of detected corner features</param> /// <param name="radius">neighbourhood radius</param> public void updateDirection(FASTcorner[] corners, int radius) { float tot_x = 0, tot_y = 0; int hits = 0; neighbours = null; for (int i = 0; i < corners.Length; i+=5) { FASTcorner corner = corners[i]; if (corner != this) { int dx = corner.x - x; if (dx > -radius) { if (dx < radius) { int dy = corner.y - y; if (dy > -radius) { if (dy < radius) { tot_x += dx; tot_y += dy; hits++; Add(corner); } } } } } } if (hits > 0) { direction_x = tot_x / hits; direction_y = tot_y / hits; direction_magnitude = (float)Math.Sqrt((direction_x*direction_x)+(direction_y*direction_y)); } else { direction_x = 0; direction_y = 0; direction_magnitude = 0; } }
/// <summary> /// returns true if the points given are on a line /// </summary> /// <param name="img"></param> /// <param name="img_width"></param> /// <param name="img_height"></param> /// <param name="p1"></param> /// <param name="p2"></param> /// <returns></returns> public static bool isLine(Byte[] img, int img_width, int img_height, int bytes_per_pixel, FASTcorner p1, FASTcorner p2, int line_threshold) { bool line = true; int diff_x = 0, diff_y = 0, sample_number = 0; const int max_samples = 100; const int radius = 10; int dx = p2.x - p1.x; int dy = p2.y - p1.y; while ((sample_number < max_samples) && (line)) { line = false; int x = p1.x + (dx * sample_number / max_samples); int y = p1.y + (dy * sample_number / max_samples); if ((x > radius) && (x < img_width - radius) && (y > radius) && (y < img_height - radius)) { int n = ((y * img_width) + x) * bytes_per_pixel; int r = radius * bytes_per_pixel; diff_x = (img[n - r] + img[n - r + bytes_per_pixel]) - (img[n + r] + img[n + r - bytes_per_pixel]); if (diff_x < 0) diff_x = -diff_x; if (diff_x < line_threshold) { r = radius * img_width * bytes_per_pixel; diff_y = (img[n - r] + img[n - r + bytes_per_pixel]) - (img[n + r] + img[n + r - bytes_per_pixel]); if (diff_y < 0) diff_y = -diff_y; } if ((diff_x > line_threshold) || (diff_y > line_threshold)) line = true; } else line = true; sample_number++; } return (line); }
public int matching_score(FASTcorner other) { int score = -1; for (int x = 0; x < constellation_size * 2; x++) { for (int y = 0; y < constellation_size * 2; y++) { if ((constellation[x, y] > 0) || (other.constellation[x, y] > 0)) { if (score == -1) { score = 0; } score += Math.Abs(constellation[x, y] - other.constellation[x, y]); } } } return(score); }
/// <summary> /// builds a constellation for this corner /// </summary> /// <param name="other_corner">array of corner features</param> /// <param name="max_x_diff">max search radius for x axis</param> /// <param name="max_y_diff">max search radius for y axis</param> public void update(FASTcorner[] other_corner, int max_x_diff, int max_y_diff) { constellation = new int[(constellation_size * 2) + 1, (constellation_size * 2) + 1]; for (int i = 0; i < other_corner.Length; i++) { FASTcorner other = other_corner[i]; if ((other != this) && (other != null)) { int dx = other.x - x; if ((dx > -max_x_diff) && (dx < max_x_diff)) { int dy = other.y - y; if ((dy > -max_y_diff) && (dy < max_y_diff)) { int cx = constellation_size + (dx * constellation_size / max_x_diff); int cy = constellation_size + (dy * constellation_size / max_y_diff); constellation[cx, cy]++; } } } } }
/// <summary> /// detect FAST corners // It is assumed that the image supplied is mono (one byte per pixel) /// Note that non-maximal supression should be carried out after running this function /// </summary> /// <param name="img">image - one byte per pixel</param> /// <param name="xsize"></param> /// <param name="ysize"></param> /// <param name="barrier">detection threshold</param> /// <returns>array of corner features</returns> public static unsafe FASTcorner[] fast_corner_detect_9(Byte[] img, int xsize, int ysize, int barrier) { int boundary = 3, y, cb, c_b; Byte* line_max; Byte* line_min; int rsize = 512, total = 0; FASTcorner[] ret = new FASTcorner[rsize]; Byte* cache_0; Byte* cache_1; Byte* cache_2; int[] mpixel = new int[16]; fixed (int* pixel = mpixel) { fixed (Byte* im = img) { pixel[0] = 0 + 3 * xsize; pixel[1] = 1 + 3 * xsize; pixel[2] = 2 + 2 * xsize; pixel[3] = 3 + 1 * xsize; pixel[4] = 3 + 0 * xsize; pixel[5] = 3 + -1 * xsize; pixel[6] = 2 + -2 * xsize; pixel[7] = 1 + -3 * xsize; pixel[8] = 0 + -3 * xsize; pixel[9] = -1 + -3 * xsize; pixel[10] = -2 + -2 * xsize; pixel[11] = -3 + -1 * xsize; pixel[12] = -3 + 0 * xsize; pixel[13] = -3 + 1 * xsize; pixel[14] = -2 + 2 * xsize; pixel[15] = -1 + 3 * xsize; for (y = boundary; y < ysize - boundary; y++) { cache_0 = im + boundary + y*xsize; line_min = cache_0 - boundary; line_max = im + xsize - boundary + y * xsize; cache_1 = cache_0 + pixel[5]; cache_2 = cache_0 + pixel[14]; for(; cache_0 < line_max;cache_0++, cache_1++, cache_2++) { cb = *cache_0 + barrier; c_b = *cache_0 - barrier; if(*cache_1 > cb) if(*cache_2 > cb) if(*(cache_0+3) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[15]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[7]) > cb) goto success; else if(*(cache_0 + pixel[7]) < c_b) continue; else if(*(cache_0+-3) > cb) goto success; else continue; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_1+-6) > cb) continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else goto success; else continue; else continue; else if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_1+-6) > cb) goto success; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_1+-6) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) continue; else if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else if(*(cache_0 + pixel[9]) < c_b) continue; else if(*(cache_2+4) > cb) goto success; else continue; else if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[7]) > cb || *(cache_0 + pixel[7]) < c_b) continue; else goto success; else if(*(cache_2+4) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) continue; else if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else if(*(cache_0 + pixel[6]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) continue; else if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[6]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) continue; else if(*(cache_2+4) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) continue; else if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[10]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) continue; else if(*(cache_0 + pixel[3]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*cache_2 < c_b) if(*(cache_0+3) > cb) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[3]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[15]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[3]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[6]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) if(*(cache_2+4) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) continue; else if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[10]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0+-3) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_2+4) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[15]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0+-3) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_2+4) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) continue; else if(*(cache_0+-3) > cb) if(*(cache_1+-6) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[15]) > cb) continue; else if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[9]) > cb) continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[8]) > cb) continue; else if(*(cache_0 + pixel[8]) < c_b) goto success; else if(*(cache_0 + pixel[1]) < c_b) goto success; else continue; else if(*(cache_2+4) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[9]) > cb) continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[15]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[15]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[1]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[15]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0+-3) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[9]) < c_b) goto success; else if(*(cache_0 + pixel[6]) > cb || *(cache_0 + pixel[6]) < c_b) continue; else if(*(cache_2+4) < c_b) goto success; else continue; else continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0+-3) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[15]) > cb) continue; else if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[0]) > cb) continue; else if(*(cache_0 + pixel[0]) < c_b) goto success; else if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_2+4) > cb) continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0+-3) < c_b) goto success; else continue; else if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[9]) > cb) if(*(cache_2+4) < c_b) goto success; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[15]) > cb) continue; else if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[6]) < c_b) goto success; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[15]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) > cb) continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[15]) > cb) continue; else if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0+3) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else if(*(cache_0 + pixel[9]) < c_b) continue; else if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_1+-6) > cb) goto success; else continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) continue; else if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[15]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0+3) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[15]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else if(*(cache_0 + pixel[0]) < c_b) continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[6]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0+3) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0+3) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_2+4) > cb) goto success; else continue; else if(*(cache_0 + pixel[15]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_2+4) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[13]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[13]) < c_b) continue; else if(*(cache_0+3) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else if(*(cache_0+3) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*cache_1 < c_b) if(*(cache_0 + pixel[15]) > cb) if(*(cache_1+-6) > cb) if(*(cache_2+4) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*cache_2 > cb) goto success; else continue; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[7]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*cache_2 > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*cache_2 > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[7]) > cb) if(*(cache_0+-3) > cb) if(*cache_2 > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[9]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0+-3) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0+3) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*cache_2 > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_0+-3) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[1]) > cb) if(*cache_2 > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[7]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*cache_2 > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) < c_b) continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else goto success; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0+-3) > cb) if(*(cache_0+3) > cb) goto success; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[6]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0+-3) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0+3) > cb) continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[6]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[1]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0+3) > cb) continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_2+4) > cb) if(*(cache_0+3) > cb) if(*(cache_0+-3) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[3]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0+3) > cb) if(*(cache_0+-3) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[7]) > cb) continue; else if(*(cache_0 + pixel[7]) < c_b) goto success; else if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*cache_2 > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[0]) < c_b) if(*(cache_2+4) < c_b) if(*cache_2 < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[1]) < c_b) continue; else goto success; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[7]) > cb) if(*cache_2 < c_b) goto success; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[10]) < c_b) goto success; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[0]) > cb) continue; else if(*(cache_0 + pixel[0]) < c_b) goto success; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else continue; else if(*cache_2 < c_b) if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[1]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[8]) > cb) continue; else if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[9]) > cb) continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[7]) > cb) continue; else if(*(cache_0 + pixel[7]) < c_b) goto success; else if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else if(*(cache_2+4) < c_b) goto success; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[7]) > cb || *(cache_0 + pixel[7]) < c_b) continue; else goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_2+4) > cb) continue; else if(*(cache_2+4) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[3]) > cb) continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[0]) > cb) continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[1]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) goto success; else if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[0]) > cb) continue; else if(*(cache_0 + pixel[0]) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0+-3) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[1]) > cb || *(cache_0 + pixel[1]) < c_b) continue; else goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[3]) < c_b) if(*(cache_2+4) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[7]) > cb) continue; else if(*(cache_0 + pixel[7]) < c_b) if(*cache_2 > cb || *cache_2 < c_b) goto success; else if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[1]) > cb) continue; else if(*(cache_0 + pixel[1]) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[8]) < c_b) if(*cache_2 < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[10]) > cb) continue; else if(*(cache_0 + pixel[10]) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_0 + pixel[6]) > cb) if(*cache_2 > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[10]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[8]) < c_b) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[13]) > cb) continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[10]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_2+4) > cb) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0+3) > cb) continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[0]) > cb) continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[1]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[9]) > cb) continue; else if(*(cache_0 + pixel[9]) < c_b) goto success; else if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[9]) > cb) continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[10]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0+3) > cb) continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0+3) < c_b) goto success; else continue; else if(*(cache_0 + pixel[13]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[9]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) > cb) if(*cache_2 > cb) if(*(cache_0 + pixel[7]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[6]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else if(*(cache_0 + pixel[9]) < c_b) continue; else if(*(cache_2+4) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) continue; else if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) continue; else if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[8]) > cb) goto success; else if(*(cache_0 + pixel[8]) < c_b) continue; else if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else if(*(cache_0 + pixel[9]) < c_b) continue; else if(*(cache_2+4) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[0]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) continue; else if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) continue; else if(*(cache_0+3) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[13]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_2+4) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) continue; else if(*(cache_0 + pixel[10]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0+3) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[3]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+3) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[0]) > cb) if(*(cache_1+-6) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[0]) > cb) if(*(cache_0 + pixel[10]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) goto success; else continue; else continue; else if(*(cache_1+-6) < c_b) continue; else if(*(cache_0+3) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[9]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_1+-6) > cb) goto success; else continue; else continue; else continue; else if(*(cache_0 + pixel[1]) < c_b) continue; else if(*(cache_0 + pixel[8]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0+3) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[3]) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) continue; else if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[3]) > cb) goto success; else continue; else continue; else if(*(cache_0 + pixel[3]) > cb) if(*(cache_1+-6) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[15]) > cb) if(*(cache_0 + pixel[1]) > cb) goto success; else continue; else continue; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0+3) > cb) goto success; else continue; else if(*(cache_0+3) > cb) if(*(cache_0 + pixel[13]) > cb) if(*(cache_0 + pixel[1]) > cb) if(*(cache_2+4) > cb) if(*(cache_0 + pixel[15]) > cb) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+-3) < c_b) if(*(cache_0 + pixel[15]) > cb) if(*cache_2 < c_b) if(*(cache_0 + pixel[6]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[15]) < c_b) if(*(cache_0 + pixel[10]) > cb) if(*(cache_0+3) > cb) continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[13]) < c_b) goto success; else continue; else continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else continue; else if(*(cache_0 + pixel[10]) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[9]) > cb) if(*(cache_2+4) < c_b) goto success; else continue; else if(*(cache_0 + pixel[9]) < c_b) if(*(cache_1+-6) > cb) continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[1]) > cb) if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[0]) > cb) continue; else if(*(cache_0 + pixel[0]) < c_b) goto success; else if(*(cache_0 + pixel[7]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[7]) > cb) continue; else if(*(cache_0 + pixel[7]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else if(*(cache_0 + pixel[0]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[3]) < c_b) goto success; else continue; else continue; else if(*(cache_2+4) < c_b) if(*(cache_1+-6) > cb) continue; else if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_0 + pixel[3]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[3]) < c_b) if(*(cache_1+-6) > cb) continue; else if(*(cache_1+-6) < c_b) if(*(cache_2+4) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0+3) < c_b) if(*(cache_2+4) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[1]) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[0]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else if(*(cache_0 + pixel[6]) < c_b) if(*cache_2 < c_b) if(*(cache_0 + pixel[7]) < c_b) if(*(cache_1+-6) < c_b) if(*(cache_0 + pixel[13]) < c_b) if(*(cache_0 + pixel[10]) < c_b) if(*(cache_0 + pixel[9]) < c_b) if(*(cache_0 + pixel[8]) < c_b) goto success; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else continue; else continue; success: if (total >= rsize) { rsize *= 2; #if DOTNET_V1_1 ret = (FASTcorner[])ArrayResize(ret, rsize); #else Array.Resize(ref ret, rsize); #endif } int xx = (int)(cache_0 - line_min); int yy = y; ret[total] = new FASTcorner(xx, yy); total++; } } // resize the array so that we don't need to explicityly pass back the total // number of corners found #if DOTNET_V1_1 ret = (FASTcorner[])ArrayResize(ret, total); #else Array.Resize(ref ret, total); #endif return ret; } } }
public int matching_score(FASTcorner other) { int score = -1; for (int x = 0; x < constellation_size * 2; x++) { for (int y = 0; y < constellation_size * 2; y++) { if ((constellation[x, y] > 0) || (other.constellation[x, y] > 0)) { if (score == -1) score = 0; score += Math.Abs(constellation[x, y] - other.constellation[x, y]); } } } return (score); }
public void Add(FASTcorner neighbour) { if (neighbours == null) neighbours = new ArrayList(); neighbours.Add(neighbour); }
private FASTcorner[] local_nonmax(FASTcorner[] corners, int radius_x, int radius_y) { FASTcorner[] corners2 = null; if (corners != null) { for (int i = 0; i < corners.Length - 1; i++) { FASTcorner c1 = corners[i]; if (c1 != null) { for (int j = i + 1; j < corners.Length; j++) { if (i != j) { FASTcorner c2 = corners[j]; if (c2 != null) { int dx = c1.x - c2.x; if ((dx > -radius_x) && (dx < radius_x)) { int dy = c1.y - c2.y; if ((dy > -radius_y) && (dy < radius_y)) { if (c2.score < c1.score) { corners[j] = null; } else { corners[i] = null; j = corners.Length; } } } } } } } } int count = 0; for (int i = 0; i < corners.Length; i++) { if (corners[i] != null) { count++; } } corners2 = new FASTcorner[count]; int n = 0; for (int i = 0; i < corners.Length; i++) { if (corners[i] != null) { corners2[n] = corners[i]; n++; } } } return(corners2); }
/// <summary> /// update the neighbours for each corner feature /// </summary> /// <param name="corners">array of corner features</param> /// <param name="neighbour_radius">neighbourhood radius</param> public static void updateNeighbours(FASTcorner[] corners, int neighbour_radius) { for (int i = 0; i < corners.Length; i++) corners[i].updateDirection(corners, neighbour_radius); }
/// <summary> /// show the detected corner features in the given image /// </summary> /// <param name="corners">array containing detected corners</param> /// <param name="background">background image to be used</param> /// <param name="bmp">image to be returned</param> /// <param name="image_width">width of the image</param> /// <param name="image_height">height of the image</param> public static void Show(FASTcorner[] corners, byte[] background, byte[] bmp, int image_width, int image_height, int bytes_per_pixel) { // copy the background for (int i = 0; i < image_width * image_height * bytes_per_pixel; i++) bmp[i] = background[i]; for (int i = 0; i < corners.Length; i++) { FASTcorner corner = corners[i]; int n = ((corner.y * image_width) + corner.x) * bytes_per_pixel; // update the image if (bytes_per_pixel < 3) { bmp[n] = (byte)255; } else { for (int col = 0; col < bytes_per_pixel; col++) { if (col != 1) bmp[n + col] = 0; else bmp[n + col] = (byte)255; } } } }
public FASTline(FASTcorner point1, FASTcorner point2) { this.point1 = point1; this.point2 = point2; }
/// <summary> /// Detect lines in the given mono image using the given corner features /// </summary> public static FASTline[] fast_lines(Byte[] img, int xsize, int ysize, FASTcorner[] corners, int line_threshold, int min_length) { int min_length_y = min_length * ysize / xsize; int no_of_lines = 0; FASTline[] lines = new FASTline[corners.Length * corners.Length]; for (int i = 0; i < corners.Length - 1; i++) { FASTcorner corner1 = corners[i]; for (int j = i + 1; j < corners.Length; j++) { FASTcorner corner2 = corners[j]; int dx = corner2.x - corner1.x; if (dx < 0) dx = -dx; int dy = corner2.y - corner1.y; if (dy < 0) dy = -dy; if ((dx > min_length) || (dy > min_length_y)) { if (FASTline.isLine(img, xsize, ysize, 1, corner1, corner2, line_threshold)) { lines[no_of_lines] = new FASTline(corner1, corner2); no_of_lines++; } } } } if (no_of_lines > 0) #if DOTNET_V1_1 lines = (FASTline[])ArrayResize(lines, no_of_lines); #else Array.Resize(ref lines, no_of_lines); #endif else lines = null; return (lines); }
/// <summary> /// update corner properties /// </summary> /// <param name="corners"></param> /// <param name="xradius"></param> /// <param name="yradius"></param> public static void fast_update(FASTcorner[] corners, int xradius, int yradius) { if (corners != null) for (int i = 0; i < corners.Length; i++) if (corners[i] != null) corners[i].update(corners, xradius, yradius); }
/// <summary> /// perform non-maximal supression /// </summary> /// <param name="img">image - one byte per pixel</param> /// <param name="xsize">width of the image</param> /// <param name="ysize">height of the image</param> /// <param name="corners">returned corner features</param> /// <param name="barrier">detection threshold</param> /// <returns></returns> public static unsafe FASTcorner[] fast_nonmax(Byte[] img, int xsize, int ysize, FASTcorner[] corners, int barrier, float calibration_offset_x, float calibration_offset_y) { bool found; fixed (Byte* im = img) { int numcorners = corners.Length; // Create a list of integer pointer offstes, corresponding to the // direction offsets in dir[] int[] mpointer_dir = new int[16]; int[] row_start = new int[ysize]; int[] scores = new int[numcorners]; FASTcorner[] nonmax_corners = new FASTcorner[numcorners]; int num_nonmax = 0; int prev_row = -1; int i, j; int point_above = 0; int point_below = 0; fixed (int* pointer_dir = mpointer_dir) { pointer_dir[0] = 0 + 3 * xsize; pointer_dir[1] = 1 + 3 * xsize; pointer_dir[2] = 2 + 2 * xsize; pointer_dir[3] = 3 + 1 * xsize; pointer_dir[4] = 3 + 0 * xsize; pointer_dir[5] = 3 + -1 * xsize; pointer_dir[6] = 2 + -2 * xsize; pointer_dir[7] = 1 + -3 * xsize; pointer_dir[8] = 0 + -3 * xsize; pointer_dir[9] = -1 + -3 * xsize; pointer_dir[10] = -2 + -2 * xsize; pointer_dir[11] = -3 + -1 * xsize; pointer_dir[12] = -3 + 0 * xsize; pointer_dir[13] = -3 + 1 * xsize; pointer_dir[14] = -2 + 2 * xsize; pointer_dir[15] = -1 + 3 * xsize; if (numcorners < 5) return null; // xsize ysize numcorners corners // Compute the score for each detected corner, and find where each row begins // (the corners are output in raster scan order). A beginning of -1 signifies // that there are no corners on that row. for (i = 0; i < ysize; i++) row_start[i] = -1; for (i = 0; i < numcorners; i++) { if (corners[i].y != prev_row) { row_start[corners[i].y] = i; prev_row = corners[i].y; } scores[i] = corner_score(im + corners[i].x + corners[i].y * xsize, pointer_dir, barrier); } // Point above points (roughly) to the pixel above the one of interest, if there // is a feature there. int ctr; for (i = 1; i < numcorners - 1; i++) { int score = scores[i]; FASTcorner pos = corners[i]; // Check left if (corners[i - 1].x == pos.x - 1 && corners[i - 1].y == pos.y && scores[i - 1] > score) continue; // Check right if (corners[i + 1].x == pos.x + 1 && corners[i + 1].y == pos.y && scores[i - 1] > score) continue; // Check above if (pos.y > 0 && pos.y < ysize - 1 && row_start[pos.y - 1] > -1) { if (corners[point_above].y < pos.y - 1) point_above = row_start[pos.y - 1]; // Make point above point to the first of the pixels above the current point, // if it exists. ctr = 0; for (; corners[point_above].y < pos.y && corners[point_above].x < pos.x - 1; point_above++) { ctr++; if (ctr > 100) break; } for (j = point_above; corners[j].y < pos.y && corners[j].x <= pos.x + 1; j++) { int x = corners[j].x; if ((x == pos.x - 1 || x == pos.x || x == pos.x + 1) && scores[j] > score) { goto cont; } } } // Check below if (pos.y > 0 && pos.y < ysize - 2 && row_start[pos.y + 1] > -1) // Nothing below { if (corners[point_below].y < pos.y + 1) point_below = row_start[pos.y + 1]; // Make point below point to one of the pixels below the current point, if it // exists. ctr = 0; if (point_below < corners.Length) { for (; corners[point_below].y == pos.y + 1 && corners[point_below].x < pos.x - 1; point_below++) { ctr++; if (ctr > 100) break; if (point_below >= corners.Length - 1) break; } found = false; j = point_below; while ((!found) && (j < corners.Length)) { if (corners[j].y == pos.y + 1 && corners[j].x <= pos.x + 1) found = true; int x = corners[j].x; if ((x == pos.x - 1 || x == pos.x || x == pos.x + 1) && scores[j] > score) { goto cont; } if (j >= corners.Length) found = true; j++; } } } int xx = (int)(corners[i].x + calibration_offset_x); int yy = (int)(corners[i].y + calibration_offset_y); if ((xx > -1) && (xx < xsize) && (yy > -1) && (yy < ysize)) { nonmax_corners[num_nonmax] = new FASTcorner(xx, yy); nonmax_corners[num_nonmax].score = score; num_nonmax++; } cont: ; } #if DOTNET_V1_1 nonmax_corners = (FASTcorner[])ArrayResize(nonmax_corners, num_nonmax); #else Array.Resize(ref nonmax_corners, num_nonmax); #endif return nonmax_corners; } } }
/// <summary> /// show the orientations of features /// </summary> /// <param name="corners">array containing detected corners</param> /// <param name="background">background image to be used</param> /// <param name="bmp">image to be returned</param> /// <param name="image_width">width of the image</param> /// <param name="image_height">height of the image</param> /// <param name="min_neighbours">minimum number of features within the neighbourhood</param> /// <param name="min_direction_magnitude">minimum direction magnitude</param> public static void ShowOrientations(FASTcorner[] corners, byte[] background, byte[] bmp, int image_width, int image_height, int bytes_per_pixel, int min_neighbours, int min_direction_magnitude) { // copy the background for (int i = 0; i < image_width * image_height * bytes_per_pixel; i++) bmp[i] = background[i]; for (int i = 0; i < corners.Length; i++) { FASTcorner corner = corners[i]; if (corner.neighbours != null) { if (corner.neighbours.Count > min_neighbours) { if (corner.direction_magnitude > min_direction_magnitude) { if (bytes_per_pixel == 3) { sluggish.utilities.drawing.drawLine(bmp, image_width, image_height, (int)corner.x, (int)corner.y, (int)(corner.x + corner.direction_x), (int)(corner.y + corner.direction_y), 0, 255, 0, 0, false); } } } } } }