1 /* This is FAST corner detector, contributed to OpenCV by the author, Edward Rosten.
2 Below is the original copyright and the references */
5 Copyright (c) 2006, 2008 Edward Rosten
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions
12 *Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
15 *Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
19 *Neither the name of the University of Cambridge nor the names of
20 its contributors may be used to endorse or promote products derived
21 from this software without specific prior written permission.
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 * Machine learning for high-speed corner detection,
39 E. Rosten and T. Drummond, ECCV 2006
40 * Faster and better: A machine learning approach to corner detection
41 E. Rosten, R. Porter and T. Drummond, PAMI, 2009
49 static int fast9CornerScore(const unsigned char* p, const int pixel[], int bstart)
53 int b = (bmax + bmin)/2;
55 /*Compute the score using binary search*/
72 if( p[pixel[15]] > cb)
76 else if( p[pixel[7]] < c_b)
77 if( p[pixel[14]] > cb)
78 if( p[pixel[15]] > cb)
82 else if( p[pixel[14]] < c_b)
83 if( p[pixel[8]] < c_b)
84 if( p[pixel[9]] < c_b)
85 if( p[pixel[10]] < c_b)
86 if( p[pixel[11]] < c_b)
87 if( p[pixel[12]] < c_b)
88 if( p[pixel[13]] < c_b)
89 if( p[pixel[15]] < c_b)
100 goto is_not_a_corner;
102 goto is_not_a_corner;
104 goto is_not_a_corner;
106 goto is_not_a_corner;
108 if( p[pixel[14]] > cb)
109 if( p[pixel[15]] > cb)
112 goto is_not_a_corner;
114 goto is_not_a_corner;
115 else if( p[pixel[6]] < c_b)
116 if( p[pixel[15]] > cb)
117 if( p[pixel[13]] > cb)
118 if( p[pixel[14]] > cb)
121 goto is_not_a_corner;
122 else if( p[pixel[13]] < c_b)
123 if( p[pixel[7]] < c_b)
124 if( p[pixel[8]] < c_b)
125 if( p[pixel[9]] < c_b)
126 if( p[pixel[10]] < c_b)
127 if( p[pixel[11]] < c_b)
128 if( p[pixel[12]] < c_b)
129 if( p[pixel[14]] < c_b)
132 goto is_not_a_corner;
134 goto is_not_a_corner;
136 goto is_not_a_corner;
138 goto is_not_a_corner;
140 goto is_not_a_corner;
142 goto is_not_a_corner;
144 goto is_not_a_corner;
146 goto is_not_a_corner;
148 if( p[pixel[7]] < c_b)
149 if( p[pixel[8]] < c_b)
150 if( p[pixel[9]] < c_b)
151 if( p[pixel[10]] < c_b)
152 if( p[pixel[11]] < c_b)
153 if( p[pixel[12]] < c_b)
154 if( p[pixel[13]] < c_b)
155 if( p[pixel[14]] < c_b)
158 goto is_not_a_corner;
160 goto is_not_a_corner;
162 goto is_not_a_corner;
164 goto is_not_a_corner;
166 goto is_not_a_corner;
168 goto is_not_a_corner;
170 goto is_not_a_corner;
172 goto is_not_a_corner;
174 if( p[pixel[13]] > cb)
175 if( p[pixel[14]] > cb)
176 if( p[pixel[15]] > cb)
179 goto is_not_a_corner;
181 goto is_not_a_corner;
182 else if( p[pixel[13]] < c_b)
183 if( p[pixel[7]] < c_b)
184 if( p[pixel[8]] < c_b)
185 if( p[pixel[9]] < c_b)
186 if( p[pixel[10]] < c_b)
187 if( p[pixel[11]] < c_b)
188 if( p[pixel[12]] < c_b)
189 if( p[pixel[14]] < c_b)
190 if( p[pixel[15]] < c_b)
193 goto is_not_a_corner;
195 goto is_not_a_corner;
197 goto is_not_a_corner;
199 goto is_not_a_corner;
201 goto is_not_a_corner;
203 goto is_not_a_corner;
205 goto is_not_a_corner;
207 goto is_not_a_corner;
209 goto is_not_a_corner;
210 else if( p[pixel[5]] < c_b)
211 if( p[pixel[14]] > cb)
212 if( p[pixel[12]] > cb)
213 if( p[pixel[13]] > cb)
214 if( p[pixel[15]] > cb)
217 if( p[pixel[6]] > cb)
218 if( p[pixel[7]] > cb)
219 if( p[pixel[8]] > cb)
220 if( p[pixel[9]] > cb)
221 if( p[pixel[10]] > cb)
222 if( p[pixel[11]] > cb)
225 goto is_not_a_corner;
227 goto is_not_a_corner;
229 goto is_not_a_corner;
231 goto is_not_a_corner;
233 goto is_not_a_corner;
235 goto is_not_a_corner;
237 goto is_not_a_corner;
238 else if( p[pixel[12]] < c_b)
239 if( p[pixel[6]] < c_b)
240 if( p[pixel[7]] < c_b)
241 if( p[pixel[8]] < c_b)
242 if( p[pixel[9]] < c_b)
243 if( p[pixel[10]] < c_b)
244 if( p[pixel[11]] < c_b)
245 if( p[pixel[13]] < c_b)
248 goto is_not_a_corner;
250 goto is_not_a_corner;
252 goto is_not_a_corner;
254 goto is_not_a_corner;
256 goto is_not_a_corner;
258 goto is_not_a_corner;
260 goto is_not_a_corner;
262 goto is_not_a_corner;
263 else if( p[pixel[14]] < c_b)
264 if( p[pixel[7]] < c_b)
265 if( p[pixel[8]] < c_b)
266 if( p[pixel[9]] < c_b)
267 if( p[pixel[10]] < c_b)
268 if( p[pixel[11]] < c_b)
269 if( p[pixel[12]] < c_b)
270 if( p[pixel[13]] < c_b)
271 if( p[pixel[6]] < c_b)
274 if( p[pixel[15]] < c_b)
277 goto is_not_a_corner;
279 goto is_not_a_corner;
281 goto is_not_a_corner;
283 goto is_not_a_corner;
285 goto is_not_a_corner;
287 goto is_not_a_corner;
289 goto is_not_a_corner;
291 goto is_not_a_corner;
293 if( p[pixel[6]] < c_b)
294 if( p[pixel[7]] < c_b)
295 if( p[pixel[8]] < c_b)
296 if( p[pixel[9]] < c_b)
297 if( p[pixel[10]] < c_b)
298 if( p[pixel[11]] < c_b)
299 if( p[pixel[12]] < c_b)
300 if( p[pixel[13]] < c_b)
303 goto is_not_a_corner;
305 goto is_not_a_corner;
307 goto is_not_a_corner;
309 goto is_not_a_corner;
311 goto is_not_a_corner;
313 goto is_not_a_corner;
315 goto is_not_a_corner;
317 goto is_not_a_corner;
319 if( p[pixel[12]] > cb)
320 if( p[pixel[13]] > cb)
321 if( p[pixel[14]] > cb)
322 if( p[pixel[15]] > cb)
325 if( p[pixel[6]] > cb)
326 if( p[pixel[7]] > cb)
327 if( p[pixel[8]] > cb)
328 if( p[pixel[9]] > cb)
329 if( p[pixel[10]] > cb)
330 if( p[pixel[11]] > cb)
333 goto is_not_a_corner;
335 goto is_not_a_corner;
337 goto is_not_a_corner;
339 goto is_not_a_corner;
341 goto is_not_a_corner;
343 goto is_not_a_corner;
345 goto is_not_a_corner;
347 goto is_not_a_corner;
348 else if( p[pixel[12]] < c_b)
349 if( p[pixel[7]] < c_b)
350 if( p[pixel[8]] < c_b)
351 if( p[pixel[9]] < c_b)
352 if( p[pixel[10]] < c_b)
353 if( p[pixel[11]] < c_b)
354 if( p[pixel[13]] < c_b)
355 if( p[pixel[14]] < c_b)
356 if( p[pixel[6]] < c_b)
359 if( p[pixel[15]] < c_b)
362 goto is_not_a_corner;
364 goto is_not_a_corner;
366 goto is_not_a_corner;
368 goto is_not_a_corner;
370 goto is_not_a_corner;
372 goto is_not_a_corner;
374 goto is_not_a_corner;
376 goto is_not_a_corner;
378 goto is_not_a_corner;
379 else if( p[pixel[4]] < c_b)
380 if( p[pixel[13]] > cb)
381 if( p[pixel[11]] > cb)
382 if( p[pixel[12]] > cb)
383 if( p[pixel[14]] > cb)
384 if( p[pixel[15]] > cb)
387 if( p[pixel[6]] > cb)
388 if( p[pixel[7]] > cb)
389 if( p[pixel[8]] > cb)
390 if( p[pixel[9]] > cb)
391 if( p[pixel[10]] > cb)
394 goto is_not_a_corner;
396 goto is_not_a_corner;
398 goto is_not_a_corner;
400 goto is_not_a_corner;
402 goto is_not_a_corner;
404 if( p[pixel[5]] > cb)
405 if( p[pixel[6]] > cb)
406 if( p[pixel[7]] > cb)
407 if( p[pixel[8]] > cb)
408 if( p[pixel[9]] > cb)
409 if( p[pixel[10]] > cb)
412 goto is_not_a_corner;
414 goto is_not_a_corner;
416 goto is_not_a_corner;
418 goto is_not_a_corner;
420 goto is_not_a_corner;
422 goto is_not_a_corner;
424 goto is_not_a_corner;
425 else if( p[pixel[11]] < c_b)
426 if( p[pixel[5]] < c_b)
427 if( p[pixel[6]] < c_b)
428 if( p[pixel[7]] < c_b)
429 if( p[pixel[8]] < c_b)
430 if( p[pixel[9]] < c_b)
431 if( p[pixel[10]] < c_b)
432 if( p[pixel[12]] < c_b)
435 goto is_not_a_corner;
437 goto is_not_a_corner;
439 goto is_not_a_corner;
441 goto is_not_a_corner;
443 goto is_not_a_corner;
445 goto is_not_a_corner;
447 goto is_not_a_corner;
449 goto is_not_a_corner;
450 else if( p[pixel[13]] < c_b)
451 if( p[pixel[7]] < c_b)
452 if( p[pixel[8]] < c_b)
453 if( p[pixel[9]] < c_b)
454 if( p[pixel[10]] < c_b)
455 if( p[pixel[11]] < c_b)
456 if( p[pixel[12]] < c_b)
457 if( p[pixel[6]] < c_b)
458 if( p[pixel[5]] < c_b)
461 if( p[pixel[14]] < c_b)
464 goto is_not_a_corner;
466 if( p[pixel[14]] < c_b)
467 if( p[pixel[15]] < c_b)
470 goto is_not_a_corner;
472 goto is_not_a_corner;
474 goto is_not_a_corner;
476 goto is_not_a_corner;
478 goto is_not_a_corner;
480 goto is_not_a_corner;
482 goto is_not_a_corner;
484 goto is_not_a_corner;
486 if( p[pixel[5]] < c_b)
487 if( p[pixel[6]] < c_b)
488 if( p[pixel[7]] < c_b)
489 if( p[pixel[8]] < c_b)
490 if( p[pixel[9]] < c_b)
491 if( p[pixel[10]] < c_b)
492 if( p[pixel[11]] < c_b)
493 if( p[pixel[12]] < c_b)
496 goto is_not_a_corner;
498 goto is_not_a_corner;
500 goto is_not_a_corner;
502 goto is_not_a_corner;
504 goto is_not_a_corner;
506 goto is_not_a_corner;
508 goto is_not_a_corner;
510 goto is_not_a_corner;
512 if( p[pixel[11]] > cb)
513 if( p[pixel[12]] > cb)
514 if( p[pixel[13]] > cb)
515 if( p[pixel[14]] > cb)
516 if( p[pixel[15]] > cb)
519 if( p[pixel[6]] > cb)
520 if( p[pixel[7]] > cb)
521 if( p[pixel[8]] > cb)
522 if( p[pixel[9]] > cb)
523 if( p[pixel[10]] > cb)
526 goto is_not_a_corner;
528 goto is_not_a_corner;
530 goto is_not_a_corner;
532 goto is_not_a_corner;
534 goto is_not_a_corner;
536 if( p[pixel[5]] > cb)
537 if( p[pixel[6]] > cb)
538 if( p[pixel[7]] > cb)
539 if( p[pixel[8]] > cb)
540 if( p[pixel[9]] > cb)
541 if( p[pixel[10]] > cb)
544 goto is_not_a_corner;
546 goto is_not_a_corner;
548 goto is_not_a_corner;
550 goto is_not_a_corner;
552 goto is_not_a_corner;
554 goto is_not_a_corner;
556 goto is_not_a_corner;
558 goto is_not_a_corner;
559 else if( p[pixel[11]] < c_b)
560 if( p[pixel[7]] < c_b)
561 if( p[pixel[8]] < c_b)
562 if( p[pixel[9]] < c_b)
563 if( p[pixel[10]] < c_b)
564 if( p[pixel[12]] < c_b)
565 if( p[pixel[13]] < c_b)
566 if( p[pixel[6]] < c_b)
567 if( p[pixel[5]] < c_b)
570 if( p[pixel[14]] < c_b)
573 goto is_not_a_corner;
575 if( p[pixel[14]] < c_b)
576 if( p[pixel[15]] < c_b)
579 goto is_not_a_corner;
581 goto is_not_a_corner;
583 goto is_not_a_corner;
585 goto is_not_a_corner;
587 goto is_not_a_corner;
589 goto is_not_a_corner;
591 goto is_not_a_corner;
593 goto is_not_a_corner;
595 goto is_not_a_corner;
596 else if( p[pixel[3]] < c_b)
597 if( p[pixel[10]] > cb)
598 if( p[pixel[11]] > cb)
599 if( p[pixel[12]] > cb)
600 if( p[pixel[13]] > cb)
601 if( p[pixel[14]] > cb)
602 if( p[pixel[15]] > cb)
605 if( p[pixel[6]] > cb)
606 if( p[pixel[7]] > cb)
607 if( p[pixel[8]] > cb)
608 if( p[pixel[9]] > cb)
611 goto is_not_a_corner;
613 goto is_not_a_corner;
615 goto is_not_a_corner;
617 goto is_not_a_corner;
619 if( p[pixel[5]] > cb)
620 if( p[pixel[6]] > cb)
621 if( p[pixel[7]] > cb)
622 if( p[pixel[8]] > cb)
623 if( p[pixel[9]] > cb)
626 goto is_not_a_corner;
628 goto is_not_a_corner;
630 goto is_not_a_corner;
632 goto is_not_a_corner;
634 goto is_not_a_corner;
636 if( p[pixel[4]] > cb)
637 if( p[pixel[5]] > cb)
638 if( p[pixel[6]] > cb)
639 if( p[pixel[7]] > cb)
640 if( p[pixel[8]] > cb)
641 if( p[pixel[9]] > cb)
644 goto is_not_a_corner;
646 goto is_not_a_corner;
648 goto is_not_a_corner;
650 goto is_not_a_corner;
652 goto is_not_a_corner;
654 goto is_not_a_corner;
656 goto is_not_a_corner;
658 goto is_not_a_corner;
659 else if( p[pixel[10]] < c_b)
660 if( p[pixel[7]] < c_b)
661 if( p[pixel[8]] < c_b)
662 if( p[pixel[9]] < c_b)
663 if( p[pixel[11]] < c_b)
664 if( p[pixel[6]] < c_b)
665 if( p[pixel[5]] < c_b)
666 if( p[pixel[4]] < c_b)
669 if( p[pixel[12]] < c_b)
670 if( p[pixel[13]] < c_b)
673 goto is_not_a_corner;
675 goto is_not_a_corner;
677 if( p[pixel[12]] < c_b)
678 if( p[pixel[13]] < c_b)
679 if( p[pixel[14]] < c_b)
682 goto is_not_a_corner;
684 goto is_not_a_corner;
686 goto is_not_a_corner;
688 if( p[pixel[12]] < c_b)
689 if( p[pixel[13]] < c_b)
690 if( p[pixel[14]] < c_b)
691 if( p[pixel[15]] < c_b)
694 goto is_not_a_corner;
696 goto is_not_a_corner;
698 goto is_not_a_corner;
700 goto is_not_a_corner;
702 goto is_not_a_corner;
704 goto is_not_a_corner;
706 goto is_not_a_corner;
708 goto is_not_a_corner;
710 goto is_not_a_corner;
712 if( p[pixel[10]] > cb)
713 if( p[pixel[11]] > cb)
714 if( p[pixel[12]] > cb)
715 if( p[pixel[13]] > cb)
716 if( p[pixel[14]] > cb)
717 if( p[pixel[15]] > cb)
720 if( p[pixel[6]] > cb)
721 if( p[pixel[7]] > cb)
722 if( p[pixel[8]] > cb)
723 if( p[pixel[9]] > cb)
726 goto is_not_a_corner;
728 goto is_not_a_corner;
730 goto is_not_a_corner;
732 goto is_not_a_corner;
734 if( p[pixel[5]] > cb)
735 if( p[pixel[6]] > cb)
736 if( p[pixel[7]] > cb)
737 if( p[pixel[8]] > cb)
738 if( p[pixel[9]] > cb)
741 goto is_not_a_corner;
743 goto is_not_a_corner;
745 goto is_not_a_corner;
747 goto is_not_a_corner;
749 goto is_not_a_corner;
751 if( p[pixel[4]] > cb)
752 if( p[pixel[5]] > cb)
753 if( p[pixel[6]] > cb)
754 if( p[pixel[7]] > cb)
755 if( p[pixel[8]] > cb)
756 if( p[pixel[9]] > cb)
759 goto is_not_a_corner;
761 goto is_not_a_corner;
763 goto is_not_a_corner;
765 goto is_not_a_corner;
767 goto is_not_a_corner;
769 goto is_not_a_corner;
771 goto is_not_a_corner;
773 goto is_not_a_corner;
774 else if( p[pixel[10]] < c_b)
775 if( p[pixel[7]] < c_b)
776 if( p[pixel[8]] < c_b)
777 if( p[pixel[9]] < c_b)
778 if( p[pixel[11]] < c_b)
779 if( p[pixel[12]] < c_b)
780 if( p[pixel[6]] < c_b)
781 if( p[pixel[5]] < c_b)
782 if( p[pixel[4]] < c_b)
785 if( p[pixel[13]] < c_b)
788 goto is_not_a_corner;
790 if( p[pixel[13]] < c_b)
791 if( p[pixel[14]] < c_b)
794 goto is_not_a_corner;
796 goto is_not_a_corner;
798 if( p[pixel[13]] < c_b)
799 if( p[pixel[14]] < c_b)
800 if( p[pixel[15]] < c_b)
803 goto is_not_a_corner;
805 goto is_not_a_corner;
807 goto is_not_a_corner;
809 goto is_not_a_corner;
811 goto is_not_a_corner;
813 goto is_not_a_corner;
815 goto is_not_a_corner;
817 goto is_not_a_corner;
819 goto is_not_a_corner;
820 else if( p[pixel[2]] < c_b)
821 if( p[pixel[9]] > cb)
822 if( p[pixel[10]] > cb)
823 if( p[pixel[11]] > cb)
824 if( p[pixel[12]] > cb)
825 if( p[pixel[13]] > cb)
826 if( p[pixel[14]] > cb)
827 if( p[pixel[15]] > cb)
830 if( p[pixel[6]] > cb)
831 if( p[pixel[7]] > cb)
832 if( p[pixel[8]] > cb)
835 goto is_not_a_corner;
837 goto is_not_a_corner;
839 goto is_not_a_corner;
841 if( p[pixel[5]] > cb)
842 if( p[pixel[6]] > cb)
843 if( p[pixel[7]] > cb)
844 if( p[pixel[8]] > cb)
847 goto is_not_a_corner;
849 goto is_not_a_corner;
851 goto is_not_a_corner;
853 goto is_not_a_corner;
855 if( p[pixel[4]] > cb)
856 if( p[pixel[5]] > cb)
857 if( p[pixel[6]] > cb)
858 if( p[pixel[7]] > cb)
859 if( p[pixel[8]] > cb)
862 goto is_not_a_corner;
864 goto is_not_a_corner;
866 goto is_not_a_corner;
868 goto is_not_a_corner;
870 goto is_not_a_corner;
872 if( p[pixel[3]] > cb)
873 if( p[pixel[4]] > cb)
874 if( p[pixel[5]] > cb)
875 if( p[pixel[6]] > cb)
876 if( p[pixel[7]] > cb)
877 if( p[pixel[8]] > cb)
880 goto is_not_a_corner;
882 goto is_not_a_corner;
884 goto is_not_a_corner;
886 goto is_not_a_corner;
888 goto is_not_a_corner;
890 goto is_not_a_corner;
892 goto is_not_a_corner;
894 goto is_not_a_corner;
895 else if( p[pixel[9]] < c_b)
896 if( p[pixel[7]] < c_b)
897 if( p[pixel[8]] < c_b)
898 if( p[pixel[10]] < c_b)
899 if( p[pixel[6]] < c_b)
900 if( p[pixel[5]] < c_b)
901 if( p[pixel[4]] < c_b)
902 if( p[pixel[3]] < c_b)
905 if( p[pixel[11]] < c_b)
906 if( p[pixel[12]] < c_b)
909 goto is_not_a_corner;
911 goto is_not_a_corner;
913 if( p[pixel[11]] < c_b)
914 if( p[pixel[12]] < c_b)
915 if( p[pixel[13]] < c_b)
918 goto is_not_a_corner;
920 goto is_not_a_corner;
922 goto is_not_a_corner;
924 if( p[pixel[11]] < c_b)
925 if( p[pixel[12]] < c_b)
926 if( p[pixel[13]] < c_b)
927 if( p[pixel[14]] < c_b)
930 goto is_not_a_corner;
932 goto is_not_a_corner;
934 goto is_not_a_corner;
936 goto is_not_a_corner;
938 if( p[pixel[11]] < c_b)
939 if( p[pixel[12]] < c_b)
940 if( p[pixel[13]] < c_b)
941 if( p[pixel[14]] < c_b)
942 if( p[pixel[15]] < c_b)
945 goto is_not_a_corner;
947 goto is_not_a_corner;
949 goto is_not_a_corner;
951 goto is_not_a_corner;
953 goto is_not_a_corner;
955 goto is_not_a_corner;
957 goto is_not_a_corner;
959 goto is_not_a_corner;
961 goto is_not_a_corner;
963 if( p[pixel[9]] > cb)
964 if( p[pixel[10]] > cb)
965 if( p[pixel[11]] > cb)
966 if( p[pixel[12]] > cb)
967 if( p[pixel[13]] > cb)
968 if( p[pixel[14]] > cb)
969 if( p[pixel[15]] > cb)
972 if( p[pixel[6]] > cb)
973 if( p[pixel[7]] > cb)
974 if( p[pixel[8]] > cb)
977 goto is_not_a_corner;
979 goto is_not_a_corner;
981 goto is_not_a_corner;
983 if( p[pixel[5]] > cb)
984 if( p[pixel[6]] > cb)
985 if( p[pixel[7]] > cb)
986 if( p[pixel[8]] > cb)
989 goto is_not_a_corner;
991 goto is_not_a_corner;
993 goto is_not_a_corner;
995 goto is_not_a_corner;
997 if( p[pixel[4]] > cb)
998 if( p[pixel[5]] > cb)
999 if( p[pixel[6]] > cb)
1000 if( p[pixel[7]] > cb)
1001 if( p[pixel[8]] > cb)
1004 goto is_not_a_corner;
1006 goto is_not_a_corner;
1008 goto is_not_a_corner;
1010 goto is_not_a_corner;
1012 goto is_not_a_corner;
1014 if( p[pixel[3]] > cb)
1015 if( p[pixel[4]] > cb)
1016 if( p[pixel[5]] > cb)
1017 if( p[pixel[6]] > cb)
1018 if( p[pixel[7]] > cb)
1019 if( p[pixel[8]] > cb)
1022 goto is_not_a_corner;
1024 goto is_not_a_corner;
1026 goto is_not_a_corner;
1028 goto is_not_a_corner;
1030 goto is_not_a_corner;
1032 goto is_not_a_corner;
1034 goto is_not_a_corner;
1036 goto is_not_a_corner;
1037 else if( p[pixel[9]] < c_b)
1038 if( p[pixel[7]] < c_b)
1039 if( p[pixel[8]] < c_b)
1040 if( p[pixel[10]] < c_b)
1041 if( p[pixel[11]] < c_b)
1042 if( p[pixel[6]] < c_b)
1043 if( p[pixel[5]] < c_b)
1044 if( p[pixel[4]] < c_b)
1045 if( p[pixel[3]] < c_b)
1048 if( p[pixel[12]] < c_b)
1051 goto is_not_a_corner;
1053 if( p[pixel[12]] < c_b)
1054 if( p[pixel[13]] < c_b)
1057 goto is_not_a_corner;
1059 goto is_not_a_corner;
1061 if( p[pixel[12]] < c_b)
1062 if( p[pixel[13]] < c_b)
1063 if( p[pixel[14]] < c_b)
1066 goto is_not_a_corner;
1068 goto is_not_a_corner;
1070 goto is_not_a_corner;
1072 if( p[pixel[12]] < c_b)
1073 if( p[pixel[13]] < c_b)
1074 if( p[pixel[14]] < c_b)
1075 if( p[pixel[15]] < c_b)
1078 goto is_not_a_corner;
1080 goto is_not_a_corner;
1082 goto is_not_a_corner;
1084 goto is_not_a_corner;
1086 goto is_not_a_corner;
1088 goto is_not_a_corner;
1090 goto is_not_a_corner;
1092 goto is_not_a_corner;
1094 goto is_not_a_corner;
1095 else if( p[pixel[1]] < c_b)
1096 if( p[pixel[8]] > cb)
1097 if( p[pixel[9]] > cb)
1098 if( p[pixel[10]] > cb)
1099 if( p[pixel[11]] > cb)
1100 if( p[pixel[12]] > cb)
1101 if( p[pixel[13]] > cb)
1102 if( p[pixel[14]] > cb)
1103 if( p[pixel[15]] > cb)
1106 if( p[pixel[6]] > cb)
1107 if( p[pixel[7]] > cb)
1110 goto is_not_a_corner;
1112 goto is_not_a_corner;
1114 if( p[pixel[5]] > cb)
1115 if( p[pixel[6]] > cb)
1116 if( p[pixel[7]] > cb)
1119 goto is_not_a_corner;
1121 goto is_not_a_corner;
1123 goto is_not_a_corner;
1125 if( p[pixel[4]] > cb)
1126 if( p[pixel[5]] > cb)
1127 if( p[pixel[6]] > cb)
1128 if( p[pixel[7]] > cb)
1131 goto is_not_a_corner;
1133 goto is_not_a_corner;
1135 goto is_not_a_corner;
1137 goto is_not_a_corner;
1139 if( p[pixel[3]] > cb)
1140 if( p[pixel[4]] > cb)
1141 if( p[pixel[5]] > cb)
1142 if( p[pixel[6]] > cb)
1143 if( p[pixel[7]] > cb)
1146 goto is_not_a_corner;
1148 goto is_not_a_corner;
1150 goto is_not_a_corner;
1152 goto is_not_a_corner;
1154 goto is_not_a_corner;
1156 if( p[pixel[2]] > cb)
1157 if( p[pixel[3]] > cb)
1158 if( p[pixel[4]] > cb)
1159 if( p[pixel[5]] > cb)
1160 if( p[pixel[6]] > cb)
1161 if( p[pixel[7]] > cb)
1164 goto is_not_a_corner;
1166 goto is_not_a_corner;
1168 goto is_not_a_corner;
1170 goto is_not_a_corner;
1172 goto is_not_a_corner;
1174 goto is_not_a_corner;
1176 goto is_not_a_corner;
1178 goto is_not_a_corner;
1179 else if( p[pixel[8]] < c_b)
1180 if( p[pixel[7]] < c_b)
1181 if( p[pixel[9]] < c_b)
1182 if( p[pixel[6]] < c_b)
1183 if( p[pixel[5]] < c_b)
1184 if( p[pixel[4]] < c_b)
1185 if( p[pixel[3]] < c_b)
1186 if( p[pixel[2]] < c_b)
1189 if( p[pixel[10]] < c_b)
1190 if( p[pixel[11]] < c_b)
1193 goto is_not_a_corner;
1195 goto is_not_a_corner;
1197 if( p[pixel[10]] < c_b)
1198 if( p[pixel[11]] < c_b)
1199 if( p[pixel[12]] < c_b)
1202 goto is_not_a_corner;
1204 goto is_not_a_corner;
1206 goto is_not_a_corner;
1208 if( p[pixel[10]] < c_b)
1209 if( p[pixel[11]] < c_b)
1210 if( p[pixel[12]] < c_b)
1211 if( p[pixel[13]] < c_b)
1214 goto is_not_a_corner;
1216 goto is_not_a_corner;
1218 goto is_not_a_corner;
1220 goto is_not_a_corner;
1222 if( p[pixel[10]] < c_b)
1223 if( p[pixel[11]] < c_b)
1224 if( p[pixel[12]] < c_b)
1225 if( p[pixel[13]] < c_b)
1226 if( p[pixel[14]] < c_b)
1229 goto is_not_a_corner;
1231 goto is_not_a_corner;
1233 goto is_not_a_corner;
1235 goto is_not_a_corner;
1237 goto is_not_a_corner;
1239 if( p[pixel[10]] < c_b)
1240 if( p[pixel[11]] < c_b)
1241 if( p[pixel[12]] < c_b)
1242 if( p[pixel[13]] < c_b)
1243 if( p[pixel[14]] < c_b)
1244 if( p[pixel[15]] < c_b)
1247 goto is_not_a_corner;
1249 goto is_not_a_corner;
1251 goto is_not_a_corner;
1253 goto is_not_a_corner;
1255 goto is_not_a_corner;
1257 goto is_not_a_corner;
1259 goto is_not_a_corner;
1261 goto is_not_a_corner;
1263 goto is_not_a_corner;
1265 if( p[pixel[8]] > cb)
1266 if( p[pixel[9]] > cb)
1267 if( p[pixel[10]] > cb)
1268 if( p[pixel[11]] > cb)
1269 if( p[pixel[12]] > cb)
1270 if( p[pixel[13]] > cb)
1271 if( p[pixel[14]] > cb)
1272 if( p[pixel[15]] > cb)
1275 if( p[pixel[6]] > cb)
1276 if( p[pixel[7]] > cb)
1279 goto is_not_a_corner;
1281 goto is_not_a_corner;
1283 if( p[pixel[5]] > cb)
1284 if( p[pixel[6]] > cb)
1285 if( p[pixel[7]] > cb)
1288 goto is_not_a_corner;
1290 goto is_not_a_corner;
1292 goto is_not_a_corner;
1294 if( p[pixel[4]] > cb)
1295 if( p[pixel[5]] > cb)
1296 if( p[pixel[6]] > cb)
1297 if( p[pixel[7]] > cb)
1300 goto is_not_a_corner;
1302 goto is_not_a_corner;
1304 goto is_not_a_corner;
1306 goto is_not_a_corner;
1308 if( p[pixel[3]] > cb)
1309 if( p[pixel[4]] > cb)
1310 if( p[pixel[5]] > cb)
1311 if( p[pixel[6]] > cb)
1312 if( p[pixel[7]] > cb)
1315 goto is_not_a_corner;
1317 goto is_not_a_corner;
1319 goto is_not_a_corner;
1321 goto is_not_a_corner;
1323 goto is_not_a_corner;
1325 if( p[pixel[2]] > cb)
1326 if( p[pixel[3]] > cb)
1327 if( p[pixel[4]] > cb)
1328 if( p[pixel[5]] > cb)
1329 if( p[pixel[6]] > cb)
1330 if( p[pixel[7]] > cb)
1333 goto is_not_a_corner;
1335 goto is_not_a_corner;
1337 goto is_not_a_corner;
1339 goto is_not_a_corner;
1341 goto is_not_a_corner;
1343 goto is_not_a_corner;
1345 goto is_not_a_corner;
1347 goto is_not_a_corner;
1348 else if( p[pixel[8]] < c_b)
1349 if( p[pixel[7]] < c_b)
1350 if( p[pixel[9]] < c_b)
1351 if( p[pixel[10]] < c_b)
1352 if( p[pixel[6]] < c_b)
1353 if( p[pixel[5]] < c_b)
1354 if( p[pixel[4]] < c_b)
1355 if( p[pixel[3]] < c_b)
1356 if( p[pixel[2]] < c_b)
1359 if( p[pixel[11]] < c_b)
1362 goto is_not_a_corner;
1364 if( p[pixel[11]] < c_b)
1365 if( p[pixel[12]] < c_b)
1368 goto is_not_a_corner;
1370 goto is_not_a_corner;
1372 if( p[pixel[11]] < c_b)
1373 if( p[pixel[12]] < c_b)
1374 if( p[pixel[13]] < c_b)
1377 goto is_not_a_corner;
1379 goto is_not_a_corner;
1381 goto is_not_a_corner;
1383 if( p[pixel[11]] < c_b)
1384 if( p[pixel[12]] < c_b)
1385 if( p[pixel[13]] < c_b)
1386 if( p[pixel[14]] < c_b)
1389 goto is_not_a_corner;
1391 goto is_not_a_corner;
1393 goto is_not_a_corner;
1395 goto is_not_a_corner;
1397 if( p[pixel[11]] < c_b)
1398 if( p[pixel[12]] < c_b)
1399 if( p[pixel[13]] < c_b)
1400 if( p[pixel[14]] < c_b)
1401 if( p[pixel[15]] < c_b)
1404 goto is_not_a_corner;
1406 goto is_not_a_corner;
1408 goto is_not_a_corner;
1410 goto is_not_a_corner;
1412 goto is_not_a_corner;
1414 goto is_not_a_corner;
1416 goto is_not_a_corner;
1418 goto is_not_a_corner;
1420 goto is_not_a_corner;
1421 else if( p[pixel[0]] < c_b)
1422 if( p[pixel[1]] > cb)
1423 if( p[pixel[8]] > cb)
1424 if( p[pixel[7]] > cb)
1425 if( p[pixel[9]] > cb)
1426 if( p[pixel[6]] > cb)
1427 if( p[pixel[5]] > cb)
1428 if( p[pixel[4]] > cb)
1429 if( p[pixel[3]] > cb)
1430 if( p[pixel[2]] > cb)
1433 if( p[pixel[10]] > cb)
1434 if( p[pixel[11]] > cb)
1437 goto is_not_a_corner;
1439 goto is_not_a_corner;
1441 if( p[pixel[10]] > cb)
1442 if( p[pixel[11]] > cb)
1443 if( p[pixel[12]] > cb)
1446 goto is_not_a_corner;
1448 goto is_not_a_corner;
1450 goto is_not_a_corner;
1452 if( p[pixel[10]] > cb)
1453 if( p[pixel[11]] > cb)
1454 if( p[pixel[12]] > cb)
1455 if( p[pixel[13]] > cb)
1458 goto is_not_a_corner;
1460 goto is_not_a_corner;
1462 goto is_not_a_corner;
1464 goto is_not_a_corner;
1466 if( p[pixel[10]] > cb)
1467 if( p[pixel[11]] > cb)
1468 if( p[pixel[12]] > cb)
1469 if( p[pixel[13]] > cb)
1470 if( p[pixel[14]] > cb)
1473 goto is_not_a_corner;
1475 goto is_not_a_corner;
1477 goto is_not_a_corner;
1479 goto is_not_a_corner;
1481 goto is_not_a_corner;
1483 if( p[pixel[10]] > cb)
1484 if( p[pixel[11]] > cb)
1485 if( p[pixel[12]] > cb)
1486 if( p[pixel[13]] > cb)
1487 if( p[pixel[14]] > cb)
1488 if( p[pixel[15]] > cb)
1491 goto is_not_a_corner;
1493 goto is_not_a_corner;
1495 goto is_not_a_corner;
1497 goto is_not_a_corner;
1499 goto is_not_a_corner;
1501 goto is_not_a_corner;
1503 goto is_not_a_corner;
1505 goto is_not_a_corner;
1506 else if( p[pixel[8]] < c_b)
1507 if( p[pixel[9]] < c_b)
1508 if( p[pixel[10]] < c_b)
1509 if( p[pixel[11]] < c_b)
1510 if( p[pixel[12]] < c_b)
1511 if( p[pixel[13]] < c_b)
1512 if( p[pixel[14]] < c_b)
1513 if( p[pixel[15]] < c_b)
1516 if( p[pixel[6]] < c_b)
1517 if( p[pixel[7]] < c_b)
1520 goto is_not_a_corner;
1522 goto is_not_a_corner;
1524 if( p[pixel[5]] < c_b)
1525 if( p[pixel[6]] < c_b)
1526 if( p[pixel[7]] < c_b)
1529 goto is_not_a_corner;
1531 goto is_not_a_corner;
1533 goto is_not_a_corner;
1535 if( p[pixel[4]] < c_b)
1536 if( p[pixel[5]] < c_b)
1537 if( p[pixel[6]] < c_b)
1538 if( p[pixel[7]] < c_b)
1541 goto is_not_a_corner;
1543 goto is_not_a_corner;
1545 goto is_not_a_corner;
1547 goto is_not_a_corner;
1549 if( p[pixel[3]] < c_b)
1550 if( p[pixel[4]] < c_b)
1551 if( p[pixel[5]] < c_b)
1552 if( p[pixel[6]] < c_b)
1553 if( p[pixel[7]] < c_b)
1556 goto is_not_a_corner;
1558 goto is_not_a_corner;
1560 goto is_not_a_corner;
1562 goto is_not_a_corner;
1564 goto is_not_a_corner;
1566 if( p[pixel[2]] < c_b)
1567 if( p[pixel[3]] < c_b)
1568 if( p[pixel[4]] < c_b)
1569 if( p[pixel[5]] < c_b)
1570 if( p[pixel[6]] < c_b)
1571 if( p[pixel[7]] < c_b)
1574 goto is_not_a_corner;
1576 goto is_not_a_corner;
1578 goto is_not_a_corner;
1580 goto is_not_a_corner;
1582 goto is_not_a_corner;
1584 goto is_not_a_corner;
1586 goto is_not_a_corner;
1588 goto is_not_a_corner;
1590 goto is_not_a_corner;
1591 else if( p[pixel[1]] < c_b)
1592 if( p[pixel[2]] > cb)
1593 if( p[pixel[9]] > cb)
1594 if( p[pixel[7]] > cb)
1595 if( p[pixel[8]] > cb)
1596 if( p[pixel[10]] > cb)
1597 if( p[pixel[6]] > cb)
1598 if( p[pixel[5]] > cb)
1599 if( p[pixel[4]] > cb)
1600 if( p[pixel[3]] > cb)
1603 if( p[pixel[11]] > cb)
1604 if( p[pixel[12]] > cb)
1607 goto is_not_a_corner;
1609 goto is_not_a_corner;
1611 if( p[pixel[11]] > cb)
1612 if( p[pixel[12]] > cb)
1613 if( p[pixel[13]] > cb)
1616 goto is_not_a_corner;
1618 goto is_not_a_corner;
1620 goto is_not_a_corner;
1622 if( p[pixel[11]] > cb)
1623 if( p[pixel[12]] > cb)
1624 if( p[pixel[13]] > cb)
1625 if( p[pixel[14]] > cb)
1628 goto is_not_a_corner;
1630 goto is_not_a_corner;
1632 goto is_not_a_corner;
1634 goto is_not_a_corner;
1636 if( p[pixel[11]] > cb)
1637 if( p[pixel[12]] > cb)
1638 if( p[pixel[13]] > cb)
1639 if( p[pixel[14]] > cb)
1640 if( p[pixel[15]] > cb)
1643 goto is_not_a_corner;
1645 goto is_not_a_corner;
1647 goto is_not_a_corner;
1649 goto is_not_a_corner;
1651 goto is_not_a_corner;
1653 goto is_not_a_corner;
1655 goto is_not_a_corner;
1657 goto is_not_a_corner;
1658 else if( p[pixel[9]] < c_b)
1659 if( p[pixel[10]] < c_b)
1660 if( p[pixel[11]] < c_b)
1661 if( p[pixel[12]] < c_b)
1662 if( p[pixel[13]] < c_b)
1663 if( p[pixel[14]] < c_b)
1664 if( p[pixel[15]] < c_b)
1667 if( p[pixel[6]] < c_b)
1668 if( p[pixel[7]] < c_b)
1669 if( p[pixel[8]] < c_b)
1672 goto is_not_a_corner;
1674 goto is_not_a_corner;
1676 goto is_not_a_corner;
1678 if( p[pixel[5]] < c_b)
1679 if( p[pixel[6]] < c_b)
1680 if( p[pixel[7]] < c_b)
1681 if( p[pixel[8]] < c_b)
1684 goto is_not_a_corner;
1686 goto is_not_a_corner;
1688 goto is_not_a_corner;
1690 goto is_not_a_corner;
1692 if( p[pixel[4]] < c_b)
1693 if( p[pixel[5]] < c_b)
1694 if( p[pixel[6]] < c_b)
1695 if( p[pixel[7]] < c_b)
1696 if( p[pixel[8]] < c_b)
1699 goto is_not_a_corner;
1701 goto is_not_a_corner;
1703 goto is_not_a_corner;
1705 goto is_not_a_corner;
1707 goto is_not_a_corner;
1709 if( p[pixel[3]] < c_b)
1710 if( p[pixel[4]] < c_b)
1711 if( p[pixel[5]] < c_b)
1712 if( p[pixel[6]] < c_b)
1713 if( p[pixel[7]] < c_b)
1714 if( p[pixel[8]] < c_b)
1717 goto is_not_a_corner;
1719 goto is_not_a_corner;
1721 goto is_not_a_corner;
1723 goto is_not_a_corner;
1725 goto is_not_a_corner;
1727 goto is_not_a_corner;
1729 goto is_not_a_corner;
1731 goto is_not_a_corner;
1733 goto is_not_a_corner;
1734 else if( p[pixel[2]] < c_b)
1735 if( p[pixel[3]] > cb)
1736 if( p[pixel[10]] > cb)
1737 if( p[pixel[7]] > cb)
1738 if( p[pixel[8]] > cb)
1739 if( p[pixel[9]] > cb)
1740 if( p[pixel[11]] > cb)
1741 if( p[pixel[6]] > cb)
1742 if( p[pixel[5]] > cb)
1743 if( p[pixel[4]] > cb)
1746 if( p[pixel[12]] > cb)
1747 if( p[pixel[13]] > cb)
1750 goto is_not_a_corner;
1752 goto is_not_a_corner;
1754 if( p[pixel[12]] > cb)
1755 if( p[pixel[13]] > cb)
1756 if( p[pixel[14]] > cb)
1759 goto is_not_a_corner;
1761 goto is_not_a_corner;
1763 goto is_not_a_corner;
1765 if( p[pixel[12]] > cb)
1766 if( p[pixel[13]] > cb)
1767 if( p[pixel[14]] > cb)
1768 if( p[pixel[15]] > cb)
1771 goto is_not_a_corner;
1773 goto is_not_a_corner;
1775 goto is_not_a_corner;
1777 goto is_not_a_corner;
1779 goto is_not_a_corner;
1781 goto is_not_a_corner;
1783 goto is_not_a_corner;
1785 goto is_not_a_corner;
1786 else if( p[pixel[10]] < c_b)
1787 if( p[pixel[11]] < c_b)
1788 if( p[pixel[12]] < c_b)
1789 if( p[pixel[13]] < c_b)
1790 if( p[pixel[14]] < c_b)
1791 if( p[pixel[15]] < c_b)
1794 if( p[pixel[6]] < c_b)
1795 if( p[pixel[7]] < c_b)
1796 if( p[pixel[8]] < c_b)
1797 if( p[pixel[9]] < c_b)
1800 goto is_not_a_corner;
1802 goto is_not_a_corner;
1804 goto is_not_a_corner;
1806 goto is_not_a_corner;
1808 if( p[pixel[5]] < c_b)
1809 if( p[pixel[6]] < c_b)
1810 if( p[pixel[7]] < c_b)
1811 if( p[pixel[8]] < c_b)
1812 if( p[pixel[9]] < c_b)
1815 goto is_not_a_corner;
1817 goto is_not_a_corner;
1819 goto is_not_a_corner;
1821 goto is_not_a_corner;
1823 goto is_not_a_corner;
1825 if( p[pixel[4]] < c_b)
1826 if( p[pixel[5]] < c_b)
1827 if( p[pixel[6]] < c_b)
1828 if( p[pixel[7]] < c_b)
1829 if( p[pixel[8]] < c_b)
1830 if( p[pixel[9]] < c_b)
1833 goto is_not_a_corner;
1835 goto is_not_a_corner;
1837 goto is_not_a_corner;
1839 goto is_not_a_corner;
1841 goto is_not_a_corner;
1843 goto is_not_a_corner;
1845 goto is_not_a_corner;
1847 goto is_not_a_corner;
1849 goto is_not_a_corner;
1850 else if( p[pixel[3]] < c_b)
1851 if( p[pixel[4]] > cb)
1852 if( p[pixel[13]] > cb)
1853 if( p[pixel[7]] > cb)
1854 if( p[pixel[8]] > cb)
1855 if( p[pixel[9]] > cb)
1856 if( p[pixel[10]] > cb)
1857 if( p[pixel[11]] > cb)
1858 if( p[pixel[12]] > cb)
1859 if( p[pixel[6]] > cb)
1860 if( p[pixel[5]] > cb)
1863 if( p[pixel[14]] > cb)
1866 goto is_not_a_corner;
1868 if( p[pixel[14]] > cb)
1869 if( p[pixel[15]] > cb)
1872 goto is_not_a_corner;
1874 goto is_not_a_corner;
1876 goto is_not_a_corner;
1878 goto is_not_a_corner;
1880 goto is_not_a_corner;
1882 goto is_not_a_corner;
1884 goto is_not_a_corner;
1886 goto is_not_a_corner;
1887 else if( p[pixel[13]] < c_b)
1888 if( p[pixel[11]] > cb)
1889 if( p[pixel[5]] > cb)
1890 if( p[pixel[6]] > cb)
1891 if( p[pixel[7]] > cb)
1892 if( p[pixel[8]] > cb)
1893 if( p[pixel[9]] > cb)
1894 if( p[pixel[10]] > cb)
1895 if( p[pixel[12]] > cb)
1898 goto is_not_a_corner;
1900 goto is_not_a_corner;
1902 goto is_not_a_corner;
1904 goto is_not_a_corner;
1906 goto is_not_a_corner;
1908 goto is_not_a_corner;
1910 goto is_not_a_corner;
1911 else if( p[pixel[11]] < c_b)
1912 if( p[pixel[12]] < c_b)
1913 if( p[pixel[14]] < c_b)
1914 if( p[pixel[15]] < c_b)
1917 if( p[pixel[6]] < c_b)
1918 if( p[pixel[7]] < c_b)
1919 if( p[pixel[8]] < c_b)
1920 if( p[pixel[9]] < c_b)
1921 if( p[pixel[10]] < c_b)
1924 goto is_not_a_corner;
1926 goto is_not_a_corner;
1928 goto is_not_a_corner;
1930 goto is_not_a_corner;
1932 goto is_not_a_corner;
1934 if( p[pixel[5]] < c_b)
1935 if( p[pixel[6]] < c_b)
1936 if( p[pixel[7]] < c_b)
1937 if( p[pixel[8]] < c_b)
1938 if( p[pixel[9]] < c_b)
1939 if( p[pixel[10]] < c_b)
1942 goto is_not_a_corner;
1944 goto is_not_a_corner;
1946 goto is_not_a_corner;
1948 goto is_not_a_corner;
1950 goto is_not_a_corner;
1952 goto is_not_a_corner;
1954 goto is_not_a_corner;
1956 goto is_not_a_corner;
1958 if( p[pixel[5]] > cb)
1959 if( p[pixel[6]] > cb)
1960 if( p[pixel[7]] > cb)
1961 if( p[pixel[8]] > cb)
1962 if( p[pixel[9]] > cb)
1963 if( p[pixel[10]] > cb)
1964 if( p[pixel[11]] > cb)
1965 if( p[pixel[12]] > cb)
1968 goto is_not_a_corner;
1970 goto is_not_a_corner;
1972 goto is_not_a_corner;
1974 goto is_not_a_corner;
1976 goto is_not_a_corner;
1978 goto is_not_a_corner;
1980 goto is_not_a_corner;
1982 goto is_not_a_corner;
1983 else if( p[pixel[4]] < c_b)
1984 if( p[pixel[5]] > cb)
1985 if( p[pixel[14]] > cb)
1986 if( p[pixel[7]] > cb)
1987 if( p[pixel[8]] > cb)
1988 if( p[pixel[9]] > cb)
1989 if( p[pixel[10]] > cb)
1990 if( p[pixel[11]] > cb)
1991 if( p[pixel[12]] > cb)
1992 if( p[pixel[13]] > cb)
1993 if( p[pixel[6]] > cb)
1996 if( p[pixel[15]] > cb)
1999 goto is_not_a_corner;
2001 goto is_not_a_corner;
2003 goto is_not_a_corner;
2005 goto is_not_a_corner;
2007 goto is_not_a_corner;
2009 goto is_not_a_corner;
2011 goto is_not_a_corner;
2013 goto is_not_a_corner;
2014 else if( p[pixel[14]] < c_b)
2015 if( p[pixel[12]] > cb)
2016 if( p[pixel[6]] > cb)
2017 if( p[pixel[7]] > cb)
2018 if( p[pixel[8]] > cb)
2019 if( p[pixel[9]] > cb)
2020 if( p[pixel[10]] > cb)
2021 if( p[pixel[11]] > cb)
2022 if( p[pixel[13]] > cb)
2025 goto is_not_a_corner;
2027 goto is_not_a_corner;
2029 goto is_not_a_corner;
2031 goto is_not_a_corner;
2033 goto is_not_a_corner;
2035 goto is_not_a_corner;
2037 goto is_not_a_corner;
2038 else if( p[pixel[12]] < c_b)
2039 if( p[pixel[13]] < c_b)
2040 if( p[pixel[15]] < c_b)
2043 if( p[pixel[6]] < c_b)
2044 if( p[pixel[7]] < c_b)
2045 if( p[pixel[8]] < c_b)
2046 if( p[pixel[9]] < c_b)
2047 if( p[pixel[10]] < c_b)
2048 if( p[pixel[11]] < c_b)
2051 goto is_not_a_corner;
2053 goto is_not_a_corner;
2055 goto is_not_a_corner;
2057 goto is_not_a_corner;
2059 goto is_not_a_corner;
2061 goto is_not_a_corner;
2063 goto is_not_a_corner;
2065 goto is_not_a_corner;
2067 if( p[pixel[6]] > cb)
2068 if( p[pixel[7]] > cb)
2069 if( p[pixel[8]] > cb)
2070 if( p[pixel[9]] > cb)
2071 if( p[pixel[10]] > cb)
2072 if( p[pixel[11]] > cb)
2073 if( p[pixel[12]] > cb)
2074 if( p[pixel[13]] > cb)
2077 goto is_not_a_corner;
2079 goto is_not_a_corner;
2081 goto is_not_a_corner;
2083 goto is_not_a_corner;
2085 goto is_not_a_corner;
2087 goto is_not_a_corner;
2089 goto is_not_a_corner;
2091 goto is_not_a_corner;
2092 else if( p[pixel[5]] < c_b)
2093 if( p[pixel[6]] > cb)
2094 if( p[pixel[15]] < c_b)
2095 if( p[pixel[13]] > cb)
2096 if( p[pixel[7]] > cb)
2097 if( p[pixel[8]] > cb)
2098 if( p[pixel[9]] > cb)
2099 if( p[pixel[10]] > cb)
2100 if( p[pixel[11]] > cb)
2101 if( p[pixel[12]] > cb)
2102 if( p[pixel[14]] > cb)
2105 goto is_not_a_corner;
2107 goto is_not_a_corner;
2109 goto is_not_a_corner;
2111 goto is_not_a_corner;
2113 goto is_not_a_corner;
2115 goto is_not_a_corner;
2117 goto is_not_a_corner;
2118 else if( p[pixel[13]] < c_b)
2119 if( p[pixel[14]] < c_b)
2122 goto is_not_a_corner;
2124 goto is_not_a_corner;
2126 if( p[pixel[7]] > cb)
2127 if( p[pixel[8]] > cb)
2128 if( p[pixel[9]] > cb)
2129 if( p[pixel[10]] > cb)
2130 if( p[pixel[11]] > cb)
2131 if( p[pixel[12]] > cb)
2132 if( p[pixel[13]] > cb)
2133 if( p[pixel[14]] > cb)
2136 goto is_not_a_corner;
2138 goto is_not_a_corner;
2140 goto is_not_a_corner;
2142 goto is_not_a_corner;
2144 goto is_not_a_corner;
2146 goto is_not_a_corner;
2148 goto is_not_a_corner;
2150 goto is_not_a_corner;
2151 else if( p[pixel[6]] < c_b)
2152 if( p[pixel[7]] > cb)
2153 if( p[pixel[14]] > cb)
2154 if( p[pixel[8]] > cb)
2155 if( p[pixel[9]] > cb)
2156 if( p[pixel[10]] > cb)
2157 if( p[pixel[11]] > cb)
2158 if( p[pixel[12]] > cb)
2159 if( p[pixel[13]] > cb)
2160 if( p[pixel[15]] > cb)
2163 goto is_not_a_corner;
2165 goto is_not_a_corner;
2167 goto is_not_a_corner;
2169 goto is_not_a_corner;
2171 goto is_not_a_corner;
2173 goto is_not_a_corner;
2175 goto is_not_a_corner;
2176 else if( p[pixel[14]] < c_b)
2177 if( p[pixel[15]] < c_b)
2180 goto is_not_a_corner;
2182 goto is_not_a_corner;
2183 else if( p[pixel[7]] < c_b)
2184 if( p[pixel[8]] < c_b)
2187 if( p[pixel[15]] < c_b)
2190 goto is_not_a_corner;
2192 if( p[pixel[14]] < c_b)
2193 if( p[pixel[15]] < c_b)
2196 goto is_not_a_corner;
2198 goto is_not_a_corner;
2200 if( p[pixel[13]] > cb)
2201 if( p[pixel[7]] > cb)
2202 if( p[pixel[8]] > cb)
2203 if( p[pixel[9]] > cb)
2204 if( p[pixel[10]] > cb)
2205 if( p[pixel[11]] > cb)
2206 if( p[pixel[12]] > cb)
2207 if( p[pixel[14]] > cb)
2208 if( p[pixel[15]] > cb)
2211 goto is_not_a_corner;
2213 goto is_not_a_corner;
2215 goto is_not_a_corner;
2217 goto is_not_a_corner;
2219 goto is_not_a_corner;
2221 goto is_not_a_corner;
2223 goto is_not_a_corner;
2225 goto is_not_a_corner;
2226 else if( p[pixel[13]] < c_b)
2227 if( p[pixel[14]] < c_b)
2228 if( p[pixel[15]] < c_b)
2231 goto is_not_a_corner;
2233 goto is_not_a_corner;
2235 goto is_not_a_corner;
2237 if( p[pixel[12]] > cb)
2238 if( p[pixel[7]] > cb)
2239 if( p[pixel[8]] > cb)
2240 if( p[pixel[9]] > cb)
2241 if( p[pixel[10]] > cb)
2242 if( p[pixel[11]] > cb)
2243 if( p[pixel[13]] > cb)
2244 if( p[pixel[14]] > cb)
2245 if( p[pixel[6]] > cb)
2248 if( p[pixel[15]] > cb)
2251 goto is_not_a_corner;
2253 goto is_not_a_corner;
2255 goto is_not_a_corner;
2257 goto is_not_a_corner;
2259 goto is_not_a_corner;
2261 goto is_not_a_corner;
2263 goto is_not_a_corner;
2265 goto is_not_a_corner;
2266 else if( p[pixel[12]] < c_b)
2267 if( p[pixel[13]] < c_b)
2268 if( p[pixel[14]] < c_b)
2269 if( p[pixel[15]] < c_b)
2272 if( p[pixel[6]] < c_b)
2273 if( p[pixel[7]] < c_b)
2274 if( p[pixel[8]] < c_b)
2275 if( p[pixel[9]] < c_b)
2276 if( p[pixel[10]] < c_b)
2277 if( p[pixel[11]] < c_b)
2280 goto is_not_a_corner;
2282 goto is_not_a_corner;
2284 goto is_not_a_corner;
2286 goto is_not_a_corner;
2288 goto is_not_a_corner;
2290 goto is_not_a_corner;
2292 goto is_not_a_corner;
2294 goto is_not_a_corner;
2296 goto is_not_a_corner;
2298 if( p[pixel[11]] > cb)
2299 if( p[pixel[7]] > cb)
2300 if( p[pixel[8]] > cb)
2301 if( p[pixel[9]] > cb)
2302 if( p[pixel[10]] > cb)
2303 if( p[pixel[12]] > cb)
2304 if( p[pixel[13]] > cb)
2305 if( p[pixel[6]] > cb)
2306 if( p[pixel[5]] > cb)
2309 if( p[pixel[14]] > cb)
2312 goto is_not_a_corner;
2314 if( p[pixel[14]] > cb)
2315 if( p[pixel[15]] > cb)
2318 goto is_not_a_corner;
2320 goto is_not_a_corner;
2322 goto is_not_a_corner;
2324 goto is_not_a_corner;
2326 goto is_not_a_corner;
2328 goto is_not_a_corner;
2330 goto is_not_a_corner;
2332 goto is_not_a_corner;
2333 else if( p[pixel[11]] < c_b)
2334 if( p[pixel[12]] < c_b)
2335 if( p[pixel[13]] < c_b)
2336 if( p[pixel[14]] < c_b)
2337 if( p[pixel[15]] < c_b)
2340 if( p[pixel[6]] < c_b)
2341 if( p[pixel[7]] < c_b)
2342 if( p[pixel[8]] < c_b)
2343 if( p[pixel[9]] < c_b)
2344 if( p[pixel[10]] < c_b)
2347 goto is_not_a_corner;
2349 goto is_not_a_corner;
2351 goto is_not_a_corner;
2353 goto is_not_a_corner;
2355 goto is_not_a_corner;
2357 if( p[pixel[5]] < c_b)
2358 if( p[pixel[6]] < c_b)
2359 if( p[pixel[7]] < c_b)
2360 if( p[pixel[8]] < c_b)
2361 if( p[pixel[9]] < c_b)
2362 if( p[pixel[10]] < c_b)
2365 goto is_not_a_corner;
2367 goto is_not_a_corner;
2369 goto is_not_a_corner;
2371 goto is_not_a_corner;
2373 goto is_not_a_corner;
2375 goto is_not_a_corner;
2377 goto is_not_a_corner;
2379 goto is_not_a_corner;
2381 goto is_not_a_corner;
2383 if( p[pixel[10]] > cb)
2384 if( p[pixel[7]] > cb)
2385 if( p[pixel[8]] > cb)
2386 if( p[pixel[9]] > cb)
2387 if( p[pixel[11]] > cb)
2388 if( p[pixel[12]] > cb)
2389 if( p[pixel[6]] > cb)
2390 if( p[pixel[5]] > cb)
2391 if( p[pixel[4]] > cb)
2394 if( p[pixel[13]] > cb)
2397 goto is_not_a_corner;
2399 if( p[pixel[13]] > cb)
2400 if( p[pixel[14]] > cb)
2403 goto is_not_a_corner;
2405 goto is_not_a_corner;
2407 if( p[pixel[13]] > cb)
2408 if( p[pixel[14]] > cb)
2409 if( p[pixel[15]] > cb)
2412 goto is_not_a_corner;
2414 goto is_not_a_corner;
2416 goto is_not_a_corner;
2418 goto is_not_a_corner;
2420 goto is_not_a_corner;
2422 goto is_not_a_corner;
2424 goto is_not_a_corner;
2426 goto is_not_a_corner;
2427 else if( p[pixel[10]] < c_b)
2428 if( p[pixel[11]] < c_b)
2429 if( p[pixel[12]] < c_b)
2430 if( p[pixel[13]] < c_b)
2431 if( p[pixel[14]] < c_b)
2432 if( p[pixel[15]] < c_b)
2435 if( p[pixel[6]] < c_b)
2436 if( p[pixel[7]] < c_b)
2437 if( p[pixel[8]] < c_b)
2438 if( p[pixel[9]] < c_b)
2441 goto is_not_a_corner;
2443 goto is_not_a_corner;
2445 goto is_not_a_corner;
2447 goto is_not_a_corner;
2449 if( p[pixel[5]] < c_b)
2450 if( p[pixel[6]] < c_b)
2451 if( p[pixel[7]] < c_b)
2452 if( p[pixel[8]] < c_b)
2453 if( p[pixel[9]] < c_b)
2456 goto is_not_a_corner;
2458 goto is_not_a_corner;
2460 goto is_not_a_corner;
2462 goto is_not_a_corner;
2464 goto is_not_a_corner;
2466 if( p[pixel[4]] < c_b)
2467 if( p[pixel[5]] < c_b)
2468 if( p[pixel[6]] < c_b)
2469 if( p[pixel[7]] < c_b)
2470 if( p[pixel[8]] < c_b)
2471 if( p[pixel[9]] < c_b)
2474 goto is_not_a_corner;
2476 goto is_not_a_corner;
2478 goto is_not_a_corner;
2480 goto is_not_a_corner;
2482 goto is_not_a_corner;
2484 goto is_not_a_corner;
2486 goto is_not_a_corner;
2488 goto is_not_a_corner;
2490 goto is_not_a_corner;
2492 if( p[pixel[9]] > cb)
2493 if( p[pixel[7]] > cb)
2494 if( p[pixel[8]] > cb)
2495 if( p[pixel[10]] > cb)
2496 if( p[pixel[11]] > cb)
2497 if( p[pixel[6]] > cb)
2498 if( p[pixel[5]] > cb)
2499 if( p[pixel[4]] > cb)
2500 if( p[pixel[3]] > cb)
2503 if( p[pixel[12]] > cb)
2506 goto is_not_a_corner;
2508 if( p[pixel[12]] > cb)
2509 if( p[pixel[13]] > cb)
2512 goto is_not_a_corner;
2514 goto is_not_a_corner;
2516 if( p[pixel[12]] > cb)
2517 if( p[pixel[13]] > cb)
2518 if( p[pixel[14]] > cb)
2521 goto is_not_a_corner;
2523 goto is_not_a_corner;
2525 goto is_not_a_corner;
2527 if( p[pixel[12]] > cb)
2528 if( p[pixel[13]] > cb)
2529 if( p[pixel[14]] > cb)
2530 if( p[pixel[15]] > cb)
2533 goto is_not_a_corner;
2535 goto is_not_a_corner;
2537 goto is_not_a_corner;
2539 goto is_not_a_corner;
2541 goto is_not_a_corner;
2543 goto is_not_a_corner;
2545 goto is_not_a_corner;
2547 goto is_not_a_corner;
2548 else if( p[pixel[9]] < c_b)
2549 if( p[pixel[10]] < c_b)
2550 if( p[pixel[11]] < c_b)
2551 if( p[pixel[12]] < c_b)
2552 if( p[pixel[13]] < c_b)
2553 if( p[pixel[14]] < c_b)
2554 if( p[pixel[15]] < c_b)
2557 if( p[pixel[6]] < c_b)
2558 if( p[pixel[7]] < c_b)
2559 if( p[pixel[8]] < c_b)
2562 goto is_not_a_corner;
2564 goto is_not_a_corner;
2566 goto is_not_a_corner;
2568 if( p[pixel[5]] < c_b)
2569 if( p[pixel[6]] < c_b)
2570 if( p[pixel[7]] < c_b)
2571 if( p[pixel[8]] < c_b)
2574 goto is_not_a_corner;
2576 goto is_not_a_corner;
2578 goto is_not_a_corner;
2580 goto is_not_a_corner;
2582 if( p[pixel[4]] < c_b)
2583 if( p[pixel[5]] < c_b)
2584 if( p[pixel[6]] < c_b)
2585 if( p[pixel[7]] < c_b)
2586 if( p[pixel[8]] < c_b)
2589 goto is_not_a_corner;
2591 goto is_not_a_corner;
2593 goto is_not_a_corner;
2595 goto is_not_a_corner;
2597 goto is_not_a_corner;
2599 if( p[pixel[3]] < c_b)
2600 if( p[pixel[4]] < c_b)
2601 if( p[pixel[5]] < c_b)
2602 if( p[pixel[6]] < c_b)
2603 if( p[pixel[7]] < c_b)
2604 if( p[pixel[8]] < c_b)
2607 goto is_not_a_corner;
2609 goto is_not_a_corner;
2611 goto is_not_a_corner;
2613 goto is_not_a_corner;
2615 goto is_not_a_corner;
2617 goto is_not_a_corner;
2619 goto is_not_a_corner;
2621 goto is_not_a_corner;
2623 goto is_not_a_corner;
2625 if( p[pixel[8]] > cb)
2626 if( p[pixel[7]] > cb)
2627 if( p[pixel[9]] > cb)
2628 if( p[pixel[10]] > cb)
2629 if( p[pixel[6]] > cb)
2630 if( p[pixel[5]] > cb)
2631 if( p[pixel[4]] > cb)
2632 if( p[pixel[3]] > cb)
2633 if( p[pixel[2]] > cb)
2636 if( p[pixel[11]] > cb)
2639 goto is_not_a_corner;
2641 if( p[pixel[11]] > cb)
2642 if( p[pixel[12]] > cb)
2645 goto is_not_a_corner;
2647 goto is_not_a_corner;
2649 if( p[pixel[11]] > cb)
2650 if( p[pixel[12]] > cb)
2651 if( p[pixel[13]] > cb)
2654 goto is_not_a_corner;
2656 goto is_not_a_corner;
2658 goto is_not_a_corner;
2660 if( p[pixel[11]] > cb)
2661 if( p[pixel[12]] > cb)
2662 if( p[pixel[13]] > cb)
2663 if( p[pixel[14]] > cb)
2666 goto is_not_a_corner;
2668 goto is_not_a_corner;
2670 goto is_not_a_corner;
2672 goto is_not_a_corner;
2674 if( p[pixel[11]] > cb)
2675 if( p[pixel[12]] > cb)
2676 if( p[pixel[13]] > cb)
2677 if( p[pixel[14]] > cb)
2678 if( p[pixel[15]] > cb)
2681 goto is_not_a_corner;
2683 goto is_not_a_corner;
2685 goto is_not_a_corner;
2687 goto is_not_a_corner;
2689 goto is_not_a_corner;
2691 goto is_not_a_corner;
2693 goto is_not_a_corner;
2695 goto is_not_a_corner;
2696 else if( p[pixel[8]] < c_b)
2697 if( p[pixel[9]] < c_b)
2698 if( p[pixel[10]] < c_b)
2699 if( p[pixel[11]] < c_b)
2700 if( p[pixel[12]] < c_b)
2701 if( p[pixel[13]] < c_b)
2702 if( p[pixel[14]] < c_b)
2703 if( p[pixel[15]] < c_b)
2706 if( p[pixel[6]] < c_b)
2707 if( p[pixel[7]] < c_b)
2710 goto is_not_a_corner;
2712 goto is_not_a_corner;
2714 if( p[pixel[5]] < c_b)
2715 if( p[pixel[6]] < c_b)
2716 if( p[pixel[7]] < c_b)
2719 goto is_not_a_corner;
2721 goto is_not_a_corner;
2723 goto is_not_a_corner;
2725 if( p[pixel[4]] < c_b)
2726 if( p[pixel[5]] < c_b)
2727 if( p[pixel[6]] < c_b)
2728 if( p[pixel[7]] < c_b)
2731 goto is_not_a_corner;
2733 goto is_not_a_corner;
2735 goto is_not_a_corner;
2737 goto is_not_a_corner;
2739 if( p[pixel[3]] < c_b)
2740 if( p[pixel[4]] < c_b)
2741 if( p[pixel[5]] < c_b)
2742 if( p[pixel[6]] < c_b)
2743 if( p[pixel[7]] < c_b)
2746 goto is_not_a_corner;
2748 goto is_not_a_corner;
2750 goto is_not_a_corner;
2752 goto is_not_a_corner;
2754 goto is_not_a_corner;
2756 if( p[pixel[2]] < c_b)
2757 if( p[pixel[3]] < c_b)
2758 if( p[pixel[4]] < c_b)
2759 if( p[pixel[5]] < c_b)
2760 if( p[pixel[6]] < c_b)
2761 if( p[pixel[7]] < c_b)
2764 goto is_not_a_corner;
2766 goto is_not_a_corner;
2768 goto is_not_a_corner;
2770 goto is_not_a_corner;
2772 goto is_not_a_corner;
2774 goto is_not_a_corner;
2776 goto is_not_a_corner;
2778 goto is_not_a_corner;
2780 goto is_not_a_corner;
2782 if( p[pixel[7]] > cb)
2783 if( p[pixel[8]] > cb)
2784 if( p[pixel[9]] > cb)
2785 if( p[pixel[6]] > cb)
2786 if( p[pixel[5]] > cb)
2787 if( p[pixel[4]] > cb)
2788 if( p[pixel[3]] > cb)
2789 if( p[pixel[2]] > cb)
2790 if( p[pixel[1]] > cb)
2793 if( p[pixel[10]] > cb)
2796 goto is_not_a_corner;
2798 if( p[pixel[10]] > cb)
2799 if( p[pixel[11]] > cb)
2802 goto is_not_a_corner;
2804 goto is_not_a_corner;
2806 if( p[pixel[10]] > cb)
2807 if( p[pixel[11]] > cb)
2808 if( p[pixel[12]] > cb)
2811 goto is_not_a_corner;
2813 goto is_not_a_corner;
2815 goto is_not_a_corner;
2817 if( p[pixel[10]] > cb)
2818 if( p[pixel[11]] > cb)
2819 if( p[pixel[12]] > cb)
2820 if( p[pixel[13]] > cb)
2823 goto is_not_a_corner;
2825 goto is_not_a_corner;
2827 goto is_not_a_corner;
2829 goto is_not_a_corner;
2831 if( p[pixel[10]] > cb)
2832 if( p[pixel[11]] > cb)
2833 if( p[pixel[12]] > cb)
2834 if( p[pixel[13]] > cb)
2835 if( p[pixel[14]] > cb)
2838 goto is_not_a_corner;
2840 goto is_not_a_corner;
2842 goto is_not_a_corner;
2844 goto is_not_a_corner;
2846 goto is_not_a_corner;
2848 if( p[pixel[10]] > cb)
2849 if( p[pixel[11]] > cb)
2850 if( p[pixel[12]] > cb)
2851 if( p[pixel[13]] > cb)
2852 if( p[pixel[14]] > cb)
2853 if( p[pixel[15]] > cb)
2856 goto is_not_a_corner;
2858 goto is_not_a_corner;
2860 goto is_not_a_corner;
2862 goto is_not_a_corner;
2864 goto is_not_a_corner;
2866 goto is_not_a_corner;
2868 goto is_not_a_corner;
2870 goto is_not_a_corner;
2871 else if( p[pixel[7]] < c_b)
2872 if( p[pixel[8]] < c_b)
2873 if( p[pixel[9]] < c_b)
2874 if( p[pixel[6]] < c_b)
2875 if( p[pixel[5]] < c_b)
2876 if( p[pixel[4]] < c_b)
2877 if( p[pixel[3]] < c_b)
2878 if( p[pixel[2]] < c_b)
2879 if( p[pixel[1]] < c_b)
2882 if( p[pixel[10]] < c_b)
2885 goto is_not_a_corner;
2887 if( p[pixel[10]] < c_b)
2888 if( p[pixel[11]] < c_b)
2891 goto is_not_a_corner;
2893 goto is_not_a_corner;
2895 if( p[pixel[10]] < c_b)
2896 if( p[pixel[11]] < c_b)
2897 if( p[pixel[12]] < c_b)
2900 goto is_not_a_corner;
2902 goto is_not_a_corner;
2904 goto is_not_a_corner;
2906 if( p[pixel[10]] < c_b)
2907 if( p[pixel[11]] < c_b)
2908 if( p[pixel[12]] < c_b)
2909 if( p[pixel[13]] < c_b)
2912 goto is_not_a_corner;
2914 goto is_not_a_corner;
2916 goto is_not_a_corner;
2918 goto is_not_a_corner;
2920 if( p[pixel[10]] < c_b)
2921 if( p[pixel[11]] < c_b)
2922 if( p[pixel[12]] < c_b)
2923 if( p[pixel[13]] < c_b)
2924 if( p[pixel[14]] < c_b)
2927 goto is_not_a_corner;
2929 goto is_not_a_corner;
2931 goto is_not_a_corner;
2933 goto is_not_a_corner;
2935 goto is_not_a_corner;
2937 if( p[pixel[10]] < c_b)
2938 if( p[pixel[11]] < c_b)
2939 if( p[pixel[12]] < c_b)
2940 if( p[pixel[13]] < c_b)
2941 if( p[pixel[14]] < c_b)
2942 if( p[pixel[15]] < c_b)
2945 goto is_not_a_corner;
2947 goto is_not_a_corner;
2949 goto is_not_a_corner;
2951 goto is_not_a_corner;
2953 goto is_not_a_corner;
2955 goto is_not_a_corner;
2957 goto is_not_a_corner;
2959 goto is_not_a_corner;
2961 goto is_not_a_corner;
2973 if(bmin == bmax - 1 || bmin == bmax)
2975 b = (bmin + bmax) / 2;
2979 static void makeOffsets(int pixel[], int row_stride)
2981 pixel[0] = 0 + row_stride * 3;
2982 pixel[1] = 1 + row_stride * 3;
2983 pixel[2] = 2 + row_stride * 2;
2984 pixel[3] = 3 + row_stride * 1;
2985 pixel[4] = 3 + row_stride * 0;
2986 pixel[5] = 3 + row_stride * -1;
2987 pixel[6] = 2 + row_stride * -2;
2988 pixel[7] = 1 + row_stride * -3;
2989 pixel[8] = 0 + row_stride * -3;
2990 pixel[9] = -1 + row_stride * -3;
2991 pixel[10] = -2 + row_stride * -2;
2992 pixel[11] = -3 + row_stride * -1;
2993 pixel[12] = -3 + row_stride * 0;
2994 pixel[13] = -3 + row_stride * 1;
2995 pixel[14] = -2 + row_stride * 2;
2996 pixel[15] = -1 + row_stride * 3;
3000 static void fast9ComputeScores(const Mat& img, vector<Point>& corners, vector<int>& scores, int b)
3003 makeOffsets(pixel, img.step);
3004 size_t n, num_corners = corners.size();
3006 scores.resize(num_corners);
3007 for(n=0; n < num_corners; n++)
3008 scores[n] = fast9CornerScore(&img.at<uchar>(corners[n]), pixel, b);
3012 static void fast9Detect(const Mat& img, vector<Point>& ret_corners, int b)
3014 int xsize = img.cols, ysize = img.rows;
3016 makeOffsets(pixel, img.step);
3018 ret_corners.reserve(512);
3020 for(int y=3; y < ysize - 3; y++)
3021 for(int x=3; x < xsize - 3; x++)
3023 const uchar* p = &img.at<uchar>(y,x);
3027 if(p[pixel[0]] > cb)
3028 if(p[pixel[1]] > cb)
3029 if(p[pixel[2]] > cb)
3030 if(p[pixel[3]] > cb)
3031 if(p[pixel[4]] > cb)
3032 if(p[pixel[5]] > cb)
3033 if(p[pixel[6]] > cb)
3034 if(p[pixel[7]] > cb)
3035 if(p[pixel[8]] > cb)
3038 if(p[pixel[15]] > cb)
3042 else if(p[pixel[7]] < c_b)
3043 if(p[pixel[14]] > cb)
3044 if(p[pixel[15]] > cb)
3048 else if(p[pixel[14]] < c_b)
3049 if(p[pixel[8]] < c_b)
3050 if(p[pixel[9]] < c_b)
3051 if(p[pixel[10]] < c_b)
3052 if(p[pixel[11]] < c_b)
3053 if(p[pixel[12]] < c_b)
3054 if(p[pixel[13]] < c_b)
3055 if(p[pixel[15]] < c_b)
3074 if(p[pixel[14]] > cb)
3075 if(p[pixel[15]] > cb)
3081 else if(p[pixel[6]] < c_b)
3082 if(p[pixel[15]] > cb)
3083 if(p[pixel[13]] > cb)
3084 if(p[pixel[14]] > cb)
3088 else if(p[pixel[13]] < c_b)
3089 if(p[pixel[7]] < c_b)
3090 if(p[pixel[8]] < c_b)
3091 if(p[pixel[9]] < c_b)
3092 if(p[pixel[10]] < c_b)
3093 if(p[pixel[11]] < c_b)
3094 if(p[pixel[12]] < c_b)
3095 if(p[pixel[14]] < c_b)
3114 if(p[pixel[7]] < c_b)
3115 if(p[pixel[8]] < c_b)
3116 if(p[pixel[9]] < c_b)
3117 if(p[pixel[10]] < c_b)
3118 if(p[pixel[11]] < c_b)
3119 if(p[pixel[12]] < c_b)
3120 if(p[pixel[13]] < c_b)
3121 if(p[pixel[14]] < c_b)
3140 if(p[pixel[13]] > cb)
3141 if(p[pixel[14]] > cb)
3142 if(p[pixel[15]] > cb)
3148 else if(p[pixel[13]] < c_b)
3149 if(p[pixel[7]] < c_b)
3150 if(p[pixel[8]] < c_b)
3151 if(p[pixel[9]] < c_b)
3152 if(p[pixel[10]] < c_b)
3153 if(p[pixel[11]] < c_b)
3154 if(p[pixel[12]] < c_b)
3155 if(p[pixel[14]] < c_b)
3156 if(p[pixel[15]] < c_b)
3176 else if(p[pixel[5]] < c_b)
3177 if(p[pixel[14]] > cb)
3178 if(p[pixel[12]] > cb)
3179 if(p[pixel[13]] > cb)
3180 if(p[pixel[15]] > cb)
3183 if(p[pixel[6]] > cb)
3184 if(p[pixel[7]] > cb)
3185 if(p[pixel[8]] > cb)
3186 if(p[pixel[9]] > cb)
3187 if(p[pixel[10]] > cb)
3188 if(p[pixel[11]] > cb)
3204 else if(p[pixel[12]] < c_b)
3205 if(p[pixel[6]] < c_b)
3206 if(p[pixel[7]] < c_b)
3207 if(p[pixel[8]] < c_b)
3208 if(p[pixel[9]] < c_b)
3209 if(p[pixel[10]] < c_b)
3210 if(p[pixel[11]] < c_b)
3211 if(p[pixel[13]] < c_b)
3229 else if(p[pixel[14]] < c_b)
3230 if(p[pixel[7]] < c_b)
3231 if(p[pixel[8]] < c_b)
3232 if(p[pixel[9]] < c_b)
3233 if(p[pixel[10]] < c_b)
3234 if(p[pixel[11]] < c_b)
3235 if(p[pixel[12]] < c_b)
3236 if(p[pixel[13]] < c_b)
3237 if(p[pixel[6]] < c_b)
3240 if(p[pixel[15]] < c_b)
3259 if(p[pixel[6]] < c_b)
3260 if(p[pixel[7]] < c_b)
3261 if(p[pixel[8]] < c_b)
3262 if(p[pixel[9]] < c_b)
3263 if(p[pixel[10]] < c_b)
3264 if(p[pixel[11]] < c_b)
3265 if(p[pixel[12]] < c_b)
3266 if(p[pixel[13]] < c_b)
3285 if(p[pixel[12]] > cb)
3286 if(p[pixel[13]] > cb)
3287 if(p[pixel[14]] > cb)
3288 if(p[pixel[15]] > cb)
3291 if(p[pixel[6]] > cb)
3292 if(p[pixel[7]] > cb)
3293 if(p[pixel[8]] > cb)
3294 if(p[pixel[9]] > cb)
3295 if(p[pixel[10]] > cb)
3296 if(p[pixel[11]] > cb)
3314 else if(p[pixel[12]] < c_b)
3315 if(p[pixel[7]] < c_b)
3316 if(p[pixel[8]] < c_b)
3317 if(p[pixel[9]] < c_b)
3318 if(p[pixel[10]] < c_b)
3319 if(p[pixel[11]] < c_b)
3320 if(p[pixel[13]] < c_b)
3321 if(p[pixel[14]] < c_b)
3322 if(p[pixel[6]] < c_b)
3325 if(p[pixel[15]] < c_b)
3345 else if(p[pixel[4]] < c_b)
3346 if(p[pixel[13]] > cb)
3347 if(p[pixel[11]] > cb)
3348 if(p[pixel[12]] > cb)
3349 if(p[pixel[14]] > cb)
3350 if(p[pixel[15]] > cb)
3353 if(p[pixel[6]] > cb)
3354 if(p[pixel[7]] > cb)
3355 if(p[pixel[8]] > cb)
3356 if(p[pixel[9]] > cb)
3357 if(p[pixel[10]] > cb)
3370 if(p[pixel[5]] > cb)
3371 if(p[pixel[6]] > cb)
3372 if(p[pixel[7]] > cb)
3373 if(p[pixel[8]] > cb)
3374 if(p[pixel[9]] > cb)
3375 if(p[pixel[10]] > cb)
3391 else if(p[pixel[11]] < c_b)
3392 if(p[pixel[5]] < c_b)
3393 if(p[pixel[6]] < c_b)
3394 if(p[pixel[7]] < c_b)
3395 if(p[pixel[8]] < c_b)
3396 if(p[pixel[9]] < c_b)
3397 if(p[pixel[10]] < c_b)
3398 if(p[pixel[12]] < c_b)
3416 else if(p[pixel[13]] < c_b)
3417 if(p[pixel[7]] < c_b)
3418 if(p[pixel[8]] < c_b)
3419 if(p[pixel[9]] < c_b)
3420 if(p[pixel[10]] < c_b)
3421 if(p[pixel[11]] < c_b)
3422 if(p[pixel[12]] < c_b)
3423 if(p[pixel[6]] < c_b)
3424 if(p[pixel[5]] < c_b)
3427 if(p[pixel[14]] < c_b)
3432 if(p[pixel[14]] < c_b)
3433 if(p[pixel[15]] < c_b)
3452 if(p[pixel[5]] < c_b)
3453 if(p[pixel[6]] < c_b)
3454 if(p[pixel[7]] < c_b)
3455 if(p[pixel[8]] < c_b)
3456 if(p[pixel[9]] < c_b)
3457 if(p[pixel[10]] < c_b)
3458 if(p[pixel[11]] < c_b)
3459 if(p[pixel[12]] < c_b)
3478 if(p[pixel[11]] > cb)
3479 if(p[pixel[12]] > cb)
3480 if(p[pixel[13]] > cb)
3481 if(p[pixel[14]] > cb)
3482 if(p[pixel[15]] > cb)
3485 if(p[pixel[6]] > cb)
3486 if(p[pixel[7]] > cb)
3487 if(p[pixel[8]] > cb)
3488 if(p[pixel[9]] > cb)
3489 if(p[pixel[10]] > cb)
3502 if(p[pixel[5]] > cb)
3503 if(p[pixel[6]] > cb)
3504 if(p[pixel[7]] > cb)
3505 if(p[pixel[8]] > cb)
3506 if(p[pixel[9]] > cb)
3507 if(p[pixel[10]] > cb)
3525 else if(p[pixel[11]] < c_b)
3526 if(p[pixel[7]] < c_b)
3527 if(p[pixel[8]] < c_b)
3528 if(p[pixel[9]] < c_b)
3529 if(p[pixel[10]] < c_b)
3530 if(p[pixel[12]] < c_b)
3531 if(p[pixel[13]] < c_b)
3532 if(p[pixel[6]] < c_b)
3533 if(p[pixel[5]] < c_b)
3536 if(p[pixel[14]] < c_b)
3541 if(p[pixel[14]] < c_b)
3542 if(p[pixel[15]] < c_b)
3562 else if(p[pixel[3]] < c_b)
3563 if(p[pixel[10]] > cb)
3564 if(p[pixel[11]] > cb)
3565 if(p[pixel[12]] > cb)
3566 if(p[pixel[13]] > cb)
3567 if(p[pixel[14]] > cb)
3568 if(p[pixel[15]] > cb)
3571 if(p[pixel[6]] > cb)
3572 if(p[pixel[7]] > cb)
3573 if(p[pixel[8]] > cb)
3574 if(p[pixel[9]] > cb)
3585 if(p[pixel[5]] > cb)
3586 if(p[pixel[6]] > cb)
3587 if(p[pixel[7]] > cb)
3588 if(p[pixel[8]] > cb)
3589 if(p[pixel[9]] > cb)
3602 if(p[pixel[4]] > cb)
3603 if(p[pixel[5]] > cb)
3604 if(p[pixel[6]] > cb)
3605 if(p[pixel[7]] > cb)
3606 if(p[pixel[8]] > cb)
3607 if(p[pixel[9]] > cb)
3625 else if(p[pixel[10]] < c_b)
3626 if(p[pixel[7]] < c_b)
3627 if(p[pixel[8]] < c_b)
3628 if(p[pixel[9]] < c_b)
3629 if(p[pixel[11]] < c_b)
3630 if(p[pixel[6]] < c_b)
3631 if(p[pixel[5]] < c_b)
3632 if(p[pixel[4]] < c_b)
3635 if(p[pixel[12]] < c_b)
3636 if(p[pixel[13]] < c_b)
3643 if(p[pixel[12]] < c_b)
3644 if(p[pixel[13]] < c_b)
3645 if(p[pixel[14]] < c_b)
3654 if(p[pixel[12]] < c_b)
3655 if(p[pixel[13]] < c_b)
3656 if(p[pixel[14]] < c_b)
3657 if(p[pixel[15]] < c_b)
3678 if(p[pixel[10]] > cb)
3679 if(p[pixel[11]] > cb)
3680 if(p[pixel[12]] > cb)
3681 if(p[pixel[13]] > cb)
3682 if(p[pixel[14]] > cb)
3683 if(p[pixel[15]] > cb)
3686 if(p[pixel[6]] > cb)
3687 if(p[pixel[7]] > cb)
3688 if(p[pixel[8]] > cb)
3689 if(p[pixel[9]] > cb)
3700 if(p[pixel[5]] > cb)
3701 if(p[pixel[6]] > cb)
3702 if(p[pixel[7]] > cb)
3703 if(p[pixel[8]] > cb)
3704 if(p[pixel[9]] > cb)
3717 if(p[pixel[4]] > cb)
3718 if(p[pixel[5]] > cb)
3719 if(p[pixel[6]] > cb)
3720 if(p[pixel[7]] > cb)
3721 if(p[pixel[8]] > cb)
3722 if(p[pixel[9]] > cb)
3740 else if(p[pixel[10]] < c_b)
3741 if(p[pixel[7]] < c_b)
3742 if(p[pixel[8]] < c_b)
3743 if(p[pixel[9]] < c_b)
3744 if(p[pixel[11]] < c_b)
3745 if(p[pixel[12]] < c_b)
3746 if(p[pixel[6]] < c_b)
3747 if(p[pixel[5]] < c_b)
3748 if(p[pixel[4]] < c_b)
3751 if(p[pixel[13]] < c_b)
3756 if(p[pixel[13]] < c_b)
3757 if(p[pixel[14]] < c_b)
3764 if(p[pixel[13]] < c_b)
3765 if(p[pixel[14]] < c_b)
3766 if(p[pixel[15]] < c_b)
3786 else if(p[pixel[2]] < c_b)
3787 if(p[pixel[9]] > cb)
3788 if(p[pixel[10]] > cb)
3789 if(p[pixel[11]] > cb)
3790 if(p[pixel[12]] > cb)
3791 if(p[pixel[13]] > cb)
3792 if(p[pixel[14]] > cb)
3793 if(p[pixel[15]] > cb)
3796 if(p[pixel[6]] > cb)
3797 if(p[pixel[7]] > cb)
3798 if(p[pixel[8]] > cb)
3807 if(p[pixel[5]] > cb)
3808 if(p[pixel[6]] > cb)
3809 if(p[pixel[7]] > cb)
3810 if(p[pixel[8]] > cb)
3821 if(p[pixel[4]] > cb)
3822 if(p[pixel[5]] > cb)
3823 if(p[pixel[6]] > cb)
3824 if(p[pixel[7]] > cb)
3825 if(p[pixel[8]] > cb)
3838 if(p[pixel[3]] > cb)
3839 if(p[pixel[4]] > cb)
3840 if(p[pixel[5]] > cb)
3841 if(p[pixel[6]] > cb)
3842 if(p[pixel[7]] > cb)
3843 if(p[pixel[8]] > cb)
3861 else if(p[pixel[9]] < c_b)
3862 if(p[pixel[7]] < c_b)
3863 if(p[pixel[8]] < c_b)
3864 if(p[pixel[10]] < c_b)
3865 if(p[pixel[6]] < c_b)
3866 if(p[pixel[5]] < c_b)
3867 if(p[pixel[4]] < c_b)
3868 if(p[pixel[3]] < c_b)
3871 if(p[pixel[11]] < c_b)
3872 if(p[pixel[12]] < c_b)
3879 if(p[pixel[11]] < c_b)
3880 if(p[pixel[12]] < c_b)
3881 if(p[pixel[13]] < c_b)
3890 if(p[pixel[11]] < c_b)
3891 if(p[pixel[12]] < c_b)
3892 if(p[pixel[13]] < c_b)
3893 if(p[pixel[14]] < c_b)
3904 if(p[pixel[11]] < c_b)
3905 if(p[pixel[12]] < c_b)
3906 if(p[pixel[13]] < c_b)
3907 if(p[pixel[14]] < c_b)
3908 if(p[pixel[15]] < c_b)
3929 if(p[pixel[9]] > cb)
3930 if(p[pixel[10]] > cb)
3931 if(p[pixel[11]] > cb)
3932 if(p[pixel[12]] > cb)
3933 if(p[pixel[13]] > cb)
3934 if(p[pixel[14]] > cb)
3935 if(p[pixel[15]] > cb)
3938 if(p[pixel[6]] > cb)
3939 if(p[pixel[7]] > cb)
3940 if(p[pixel[8]] > cb)
3949 if(p[pixel[5]] > cb)
3950 if(p[pixel[6]] > cb)
3951 if(p[pixel[7]] > cb)
3952 if(p[pixel[8]] > cb)
3963 if(p[pixel[4]] > cb)
3964 if(p[pixel[5]] > cb)
3965 if(p[pixel[6]] > cb)
3966 if(p[pixel[7]] > cb)
3967 if(p[pixel[8]] > cb)
3980 if(p[pixel[3]] > cb)
3981 if(p[pixel[4]] > cb)
3982 if(p[pixel[5]] > cb)
3983 if(p[pixel[6]] > cb)
3984 if(p[pixel[7]] > cb)
3985 if(p[pixel[8]] > cb)
4003 else if(p[pixel[9]] < c_b)
4004 if(p[pixel[7]] < c_b)
4005 if(p[pixel[8]] < c_b)
4006 if(p[pixel[10]] < c_b)
4007 if(p[pixel[11]] < c_b)
4008 if(p[pixel[6]] < c_b)
4009 if(p[pixel[5]] < c_b)
4010 if(p[pixel[4]] < c_b)
4011 if(p[pixel[3]] < c_b)
4014 if(p[pixel[12]] < c_b)
4019 if(p[pixel[12]] < c_b)
4020 if(p[pixel[13]] < c_b)
4027 if(p[pixel[12]] < c_b)
4028 if(p[pixel[13]] < c_b)
4029 if(p[pixel[14]] < c_b)
4038 if(p[pixel[12]] < c_b)
4039 if(p[pixel[13]] < c_b)
4040 if(p[pixel[14]] < c_b)
4041 if(p[pixel[15]] < c_b)
4061 else if(p[pixel[1]] < c_b)
4062 if(p[pixel[8]] > cb)
4063 if(p[pixel[9]] > cb)
4064 if(p[pixel[10]] > cb)
4065 if(p[pixel[11]] > cb)
4066 if(p[pixel[12]] > cb)
4067 if(p[pixel[13]] > cb)
4068 if(p[pixel[14]] > cb)
4069 if(p[pixel[15]] > cb)
4072 if(p[pixel[6]] > cb)
4073 if(p[pixel[7]] > cb)
4080 if(p[pixel[5]] > cb)
4081 if(p[pixel[6]] > cb)
4082 if(p[pixel[7]] > cb)
4091 if(p[pixel[4]] > cb)
4092 if(p[pixel[5]] > cb)
4093 if(p[pixel[6]] > cb)
4094 if(p[pixel[7]] > cb)
4105 if(p[pixel[3]] > cb)
4106 if(p[pixel[4]] > cb)
4107 if(p[pixel[5]] > cb)
4108 if(p[pixel[6]] > cb)
4109 if(p[pixel[7]] > cb)
4122 if(p[pixel[2]] > cb)
4123 if(p[pixel[3]] > cb)
4124 if(p[pixel[4]] > cb)
4125 if(p[pixel[5]] > cb)
4126 if(p[pixel[6]] > cb)
4127 if(p[pixel[7]] > cb)
4145 else if(p[pixel[8]] < c_b)
4146 if(p[pixel[7]] < c_b)
4147 if(p[pixel[9]] < c_b)
4148 if(p[pixel[6]] < c_b)
4149 if(p[pixel[5]] < c_b)
4150 if(p[pixel[4]] < c_b)
4151 if(p[pixel[3]] < c_b)
4152 if(p[pixel[2]] < c_b)
4155 if(p[pixel[10]] < c_b)
4156 if(p[pixel[11]] < c_b)
4163 if(p[pixel[10]] < c_b)
4164 if(p[pixel[11]] < c_b)
4165 if(p[pixel[12]] < c_b)
4174 if(p[pixel[10]] < c_b)
4175 if(p[pixel[11]] < c_b)
4176 if(p[pixel[12]] < c_b)
4177 if(p[pixel[13]] < c_b)
4188 if(p[pixel[10]] < c_b)
4189 if(p[pixel[11]] < c_b)
4190 if(p[pixel[12]] < c_b)
4191 if(p[pixel[13]] < c_b)
4192 if(p[pixel[14]] < c_b)
4205 if(p[pixel[10]] < c_b)
4206 if(p[pixel[11]] < c_b)
4207 if(p[pixel[12]] < c_b)
4208 if(p[pixel[13]] < c_b)
4209 if(p[pixel[14]] < c_b)
4210 if(p[pixel[15]] < c_b)
4231 if(p[pixel[8]] > cb)
4232 if(p[pixel[9]] > cb)
4233 if(p[pixel[10]] > cb)
4234 if(p[pixel[11]] > cb)
4235 if(p[pixel[12]] > cb)
4236 if(p[pixel[13]] > cb)
4237 if(p[pixel[14]] > cb)
4238 if(p[pixel[15]] > cb)
4241 if(p[pixel[6]] > cb)
4242 if(p[pixel[7]] > cb)
4249 if(p[pixel[5]] > cb)
4250 if(p[pixel[6]] > cb)
4251 if(p[pixel[7]] > cb)
4260 if(p[pixel[4]] > cb)
4261 if(p[pixel[5]] > cb)
4262 if(p[pixel[6]] > cb)
4263 if(p[pixel[7]] > cb)
4274 if(p[pixel[3]] > cb)
4275 if(p[pixel[4]] > cb)
4276 if(p[pixel[5]] > cb)
4277 if(p[pixel[6]] > cb)
4278 if(p[pixel[7]] > cb)
4291 if(p[pixel[2]] > cb)
4292 if(p[pixel[3]] > cb)
4293 if(p[pixel[4]] > cb)
4294 if(p[pixel[5]] > cb)
4295 if(p[pixel[6]] > cb)
4296 if(p[pixel[7]] > cb)
4314 else if(p[pixel[8]] < c_b)
4315 if(p[pixel[7]] < c_b)
4316 if(p[pixel[9]] < c_b)
4317 if(p[pixel[10]] < c_b)
4318 if(p[pixel[6]] < c_b)
4319 if(p[pixel[5]] < c_b)
4320 if(p[pixel[4]] < c_b)
4321 if(p[pixel[3]] < c_b)
4322 if(p[pixel[2]] < c_b)
4325 if(p[pixel[11]] < c_b)
4330 if(p[pixel[11]] < c_b)
4331 if(p[pixel[12]] < c_b)
4338 if(p[pixel[11]] < c_b)
4339 if(p[pixel[12]] < c_b)
4340 if(p[pixel[13]] < c_b)
4349 if(p[pixel[11]] < c_b)
4350 if(p[pixel[12]] < c_b)
4351 if(p[pixel[13]] < c_b)
4352 if(p[pixel[14]] < c_b)
4363 if(p[pixel[11]] < c_b)
4364 if(p[pixel[12]] < c_b)
4365 if(p[pixel[13]] < c_b)
4366 if(p[pixel[14]] < c_b)
4367 if(p[pixel[15]] < c_b)
4387 else if(p[pixel[0]] < c_b)
4388 if(p[pixel[1]] > cb)
4389 if(p[pixel[8]] > cb)
4390 if(p[pixel[7]] > cb)
4391 if(p[pixel[9]] > cb)
4392 if(p[pixel[6]] > cb)
4393 if(p[pixel[5]] > cb)
4394 if(p[pixel[4]] > cb)
4395 if(p[pixel[3]] > cb)
4396 if(p[pixel[2]] > cb)
4399 if(p[pixel[10]] > cb)
4400 if(p[pixel[11]] > cb)
4407 if(p[pixel[10]] > cb)
4408 if(p[pixel[11]] > cb)
4409 if(p[pixel[12]] > cb)
4418 if(p[pixel[10]] > cb)
4419 if(p[pixel[11]] > cb)
4420 if(p[pixel[12]] > cb)
4421 if(p[pixel[13]] > cb)
4432 if(p[pixel[10]] > cb)
4433 if(p[pixel[11]] > cb)
4434 if(p[pixel[12]] > cb)
4435 if(p[pixel[13]] > cb)
4436 if(p[pixel[14]] > cb)
4449 if(p[pixel[10]] > cb)
4450 if(p[pixel[11]] > cb)
4451 if(p[pixel[12]] > cb)
4452 if(p[pixel[13]] > cb)
4453 if(p[pixel[14]] > cb)
4454 if(p[pixel[15]] > cb)
4472 else if(p[pixel[8]] < c_b)
4473 if(p[pixel[9]] < c_b)
4474 if(p[pixel[10]] < c_b)
4475 if(p[pixel[11]] < c_b)
4476 if(p[pixel[12]] < c_b)
4477 if(p[pixel[13]] < c_b)
4478 if(p[pixel[14]] < c_b)
4479 if(p[pixel[15]] < c_b)
4482 if(p[pixel[6]] < c_b)
4483 if(p[pixel[7]] < c_b)
4490 if(p[pixel[5]] < c_b)
4491 if(p[pixel[6]] < c_b)
4492 if(p[pixel[7]] < c_b)
4501 if(p[pixel[4]] < c_b)
4502 if(p[pixel[5]] < c_b)
4503 if(p[pixel[6]] < c_b)
4504 if(p[pixel[7]] < c_b)
4515 if(p[pixel[3]] < c_b)
4516 if(p[pixel[4]] < c_b)
4517 if(p[pixel[5]] < c_b)
4518 if(p[pixel[6]] < c_b)
4519 if(p[pixel[7]] < c_b)
4532 if(p[pixel[2]] < c_b)
4533 if(p[pixel[3]] < c_b)
4534 if(p[pixel[4]] < c_b)
4535 if(p[pixel[5]] < c_b)
4536 if(p[pixel[6]] < c_b)
4537 if(p[pixel[7]] < c_b)
4557 else if(p[pixel[1]] < c_b)
4558 if(p[pixel[2]] > cb)
4559 if(p[pixel[9]] > cb)
4560 if(p[pixel[7]] > cb)
4561 if(p[pixel[8]] > cb)
4562 if(p[pixel[10]] > cb)
4563 if(p[pixel[6]] > cb)
4564 if(p[pixel[5]] > cb)
4565 if(p[pixel[4]] > cb)
4566 if(p[pixel[3]] > cb)
4569 if(p[pixel[11]] > cb)
4570 if(p[pixel[12]] > cb)
4577 if(p[pixel[11]] > cb)
4578 if(p[pixel[12]] > cb)
4579 if(p[pixel[13]] > cb)
4588 if(p[pixel[11]] > cb)
4589 if(p[pixel[12]] > cb)
4590 if(p[pixel[13]] > cb)
4591 if(p[pixel[14]] > cb)
4602 if(p[pixel[11]] > cb)
4603 if(p[pixel[12]] > cb)
4604 if(p[pixel[13]] > cb)
4605 if(p[pixel[14]] > cb)
4606 if(p[pixel[15]] > cb)
4624 else if(p[pixel[9]] < c_b)
4625 if(p[pixel[10]] < c_b)
4626 if(p[pixel[11]] < c_b)
4627 if(p[pixel[12]] < c_b)
4628 if(p[pixel[13]] < c_b)
4629 if(p[pixel[14]] < c_b)
4630 if(p[pixel[15]] < c_b)
4633 if(p[pixel[6]] < c_b)
4634 if(p[pixel[7]] < c_b)
4635 if(p[pixel[8]] < c_b)
4644 if(p[pixel[5]] < c_b)
4645 if(p[pixel[6]] < c_b)
4646 if(p[pixel[7]] < c_b)
4647 if(p[pixel[8]] < c_b)
4658 if(p[pixel[4]] < c_b)
4659 if(p[pixel[5]] < c_b)
4660 if(p[pixel[6]] < c_b)
4661 if(p[pixel[7]] < c_b)
4662 if(p[pixel[8]] < c_b)
4675 if(p[pixel[3]] < c_b)
4676 if(p[pixel[4]] < c_b)
4677 if(p[pixel[5]] < c_b)
4678 if(p[pixel[6]] < c_b)
4679 if(p[pixel[7]] < c_b)
4680 if(p[pixel[8]] < c_b)
4700 else if(p[pixel[2]] < c_b)
4701 if(p[pixel[3]] > cb)
4702 if(p[pixel[10]] > cb)
4703 if(p[pixel[7]] > cb)
4704 if(p[pixel[8]] > cb)
4705 if(p[pixel[9]] > cb)
4706 if(p[pixel[11]] > cb)
4707 if(p[pixel[6]] > cb)
4708 if(p[pixel[5]] > cb)
4709 if(p[pixel[4]] > cb)
4712 if(p[pixel[12]] > cb)
4713 if(p[pixel[13]] > cb)
4720 if(p[pixel[12]] > cb)
4721 if(p[pixel[13]] > cb)
4722 if(p[pixel[14]] > cb)
4731 if(p[pixel[12]] > cb)
4732 if(p[pixel[13]] > cb)
4733 if(p[pixel[14]] > cb)
4734 if(p[pixel[15]] > cb)
4752 else if(p[pixel[10]] < c_b)
4753 if(p[pixel[11]] < c_b)
4754 if(p[pixel[12]] < c_b)
4755 if(p[pixel[13]] < c_b)
4756 if(p[pixel[14]] < c_b)
4757 if(p[pixel[15]] < c_b)
4760 if(p[pixel[6]] < c_b)
4761 if(p[pixel[7]] < c_b)
4762 if(p[pixel[8]] < c_b)
4763 if(p[pixel[9]] < c_b)
4774 if(p[pixel[5]] < c_b)
4775 if(p[pixel[6]] < c_b)
4776 if(p[pixel[7]] < c_b)
4777 if(p[pixel[8]] < c_b)
4778 if(p[pixel[9]] < c_b)
4791 if(p[pixel[4]] < c_b)
4792 if(p[pixel[5]] < c_b)
4793 if(p[pixel[6]] < c_b)
4794 if(p[pixel[7]] < c_b)
4795 if(p[pixel[8]] < c_b)
4796 if(p[pixel[9]] < c_b)
4816 else if(p[pixel[3]] < c_b)
4817 if(p[pixel[4]] > cb)
4818 if(p[pixel[13]] > cb)
4819 if(p[pixel[7]] > cb)
4820 if(p[pixel[8]] > cb)
4821 if(p[pixel[9]] > cb)
4822 if(p[pixel[10]] > cb)
4823 if(p[pixel[11]] > cb)
4824 if(p[pixel[12]] > cb)
4825 if(p[pixel[6]] > cb)
4826 if(p[pixel[5]] > cb)
4829 if(p[pixel[14]] > cb)
4834 if(p[pixel[14]] > cb)
4835 if(p[pixel[15]] > cb)
4853 else if(p[pixel[13]] < c_b)
4854 if(p[pixel[11]] > cb)
4855 if(p[pixel[5]] > cb)
4856 if(p[pixel[6]] > cb)
4857 if(p[pixel[7]] > cb)
4858 if(p[pixel[8]] > cb)
4859 if(p[pixel[9]] > cb)
4860 if(p[pixel[10]] > cb)
4861 if(p[pixel[12]] > cb)
4877 else if(p[pixel[11]] < c_b)
4878 if(p[pixel[12]] < c_b)
4879 if(p[pixel[14]] < c_b)
4880 if(p[pixel[15]] < c_b)
4883 if(p[pixel[6]] < c_b)
4884 if(p[pixel[7]] < c_b)
4885 if(p[pixel[8]] < c_b)
4886 if(p[pixel[9]] < c_b)
4887 if(p[pixel[10]] < c_b)
4900 if(p[pixel[5]] < c_b)
4901 if(p[pixel[6]] < c_b)
4902 if(p[pixel[7]] < c_b)
4903 if(p[pixel[8]] < c_b)
4904 if(p[pixel[9]] < c_b)
4905 if(p[pixel[10]] < c_b)
4924 if(p[pixel[5]] > cb)
4925 if(p[pixel[6]] > cb)
4926 if(p[pixel[7]] > cb)
4927 if(p[pixel[8]] > cb)
4928 if(p[pixel[9]] > cb)
4929 if(p[pixel[10]] > cb)
4930 if(p[pixel[11]] > cb)
4931 if(p[pixel[12]] > cb)
4949 else if(p[pixel[4]] < c_b)
4950 if(p[pixel[5]] > cb)
4951 if(p[pixel[14]] > cb)
4952 if(p[pixel[7]] > cb)
4953 if(p[pixel[8]] > cb)
4954 if(p[pixel[9]] > cb)
4955 if(p[pixel[10]] > cb)
4956 if(p[pixel[11]] > cb)
4957 if(p[pixel[12]] > cb)
4958 if(p[pixel[13]] > cb)
4959 if(p[pixel[6]] > cb)
4962 if(p[pixel[15]] > cb)
4980 else if(p[pixel[14]] < c_b)
4981 if(p[pixel[12]] > cb)
4982 if(p[pixel[6]] > cb)
4983 if(p[pixel[7]] > cb)
4984 if(p[pixel[8]] > cb)
4985 if(p[pixel[9]] > cb)
4986 if(p[pixel[10]] > cb)
4987 if(p[pixel[11]] > cb)
4988 if(p[pixel[13]] > cb)
5004 else if(p[pixel[12]] < c_b)
5005 if(p[pixel[13]] < c_b)
5006 if(p[pixel[15]] < c_b)
5009 if(p[pixel[6]] < c_b)
5010 if(p[pixel[7]] < c_b)
5011 if(p[pixel[8]] < c_b)
5012 if(p[pixel[9]] < c_b)
5013 if(p[pixel[10]] < c_b)
5014 if(p[pixel[11]] < c_b)
5033 if(p[pixel[6]] > cb)
5034 if(p[pixel[7]] > cb)
5035 if(p[pixel[8]] > cb)
5036 if(p[pixel[9]] > cb)
5037 if(p[pixel[10]] > cb)
5038 if(p[pixel[11]] > cb)
5039 if(p[pixel[12]] > cb)
5040 if(p[pixel[13]] > cb)
5058 else if(p[pixel[5]] < c_b)
5059 if(p[pixel[6]] > cb)
5060 if(p[pixel[15]] < c_b)
5061 if(p[pixel[13]] > cb)
5062 if(p[pixel[7]] > cb)
5063 if(p[pixel[8]] > cb)
5064 if(p[pixel[9]] > cb)
5065 if(p[pixel[10]] > cb)
5066 if(p[pixel[11]] > cb)
5067 if(p[pixel[12]] > cb)
5068 if(p[pixel[14]] > cb)
5084 else if(p[pixel[13]] < c_b)
5085 if(p[pixel[14]] < c_b)
5092 if(p[pixel[7]] > cb)
5093 if(p[pixel[8]] > cb)
5094 if(p[pixel[9]] > cb)
5095 if(p[pixel[10]] > cb)
5096 if(p[pixel[11]] > cb)
5097 if(p[pixel[12]] > cb)
5098 if(p[pixel[13]] > cb)
5099 if(p[pixel[14]] > cb)
5117 else if(p[pixel[6]] < c_b)
5118 if(p[pixel[7]] > cb)
5119 if(p[pixel[14]] > cb)
5120 if(p[pixel[8]] > cb)
5121 if(p[pixel[9]] > cb)
5122 if(p[pixel[10]] > cb)
5123 if(p[pixel[11]] > cb)
5124 if(p[pixel[12]] > cb)
5125 if(p[pixel[13]] > cb)
5126 if(p[pixel[15]] > cb)
5142 else if(p[pixel[14]] < c_b)
5143 if(p[pixel[15]] < c_b)
5149 else if(p[pixel[7]] < c_b)
5150 if(p[pixel[8]] < c_b)
5153 if(p[pixel[15]] < c_b)
5158 if(p[pixel[14]] < c_b)
5159 if(p[pixel[15]] < c_b)
5166 if(p[pixel[13]] > cb)
5167 if(p[pixel[7]] > cb)
5168 if(p[pixel[8]] > cb)
5169 if(p[pixel[9]] > cb)
5170 if(p[pixel[10]] > cb)
5171 if(p[pixel[11]] > cb)
5172 if(p[pixel[12]] > cb)
5173 if(p[pixel[14]] > cb)
5174 if(p[pixel[15]] > cb)
5192 else if(p[pixel[13]] < c_b)
5193 if(p[pixel[14]] < c_b)
5194 if(p[pixel[15]] < c_b)
5203 if(p[pixel[12]] > cb)
5204 if(p[pixel[7]] > cb)
5205 if(p[pixel[8]] > cb)
5206 if(p[pixel[9]] > cb)
5207 if(p[pixel[10]] > cb)
5208 if(p[pixel[11]] > cb)
5209 if(p[pixel[13]] > cb)
5210 if(p[pixel[14]] > cb)
5211 if(p[pixel[6]] > cb)
5214 if(p[pixel[15]] > cb)
5232 else if(p[pixel[12]] < c_b)
5233 if(p[pixel[13]] < c_b)
5234 if(p[pixel[14]] < c_b)
5235 if(p[pixel[15]] < c_b)
5238 if(p[pixel[6]] < c_b)
5239 if(p[pixel[7]] < c_b)
5240 if(p[pixel[8]] < c_b)
5241 if(p[pixel[9]] < c_b)
5242 if(p[pixel[10]] < c_b)
5243 if(p[pixel[11]] < c_b)
5264 if(p[pixel[11]] > cb)
5265 if(p[pixel[7]] > cb)
5266 if(p[pixel[8]] > cb)
5267 if(p[pixel[9]] > cb)
5268 if(p[pixel[10]] > cb)
5269 if(p[pixel[12]] > cb)
5270 if(p[pixel[13]] > cb)
5271 if(p[pixel[6]] > cb)
5272 if(p[pixel[5]] > cb)
5275 if(p[pixel[14]] > cb)
5280 if(p[pixel[14]] > cb)
5281 if(p[pixel[15]] > cb)
5299 else if(p[pixel[11]] < c_b)
5300 if(p[pixel[12]] < c_b)
5301 if(p[pixel[13]] < c_b)
5302 if(p[pixel[14]] < c_b)
5303 if(p[pixel[15]] < c_b)
5306 if(p[pixel[6]] < c_b)
5307 if(p[pixel[7]] < c_b)
5308 if(p[pixel[8]] < c_b)
5309 if(p[pixel[9]] < c_b)
5310 if(p[pixel[10]] < c_b)
5323 if(p[pixel[5]] < c_b)
5324 if(p[pixel[6]] < c_b)
5325 if(p[pixel[7]] < c_b)
5326 if(p[pixel[8]] < c_b)
5327 if(p[pixel[9]] < c_b)
5328 if(p[pixel[10]] < c_b)
5349 if(p[pixel[10]] > cb)
5350 if(p[pixel[7]] > cb)
5351 if(p[pixel[8]] > cb)
5352 if(p[pixel[9]] > cb)
5353 if(p[pixel[11]] > cb)
5354 if(p[pixel[12]] > cb)
5355 if(p[pixel[6]] > cb)
5356 if(p[pixel[5]] > cb)
5357 if(p[pixel[4]] > cb)
5360 if(p[pixel[13]] > cb)
5365 if(p[pixel[13]] > cb)
5366 if(p[pixel[14]] > cb)
5373 if(p[pixel[13]] > cb)
5374 if(p[pixel[14]] > cb)
5375 if(p[pixel[15]] > cb)
5393 else if(p[pixel[10]] < c_b)
5394 if(p[pixel[11]] < c_b)
5395 if(p[pixel[12]] < c_b)
5396 if(p[pixel[13]] < c_b)
5397 if(p[pixel[14]] < c_b)
5398 if(p[pixel[15]] < c_b)
5401 if(p[pixel[6]] < c_b)
5402 if(p[pixel[7]] < c_b)
5403 if(p[pixel[8]] < c_b)
5404 if(p[pixel[9]] < c_b)
5415 if(p[pixel[5]] < c_b)
5416 if(p[pixel[6]] < c_b)
5417 if(p[pixel[7]] < c_b)
5418 if(p[pixel[8]] < c_b)
5419 if(p[pixel[9]] < c_b)
5432 if(p[pixel[4]] < c_b)
5433 if(p[pixel[5]] < c_b)
5434 if(p[pixel[6]] < c_b)
5435 if(p[pixel[7]] < c_b)
5436 if(p[pixel[8]] < c_b)
5437 if(p[pixel[9]] < c_b)
5458 if(p[pixel[9]] > cb)
5459 if(p[pixel[7]] > cb)
5460 if(p[pixel[8]] > cb)
5461 if(p[pixel[10]] > cb)
5462 if(p[pixel[11]] > cb)
5463 if(p[pixel[6]] > cb)
5464 if(p[pixel[5]] > cb)
5465 if(p[pixel[4]] > cb)
5466 if(p[pixel[3]] > cb)
5469 if(p[pixel[12]] > cb)
5474 if(p[pixel[12]] > cb)
5475 if(p[pixel[13]] > cb)
5482 if(p[pixel[12]] > cb)
5483 if(p[pixel[13]] > cb)
5484 if(p[pixel[14]] > cb)
5493 if(p[pixel[12]] > cb)
5494 if(p[pixel[13]] > cb)
5495 if(p[pixel[14]] > cb)
5496 if(p[pixel[15]] > cb)
5514 else if(p[pixel[9]] < c_b)
5515 if(p[pixel[10]] < c_b)
5516 if(p[pixel[11]] < c_b)
5517 if(p[pixel[12]] < c_b)
5518 if(p[pixel[13]] < c_b)
5519 if(p[pixel[14]] < c_b)
5520 if(p[pixel[15]] < c_b)
5523 if(p[pixel[6]] < c_b)
5524 if(p[pixel[7]] < c_b)
5525 if(p[pixel[8]] < c_b)
5534 if(p[pixel[5]] < c_b)
5535 if(p[pixel[6]] < c_b)
5536 if(p[pixel[7]] < c_b)
5537 if(p[pixel[8]] < c_b)
5548 if(p[pixel[4]] < c_b)
5549 if(p[pixel[5]] < c_b)
5550 if(p[pixel[6]] < c_b)
5551 if(p[pixel[7]] < c_b)
5552 if(p[pixel[8]] < c_b)
5565 if(p[pixel[3]] < c_b)
5566 if(p[pixel[4]] < c_b)
5567 if(p[pixel[5]] < c_b)
5568 if(p[pixel[6]] < c_b)
5569 if(p[pixel[7]] < c_b)
5570 if(p[pixel[8]] < c_b)
5591 if(p[pixel[8]] > cb)
5592 if(p[pixel[7]] > cb)
5593 if(p[pixel[9]] > cb)
5594 if(p[pixel[10]] > cb)
5595 if(p[pixel[6]] > cb)
5596 if(p[pixel[5]] > cb)
5597 if(p[pixel[4]] > cb)
5598 if(p[pixel[3]] > cb)
5599 if(p[pixel[2]] > cb)
5602 if(p[pixel[11]] > cb)
5607 if(p[pixel[11]] > cb)
5608 if(p[pixel[12]] > cb)
5615 if(p[pixel[11]] > cb)
5616 if(p[pixel[12]] > cb)
5617 if(p[pixel[13]] > cb)
5626 if(p[pixel[11]] > cb)
5627 if(p[pixel[12]] > cb)
5628 if(p[pixel[13]] > cb)
5629 if(p[pixel[14]] > cb)
5640 if(p[pixel[11]] > cb)
5641 if(p[pixel[12]] > cb)
5642 if(p[pixel[13]] > cb)
5643 if(p[pixel[14]] > cb)
5644 if(p[pixel[15]] > cb)
5662 else if(p[pixel[8]] < c_b)
5663 if(p[pixel[9]] < c_b)
5664 if(p[pixel[10]] < c_b)
5665 if(p[pixel[11]] < c_b)
5666 if(p[pixel[12]] < c_b)
5667 if(p[pixel[13]] < c_b)
5668 if(p[pixel[14]] < c_b)
5669 if(p[pixel[15]] < c_b)
5672 if(p[pixel[6]] < c_b)
5673 if(p[pixel[7]] < c_b)
5680 if(p[pixel[5]] < c_b)
5681 if(p[pixel[6]] < c_b)
5682 if(p[pixel[7]] < c_b)
5691 if(p[pixel[4]] < c_b)
5692 if(p[pixel[5]] < c_b)
5693 if(p[pixel[6]] < c_b)
5694 if(p[pixel[7]] < c_b)
5705 if(p[pixel[3]] < c_b)
5706 if(p[pixel[4]] < c_b)
5707 if(p[pixel[5]] < c_b)
5708 if(p[pixel[6]] < c_b)
5709 if(p[pixel[7]] < c_b)
5722 if(p[pixel[2]] < c_b)
5723 if(p[pixel[3]] < c_b)
5724 if(p[pixel[4]] < c_b)
5725 if(p[pixel[5]] < c_b)
5726 if(p[pixel[6]] < c_b)
5727 if(p[pixel[7]] < c_b)
5748 if(p[pixel[7]] > cb)
5749 if(p[pixel[8]] > cb)
5750 if(p[pixel[9]] > cb)
5751 if(p[pixel[6]] > cb)
5752 if(p[pixel[5]] > cb)
5753 if(p[pixel[4]] > cb)
5754 if(p[pixel[3]] > cb)
5755 if(p[pixel[2]] > cb)
5756 if(p[pixel[1]] > cb)
5759 if(p[pixel[10]] > cb)
5764 if(p[pixel[10]] > cb)
5765 if(p[pixel[11]] > cb)
5772 if(p[pixel[10]] > cb)
5773 if(p[pixel[11]] > cb)
5774 if(p[pixel[12]] > cb)
5783 if(p[pixel[10]] > cb)
5784 if(p[pixel[11]] > cb)
5785 if(p[pixel[12]] > cb)
5786 if(p[pixel[13]] > cb)
5797 if(p[pixel[10]] > cb)
5798 if(p[pixel[11]] > cb)
5799 if(p[pixel[12]] > cb)
5800 if(p[pixel[13]] > cb)
5801 if(p[pixel[14]] > cb)
5814 if(p[pixel[10]] > cb)
5815 if(p[pixel[11]] > cb)
5816 if(p[pixel[12]] > cb)
5817 if(p[pixel[13]] > cb)
5818 if(p[pixel[14]] > cb)
5819 if(p[pixel[15]] > cb)
5837 else if(p[pixel[7]] < c_b)
5838 if(p[pixel[8]] < c_b)
5839 if(p[pixel[9]] < c_b)
5840 if(p[pixel[6]] < c_b)
5841 if(p[pixel[5]] < c_b)
5842 if(p[pixel[4]] < c_b)
5843 if(p[pixel[3]] < c_b)
5844 if(p[pixel[2]] < c_b)
5845 if(p[pixel[1]] < c_b)
5848 if(p[pixel[10]] < c_b)
5853 if(p[pixel[10]] < c_b)
5854 if(p[pixel[11]] < c_b)
5861 if(p[pixel[10]] < c_b)
5862 if(p[pixel[11]] < c_b)
5863 if(p[pixel[12]] < c_b)
5872 if(p[pixel[10]] < c_b)
5873 if(p[pixel[11]] < c_b)
5874 if(p[pixel[12]] < c_b)
5875 if(p[pixel[13]] < c_b)
5886 if(p[pixel[10]] < c_b)
5887 if(p[pixel[11]] < c_b)
5888 if(p[pixel[12]] < c_b)
5889 if(p[pixel[13]] < c_b)
5890 if(p[pixel[14]] < c_b)
5903 if(p[pixel[10]] < c_b)
5904 if(p[pixel[11]] < c_b)
5905 if(p[pixel[12]] < c_b)
5906 if(p[pixel[13]] < c_b)
5907 if(p[pixel[14]] < c_b)
5908 if(p[pixel[15]] < c_b)
5928 ret_corners.push_back(Point(x,y));
5932 /* This defines non-strict maxima */
5933 #define Compare(X, Y) ((X)>=(Y))
5935 /* This is a fast, integer only, sparse nonmaximal suppression. */
5936 /* probably only useful for FAST corner detection */
5937 static void fastNonmaxSuppression(const vector<Point>& corners,
5938 const vector<int>& scores,
5939 vector<KeyPoint>& ret_nonmax)
5941 int i, j, num_corners = (int)corners.size();
5943 // Point above points (roughly) to the pixel above the one of interest, if there is a feature there.
5944 int point_above = 0;
5945 int point_below = 0;
5951 /* Find where each row begins
5952 (the corners are output in raster scan order). A beginning of -1 signifies
5953 that there are no corners on that row. */
5954 int last_row = corners[num_corners-1].y;
5955 vector<int> row_start(last_row+1);
5957 for(i=0; i < last_row+1; i++)
5961 for(i=0; i< num_corners; i++)
5962 if(corners[i].y != prev_row)
5964 row_start[corners[i].y] = i;
5965 prev_row = corners[i].y;
5968 ret_nonmax.reserve(num_corners);
5969 for(i = 0; i < num_corners; i++)
5971 int score = scores[i];
5972 Point pos = corners[i];
5975 if(i > 0 && corners[i-1].x == pos.x-1 && corners[i-1].y == pos.y && Compare(scores[i-1], score))
5979 if(i < num_corners-1 && corners[i+1].x == pos.x+1 && corners[i+1].y == pos.y && Compare(scores[i+1], score))
5982 bool suppressed = false;
5983 // Check above (if there is a valid row above)
5984 if(pos.y != 0 && row_start[pos.y - 1] != -1)
5986 // Make sure that current point_above is one row above.
5987 if(corners[point_above].y < pos.y - 1)
5988 point_above = row_start[pos.y-1];
5990 // Make point_above point to the first of the pixels above the current point, if it exists.
5991 for(; corners[point_above].y < pos.y && corners[point_above].x < pos.x - 1; point_above++)
5994 for(j=point_above; corners[j].y < pos.y && corners[j].x <= pos.x + 1; j++)
5996 int x = corners[j].x;
5997 if( (x == pos.x - 1 || x ==pos.x || x == pos.x+1) && Compare(scores[j], score))
6007 // Check below (if there is anything below)
6008 if(pos.y != last_row && row_start[pos.y + 1] != -1 && point_below < num_corners) // Nothing below
6010 if(corners[point_below].y < pos.y + 1)
6011 point_below = row_start[pos.y+1];
6013 // Make point below point to one of the pixels belowthe current point, if it exists.
6014 for(; point_below < num_corners && corners[point_below].y == pos.y+1
6015 && corners[point_below].x < pos.x - 1; point_below++)
6018 for(j=point_below; j < num_corners && corners[j].y == pos.y+1 && corners[j].x <= pos.x + 1; j++)
6020 int x = corners[j].x;
6021 if( (x == pos.x - 1 || x ==pos.x || x == pos.x+1) && Compare(scores[j],score))
6031 ret_nonmax.push_back(KeyPoint(corners[i], 6.f, -1.f, (float)score));
6037 void cv::FAST( const Mat& image, vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression )
6039 CV_Assert(image.data && image.type() == CV_8U);
6041 vector<Point> corners;
6042 fast9Detect(image, corners, threshold);
6044 if(nonmax_suppression)
6047 fast9ComputeScores(image, corners, scores, threshold);
6048 fastNonmaxSuppression(corners, scores, keypoints);
6052 size_t i, n = corners.size();
6053 keypoints.resize(n);
6054 for( i = 0; i < n; i++ )
6055 keypoints[i] = KeyPoint(corners[i], 6.f);