def METHOD_NAME(inputImgData, imgData, frameData):
    mapping = {}
    for idx, img in enumerate(inputImgData):
        dupe_idx = -1
        for check_idx, check_img in enumerate(imgData):
            imgs_equal = True
            # perform a check to see if they're equal
            if len(img.imgPx) == len(check_img.imgPx):
                for ii in range(len(img.imgPx)):
                    if len(img.imgPx[ii]) == len(check_img.imgPx[ii]):
                        for jj in range(len(img.imgPx[ii])):
                            if img.imgPx[ii][jj] != check_img.imgPx[ii][jj]:
                                imgs_equal = False
                                break
                    else:
                        imgs_equal = False
                    if not imgs_equal:
                        break
            else:
                imgs_equal = False
            if imgs_equal:
                dupe_idx = check_idx
                break
        if dupe_idx > -1:
            mapping[idx] = dupe_idx
        else:
            mapping[idx] = len(imgData)
            imgData.append(img)
    for frame in frameData:
        for piece in frame:
            if piece.imgIndex != MINUS_FRAME:
                piece.imgIndex = mapping[piece.imgIndex]