1
0
Fork 0
mirror of synced 2024-09-29 08:51:11 +13:00

Merge pull request #64 from nagadomi/fix_sync_fast

Fix error when image has alpha channel
This commit is contained in:
nagadomi 2015-11-21 17:25:27 +09:00
commit b4f6a8ba1e

View file

@ -14,7 +14,7 @@ function image_loader.encode_png(rgb, alpha, depth)
rgb = iproc.byte2float(rgb)
if alpha then
if not (alpha:size(2) == rgb:size(2) and alpha:size(3) == rgb:size(3)) then
alpha = gm.Image(alpha, "I", "DHW"):size(rgb:size(3), rgb:size(2), "SincFast"):toTensor("float", "I", "DHW")
alpha = gm.Image(alpha, "I", "DHW"):size(rgb:size(3), rgb:size(2), "Sinc"):toTensor("float", "I", "DHW")
end
local rgba = torch.Tensor(4, rgb:size(2), rgb:size(3))
rgba[1]:copy(rgb[1])