Skip to content

Commit 50ba22e

Browse files
committed
Pad only for LFM2
1 parent 215388f commit 50ba22e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/mtmd/clip.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4355,9 +4355,11 @@ bool clip_image_preprocess(struct clip_ctx * ctx, const clip_image_u8 * img, str
43554355
params.patch_size * params.n_merge,
43564356
params.image_min_pixels,
43574357
params.image_max_pixels);
4358+
const std::array<uint8_t, 3> pad_color = {122, 116, 104};
43584359

43594360
clip_image_u8 resized_img;
4360-
img_tool::resize(*img, resized_img, target_size, img_tool::RESIZE_ALGO_BILINEAR, false);
4361+
const bool pad = (ctx->proj_type() != PROJECTOR_TYPE_LFM2);
4362+
img_tool::resize(*img, resized_img, target_size, img_tool::RESIZE_ALGO_BILINEAR, pad, pad_color);
43614363
clip_image_f32_ptr res(clip_image_f32_init());
43624364
normalize_image_u8_to_f32(resized_img, *res, params.image_mean, params.image_std);
43634365
res_imgs->entries.push_back(std::move(res));

0 commit comments

Comments
 (0)