docstr: Find adjacent pairs of points between two masks
  
  img1, img2 - binary images to be 8-connected
  offset1 - number the foreground points in img1 starting at this offset
  count1 - number of foreground points in img1
  offset2 - number the foreground points in img2 starting at this offset
  count2 - number of foreground points in img2
  first, second - prior collection of points
  
  returns augmented collection of points
docstr_tok: ["Find","adjacent","pairs","of","points","between","two","masks","img1",",","img2","-","binary","images","to","be","8-connected","offset1","-","number","the","foreground","points","in","img1","starting","at","this","offset","count1","-","number","of","foreground","points","in","img1","offset2","-","number","the","foreground","points","in","img2","starting","at","this","offset","count2","-","number","of","foreground","points","in","img2","first",",","second","-","prior","collection","of","points","returns","augmented","collection","of","points"]
code: def find_adjacent(
      img1, offset1, count1, img2, offset2, count2, first, second
  ):
      """Find adjacent pairs of points between two masks
  
      img1, img2 - binary images to be 8-connected
      offset1 - number the foreground points in img1 starting at this offset
      count1 - number of foreground points in img1
      offset2 - number the foreground points in img2 starting at this offset
      count2 - number of foreground points in img2
      first, second - prior collection of points
  
      returns augmented collection of points
      """
      numbering1 = numpy.zeros(img1.shape, int)
      numbering1[img1] = numpy.arange(count1) + offset1
      numbering2 = numpy.zeros(img1.shape, int)
      numbering2[img2] = numpy.arange(count2) + offset2
  
      f = numpy.zeros(0, int)
      s = numpy.zeros(0, int)
      #
      # Do all 9
      #
      for oi in (-1, 0, 1):
          for oj in (-1, 0, 1):
              f1, s1 = IdentifyDeadWorms.find_adjacent_one(
                  img1, numbering1, img2, numbering2, oi, oj
              )
              f = numpy.hstack((f, f1))
              s = numpy.hstack((s, s1))
      return numpy.hstack((first, f)), numpy.hstack((second, s))
  
imports: import matplotlib.cm
  import numpy
  from cellprofiler_core.constants.measurement import COLTYPE_INTEGER, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, M_NUMBER_OBJECT_NUMBER, FF_COUNT, COLTYPE_FLOAT, IMAGE, C_COUNT, C_LOCATION, C_NUMBER, FTR_CENTER_X, FTR_CENTER_Y, FTR_OBJECT_NUMBER
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.object import Objects, ObjectSet
  from cellprofiler_core.preferences import get_default_colormap
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting.subscriber import ImageSubscriber
  from cellprofiler_core.setting.text import LabelName, Integer, Float
  from centrosome.cpmorphology import all_connected_components
  from centrosome.cpmorphology import fixup_scipy_ndimage_result
  from centrosome.cpmorphology import get_line_pts
  from scipy.ndimage import binary_erosion, binary_fill_holes
  from scipy.ndimage import mean
label_desc: Use image node_id 7 for calling the IdentifyDeadWorms obj's underlying member method code with example usage: obj.find_adjacent(img1, offset1, count1, img2, offset2, count2, first, second) and returns: numpy,  numpy