Merge pull request #462 from gwanglee/dev

coordinate calculation fixed in place_image(). dtype int -> float
This commit is contained in:
Joseph Redmon 2018-03-28 11:59:13 -07:00 committed by GitHub
commit 259be3217b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -780,8 +780,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);
} }