Last updated 4 years ago
Was this helpful?
convert to 8bits
return 7-plane's position bit's if bit is 00010000 and plane is 4 7-4 = 3, the thrids array of bits is 1. so must return 1
const bitSlice = (image, plane) => image.map((row) => { return row.map((v) => { return Number(v.toString(2).padStart(8, '0')[7 - plane]); }); });