| 102 | public: |
| 103 | |
| 104 | inline void load ( |
| 105 | const funny_image& img_ |
| 106 | ) |
| 107 | { |
| 108 | const array2d<unsigned char>& img = img_.img; |
| 109 | |
| 110 | feat_image.set_size(img.nr(), img.nc()); |
| 111 | assign_all_pixels(feat_image,0); |
| 112 | for (long r = 1; r+1 < img.nr(); ++r) |
| 113 | { |
| 114 | for (long c = 1; c+1 < img.nc(); ++c) |
| 115 | { |
| 116 | unsigned char f = 0; |
| 117 | if (img[r][c]) f |= 0x1; |
| 118 | if (img[r][c+1]) f |= 0x2; |
| 119 | if (img[r][c-1]) f |= 0x4; |
| 120 | if (img[r+1][c]) f |= 0x8; |
| 121 | if (img[r-1][c]) f |= 0x10; |
| 122 | |
| 123 | // Store the code value for the pattern of pixel values in the 4-connected |
| 124 | // neighborhood around this row and column. |
| 125 | feat_image[r][c] = f; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | inline void load ( |
| 131 | const array2d<unsigned char>& img |
no test coverage detected