Skip to content

Conversation

geoff-powell
Copy link
Collaborator

No description provided.

Comment on lines 141 to 151
private fun subtractImagesInPlace(a: Array<DoubleArray>, b: Array<DoubleArray>): Array<DoubleArray> {
val h = a.size
val w = a[0].size
val result = Array(h) { DoubleArray(w) }
for (y in 0 until h) {
for (x in 0 until w) {
result[y][x] = a[y][x] - b[y][x]
}
// Modify 'a' in place
for (y in 0 until h) for (x in 0 until w) {
a[y][x] -= b[y][x]
}
return result
return a // Return the modified 'a'
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of allocating a new Array> of an image we just alter the existing array

with(siftResult2) {
assertThat(this).isInstanceOf(DiffResult.Similar::class.java)
this as DiffResult.Similar
assertThat(numSimilarPixels).isEqualTo(635)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the num of pixels diff was 635 and not 293

@geoff-powell geoff-powell force-pushed the gpowell/fix-sift-oom branch 3 times, most recently from 53a5d59 to 717ae06 Compare September 3, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant