coordinate calcuration fiex in place_image(). change data type from int to float, for bilienar interpolation

This commit is contained in:
영상인식기술 Cell 이광국 2018-02-09 14:22:14 +09:00
parent 80d9bec20f
commit 558ec9c64c

View File

@ -749,8 +749,8 @@ void place_image(image im, int w, int h, int dx, int dy, image canvas)
for(c = 0; c < im.c; ++c){ for(c = 0; c < im.c; ++c){
for(y = 0; y < h; ++y){ for(y = 0; y < h; ++y){
for(x = 0; x < w; ++x){ for(x = 0; x < w; ++x){
int rx = ((float)x / w) * im.w; float rx = ((float)x / w) * im.w;
int ry = ((float)y / h) * im.h; float ry = ((float)y / h) * im.h;
float val = bilinear_interpolate(im, rx, ry, c); float val = bilinear_interpolate(im, rx, ry, c);
set_pixel(canvas, x + dx, y + dy, c, val); set_pixel(canvas, x + dx, y + dy, c, val);
} }