Skip to content

CIFilter.labDeltaE outputs 99 for not noticeable difference in color #5

Description

@paulz

CIFilter.labDeltaE outputImage example shows 2 pixel difference:

image

the above image has dark gray background in preview of the actual image which has transparent background:

https://github.com/paulz/ViewSnapshots/blob/main/AppTests/Snapshots/ContentView-labDelta.png:
image

at CGPoint(x: 108, y: 28) CIFilter.labDeltaE shows difference RGBA[99, 99, 99, 99]

while CIFilter.labDeltaE().inputImage at that point has color: RGBA[79, 63, 0, 255]
and CIFilter.labDeltaE().image2 at that point has color: RGBA[79, 62, 0, 255]

Input images:

inputImage
https://github.com/paulz/ViewSnapshots/raw/main/AppTests/Snapshots/ContentView-intel.png:
input image 1

image2
https://github.com/paulz/ViewSnapshots/raw/main/AppTests/Snapshots/ContentView-m1.png
input image 2

Verified by test:

func testLargeDifferenceEvenWhenColorHasNoDifference() throws {
let delta = try calculateDelta("ContentView")
let maxDifference: [UInt8] = [99, 99, 99, 99]
XCTAssertEqual(areaMaximum(delta.delta), maxDifference)
let diffPoint = CGPoint(x: 108, y: 52 - 24)
let maxColor = getColor(delta.delta, at: diffPoint)
XCTAssertEqual(maxColor, maxDifference)
let firstColor = getColor(delta.first, at: diffPoint)
XCTAssertEqual(firstColor, [79, 63, 0, 255])
let secondColor = getColor(delta.second, at: diffPoint)
XCTAssertEqual(secondColor, [79, 62, 0, 255])
let difference = try XCTUnwrap(diff(delta.first, delta.second).outputImage)
XCTAssertEqual(ImageComparisonResult(difference: difference).maxColorDifference(), 0)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    AppleApple Feedback issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions