| 187 | } |
| 188 | |
| 189 | void DetectionAutomatic::calibration::buildPoints(QString _signature, int _width, int _height) |
| 190 | { |
| 191 | signature = _signature; |
| 192 | width = _width; |
| 193 | height = _height; |
| 194 | sdrPoint.clear(); |
| 195 | hdrPoint.clear(); |
| 196 | |
| 197 | for (int py = 0; py < 10; py++) |
| 198 | for (int px = 0; px < 16; px++) |
| 199 | { |
| 200 | int x = std::min((int)std::max((width * (px / 2)) / 8 + (width * (1 + (px % 2))) / (8 * 3), 1), width - 1); |
| 201 | int y = std::min((int)std::max((height * py) / 10 + height * 0.05, 1.0), height - 1); |
| 202 | |
| 203 | calibrationPoint cp(x, y); |
| 204 | |
| 205 | sdrPoint.push_back(cp); |
| 206 | hdrPoint.push_back(cp); |
| 207 | } |
| 208 | |
| 209 | int sy = std::min((int)std::max((height * 4.3) / 10 + height * 0.05, 1.0), height - 1) + 1; |
| 210 | int ey = std::min((int)std::max((height * 4.8) / 10 + height * 0.05, 1.0), height - 1) - 1; |
| 211 | int step = std::max((ey - sy) / 8, 1); |
| 212 | int delta = 0; |
| 213 | for (int py = sy + step; py < ey; py += step, delta++) |
| 214 | { |
| 215 | for (int px = 10; px < 28; px++) |
| 216 | { |
| 217 | int x = std::min((int)std::max((width * (px / 5)) / 8 + (width * (1 + (px % 5))) / (8 * 6), 1), width - 1); |
| 218 | if (delta % 2) |
| 219 | x = std::min((int)std::max((width * (px / 5)) / 8 + (width * (1 + 2 * (px % 5))) / (8 * 12), 1), width - 1); |
| 220 | |
| 221 | calibrationPoint cp(x, py); |
| 222 | |
| 223 | sdrPoint.push_back(cp); |
| 224 | hdrPoint.push_back(cp); |
| 225 | } |
| 226 | } |
| 227 | }; |
| 228 | |
| 229 | void DetectionAutomatic::calibrateFrame(Image<ColorRgb>& image) |
| 230 | { |