weixin_39786706
2020-12-25 20:47 阅读 0

Custom threshold

Allow passing a custom error threshold

该提问来源于开源项目:skyweb07/Snap.swift

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39786706 weixin_39786706 2020-12-25 20:47

    Take a look into this https://en.wikipedia.org/wiki/Binary_space_partitioning , http://game-ai.gatech.edu/sites/default/files/documents/assignments/bsp.html

    点赞 评论 复制链接分享
  • weixin_39881513 weixin_39881513 2020-12-25 20:47

    Also having this issue, CoreGraphics seems to render non-deterministic when it comes to anti aliasing, at least I get pixel values off +/- 1 or 2 with the exact same code.

    Currently I use a custom compare operation via CIImage that might be a starting point, although it doesn't seem to be particularly fast: https://gist.github.com/ralfebert/4c69b264cd374c91d28ba6b54ab1062f

    点赞 评论 复制链接分享
  • weixin_39786706 weixin_39786706 2020-12-25 20:47

    mmm thanks for the code , I'll take a deeper look into this, seems that it's a little slow but I think we can speed it up a little, I'll try to hack something and come back with the results, thanks again!!

    点赞 评论 复制链接分享
  • weixin_39881513 weixin_39881513 2020-12-25 20:47

    The quickest way seems to be just to compare the bytes manually:

    
        let d1 = referenceImageContext.data!
        let d2 = imageContext.data!
        for i in 0..<referenceimagesizebytes let b1="d1.load(fromByteOffset:" i as: uint8.self b2="d2.load(fromByteOffset:" if diff="abs(Int(b1)" int> tolerance {
                    throw CompareError.notEquals
                }
            }
        }
    </referenceimagesizebytes>

    Doesn't seem to be particularly slow...

    点赞 评论 复制链接分享

相关推荐