Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • I'm getting about 895 µs for differenceImageV2, while 645 µs for differenceImageV6. Regardless of actual speedup, I still applaud the numpy wizardry. Commented Mar 3, 2016 at 18:11
  • 1
    I like your V6 :-) ...but still trying to understand it ;-) Commented Mar 3, 2016 at 18:16
  • I think V6 will be faster if you do it as a = img1 - img2; a[img1 < img2] *= 255. Commented Mar 3, 2016 at 18:20
  • @dede The most fundamental bits are that multiplying by 255 with 8-bit math is equivalent to multiplying by -1 and letting it overflow. a is the basic difference, and b is an array of either 1 or 255 based on if that element of img1 is less than that element of img2. Commented Mar 3, 2016 at 18:21
  • @Jaime While ingenious, it's even slower than differenceImageV2 on my machine. Commented Mar 3, 2016 at 18:24