"Color" (Comparison Method)

Compare two colors based on color distance.

Details

  • The "Color" comparison method considers two colors to be equivalent if they do not differ beyond a given tolerance.
  • This tolerance is set using the Tolerance option in AssessmentFunction.
  • By default, the distance between each value of the answer key and the submitted answer is computed using ColorDistance. The DistanceFunction option can be used to specify any of the settings supported by ColorDistance.
  • When multiple values in the answer key are within the tolerance range of an answer, the closest value is selected.

范例

打开所有单元关闭所有单元

基本范例  (2)

Create an AssessmentFunction for a color question:

Use it to assess answers:

Create a color assessment with multiple correct answers. Note that the "Color" comparison method is automatically chosen:

Specify an answer using RGBColor:

Assess it:

Retrieve the score:

Scope  (2)

Create an assessment with a default tolerance of zero:

The answer must be exactly the same to be considered correct:

Any valid color directive can be used in the answer keys or submitted answer:

Options  (1)

DistanceFunction  (1)

Set the DistanceFunction to compare based on luminance:

Colors with similar luminance are marked as correct:

Others are incorrect:

Applications  (3)

Create a QuestionObject for color selection:

Create a random Pokémon quiz:

Create a QuestionObject for assessing the selection of a color from an image: