GammaCV
GammaCV copied to clipboard
Perspective transform broken on some iOS devices
I've ran into an issue with using perspective transform on some iOS devices using Ionic and Capacitor (i.e. WKWebView) - thus far an iPhone 6 and a iPad Air 2. I've put together a Github project demonstrating the issue.
I've tested on iPhone 7 and iPhone 8 and it's worked fine. I upgraded the iPad Air 2's OS to iOS 12.4; the issue persists.
EDIT: I decided a much smaller image made my life easier as regards getting the tensor data
Desired
Undesired (iPad Air 2 iOS 12.4)
Original
I don’t know we have a iPad 2 in our test equipment. Can you share the values returned in the good and negative cases?
Certainly. Please let me know if there's anything I'm missing or can add that would be helpful.
Good case
// input (source tensor)
data: Uint8Array(384256)
dtype: "uint8"
empty: Uint8Array(384256)
get: ƒ (i0,i1,i2)
id: 6
index: ƒ (i0,i1,i2, v)
name: "Tensor:6"
offset: 0
set: ƒ (i0,i1,i2, v)
shape: [316, 304, 4]
size: 384256
stride: [1216, 4, 1]
// rect
data: Float32Array(8) [102, 5, 301, 42, 254, 315, 55, 279]
P: 959.6585846065385
angleA: 1.5847472567080332
angleB: 1.5574556992303161
angleC: 1.579275389553046
angleD: 1.5617069616881911
area: 56145.530856629484
ax: 102
ay: 5
bx: 301
by: 42
cx: 254
cy: 315
distA: 278.0017985553331
distB: 277.01624501101014
distC: 202.41047403728888
distD: 202.23006700290637
distE: 345.2593228285081
distF: 341.5918617297549
dx: 55
dy: 279
maxHeight: 277
maxWidth: 214
// output (transformed tensor)
data: Uint8Array(237112)
dtype: "uint8"
empty: Uint8Array(237112)
get: ƒ (i0,i1,i2)
id: 10
index: ƒ (i0,i1,i2, v)
name: "Tensor:10"
offset: 0
set: ƒ (i0,i1,i2, v)
shape: [277, 214, 4]
size: 237112
stride: [856, 4, 1]
Negative case
// input
data: Uint8Array [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, …] (384256)
dtype: "uint8"
empty: Uint8Array [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] (384256)
get: function(i0,i1,i2)
id: 1
index: function(i0,i1,i2, v)
name: "Tensor:1"
offset: 0
set: function(i0,i1,i2, v)
shape: [316, 304, 4] (3)
size: 384256
stride: [1216, 4, 1] (3)
// rect
data: Float32Array (8) [102, 5, 301, 42, 254, 315, 55, 279]
P: 959.6585846065385
angleA: 1.5847472567080332
angleB: 1.5574556992303161
angleC: 1.579275389553046
angleD: 1.5617069616881911
ax: 102
ay: 5
bx: 301
by: 42
cx: 254
cy: 315
distA: 278.0017985553331
distB: 277.01624501101014
distC: 202.41047403728888
distD: 202.23006700290637
distE: 345.2593228285081
distF: 341.5918617297549
dx: 55
dy: 279
maxHeight: 277
maxWidth: 214
// output
data: Uint8Array [0, 0, 0, 255, 5, 5, 5, 255, 3, 3, …] (237112)
dtype: "uint8"
empty: Uint8Array [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …] (237112)
get: function(i0,i1,i2)
id: 5
index: function(i0,i1,i2, v)
name: "Tensor:5"
offset: 0
set: function(i0,i1,i2, v)
shape: [277, 214, 4] (3)
size: 237112
stride: [856, 4, 1] (3)