code: def pixelCollision(rect1, rect2, hitmask1, hitmask2):
      """Checks if two objects collide and not just their rects"""
      rect = rect1.clip(rect2)
  
      if rect.width == 0 or rect.height == 0:
          return False
  
      x1, y1 = rect.x - rect1.x, rect.y - rect1.y
      x2, y2 = rect.x - rect2.x, rect.y - rect2.y
  
      for x in range(rect.width):
          for y in range(rect.height):
              if hitmask1[x1 + x][y1 + y] and hitmask2[x2 + x][y2 + y]:
                  return True
      return False
  
file_path: CNTK/Examples/ReinforcementLearning/FlappingBirdWithKeras/game/wrapped_flappy_bird.py
imports: import numpy
  import sys
  import random
  from game import flappy_bird_utils
  import pygame
  import pygame.surfarray
  from pygame.locals import *
  from itertools import cycle
label_desc: Use image node_id 4 for calling a global function with example usage: pixelCollision(rect1, rect2, hitmask1, hitmask2) and returns: False, False, True