void loadImages(const std::string& format, int num_frames, const cv::Size& screen, std::vector<cv::Mat>& images) { images.clear(); int downsample = 0; for (int t = 0; t < num_frames; t += 1) { cv::Mat image; std::string file = makeFrameFilename(format, t); bool ok = readColorImage(file, image); CHECK(ok) << "Could not load image"; if (t == 0) { while (tooBig(image.size(), screen)) { cv::pyrDown(image, image); downsample += 1; } } else { for (int i = 0; i < downsample; i += 1) { cv::pyrDown(image, image); } } images.push_back(image); } }
/* Get name from format 2.0 table */ static Byte8 *getName2_0(Format2_0 *format, GlyphId glyphId, IntX *length) { if (glyphId > format->numberGlyphs) return tooBig(glyphId, length); else { IntX index = format->glyphNameIndex[glyphId]; Byte8 *name; if ((index < 0) || (index > 32767)) { Byte8 gni[32]; sprintf(gni, "glyphNameIndex[%d]", glyphId); warning(SPOT_MSG_BADINDEX, TAG_ARG(post_), index, gni); name = applestd[0]; *length = strlen(name); } else if (index > (long)MAX_STD_INDEX) { IntX i; name = (Byte8 *)format->names; for (i = 0; i < index - (IntX)STD_LENGTH; i++) name += *name + 1; *length = *name++; } else { name = applestd[index]; *length = strlen(name); } return name; } }
/* Get name from format 1.0 table */ static Byte8 *getName1_0(GlyphId glyphId, IntX *length) { if (glyphId > MAX_STD_INDEX) return tooBig(glyphId, length); else { *length = strlen(applestd[glyphId]); return applestd[glyphId]; } }
/* Get name from format 2.5 table */ static Byte8 *getName2_5(Format2_5 *format, GlyphId glyphId, IntX *length) { if (glyphId > format->numberGlyphs) return tooBig(glyphId, length); else { Byte8 *name = applestd[format->offset[glyphId] + glyphId]; *length = strlen(name); return name; } }
/* Get name from format 4.0 table */ static Byte8 *getNam4_0(Format4_0 *format, GlyphId glyphId, IntX *length) { if (glyphId >= nGlyphs) return tooBig(glyphId, length); else { static Byte8 gni[32]; sprintf(gni, "a%hu", format->code[glyphId]); *length = strlen(gni); return gni; } }