template<int ROWS, int COLS, int SRC1_T, int SRC2_T, int DST_T>
void hls::Cmp( hls::Mat<ROWS, COLS, SRC1_T>& src1,
               hls::Mat<ROWS, COLS, SRC2_T>& src2,
               hls::Mat<ROWS, COLS, DST_T>& dst,
               int cmp_op );


  • src1 – first input image.
  • src2 – second input image.
  • dst – the output8-bit single channel image.
  • cmp_op – the flag that specifying the relation between the elements to be checked.
    • HLS_CMP_EQ “equal to”
    • HLS_CMP_GT “greater than”
    • HLS_CMP_GE “greater or equal”
    • HLS_CMP_LT “less than”
    • HLS_CMP_LE “less or equal”
    • HLS_CMP_NE “not equal”


Performs the per-element comparison of two input images src1 and src2 and save the result indst.
If the comparison result is true, the corresponding element of dst is set to 255; else it is set to 0.
Image data must be stored in src1 and src2, the image data of dst must be empty before invocations. Invoking this function will consume the data in src1 and src2, and filling the image data of dst.
src1 and src2 must have the same size and number of channels.dstmust have the same size and number of channels as the inputs.

OpenCV reference

cvCmp, cv::compare