Skip to main content

MimCountDifference

BoardSupported
Host SystemYes
V4L2Yes
Clarity UHDYes
Concord PoENo
GenTLYes
GevIQYes
GigE VisionYes
IndioNo
Iris GTXYes
Radient eV-CLYes
Rapixo CLYes
Rapixo CoFYes
Rapixo CXPYes
USB3 VisionYes

Count the number of pixels that differ in each image.

Syntax

AIL_INT MimCountDifference(
AIL_ID Src1ImageBufId, //in
AIL_ID Src2ImageBufId, //in
AIL_ID CountResultImId //out
)

Description

This function finds the number of differences between the two specified source buffers and stores the resulting number in the specified result buffer.

You can read the number of differences from the result buffer, using MimGetResult1d or MimGetResult, specifying M_VALUE as the result type.

You can limit this function's results to a region of an image buffer using a region of interest (ROI) set using MbufSetRegion. The ROI must be defined in raster format (M_RASTER or M_VECTOR_AND_RASTER). An error is generated if the ROI is only in vector format (M_VECTOR). If you specify multiple image buffers with an ROI, results are limited to the portion of the ROIs that intersect.

Parameters

Src1ImageBufId (in, AIL_ID)

Specifies the identifier of the first image data source. This parameter can be given an image buffer identifier. The image buffer must be 1-band. If you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.

Src2ImageBufId (in, AIL_ID)

Specifies the identifier of the second image data source. This parameter can only be given an image buffer identifier. The image buffer must be 1-band. If you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.

CountResultImId (out, AIL_ID)

Specifies the identifier of the buffer in which to store the differences. This parameter must be given the identifier of an image processing result buffer that was allocated with MimAllocResult and has an M_COUNT_LIST type. The buffer needs only one entry.

Return Value

Type: AIL_INT

If CountResultImId is M_NULL, the returned value is the number of differences between the two specified source buffers. If CountResultImId is not M_NULL, the returned value is M_INVALID. In that case, use either MimGetResult1d or MimGetResult, with M_VALUE as the result type, to retrieve the number of differences.

Copyright © 2026 Zebra Technologies.