| 184 | |
| 185 | template <typename T> |
| 186 | void deserialize ( |
| 187 | scan_image_custom<T>& item, |
| 188 | std::istream& in |
| 189 | ) |
| 190 | { |
| 191 | int version = 0; |
| 192 | deserialize(version, in); |
| 193 | if (version != 1) |
| 194 | throw serialization_error("Unsupported version found when deserializing a scan_image_custom object."); |
| 195 | |
| 196 | deserialize(item.feats, in); |
| 197 | deserialize(item.search_rects, in); |
| 198 | deserialize(item.loaded_with_image, in); |
| 199 | |
| 200 | // When developing some feature extractor, it's easy to accidentally change its |
| 201 | // number of dimensions and then try to deserialize data from an older version of |
| 202 | // your extractor into the current code. This check is here to catch that kind of |
| 203 | // user error. |
| 204 | long dims; |
| 205 | deserialize(dims, in); |
| 206 | if (item.get_num_dimensions() != dims) |
| 207 | throw serialization_error("Number of dimensions in serialized scan_image_custom doesn't match the expected number."); |
| 208 | } |
| 209 | |
| 210 | // ---------------------------------------------------------------------------------------- |
| 211 | // ---------------------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected