def METHOD_NAME(self, img, bin_type):
    """Find the bins and their orientations."""
    assert (
        bin_type in self.bins[bin_type]
    ), f"Bins_2d does not know bin color: {bin_type}"
    if img is not None:
        kernel = np.ones((2, 2), np.float32) / 4
        img = cv2.filter2D(img, -1, kernel)
        debug_image = np.copy(img)
        img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        ret, img = cv2.threshold(img, 254, 255, cv2.THRESH_BINARY)
        contours, hierarchy = cv2.findContours(
            np.copy(img),
            cv2.RETR_TREE,
            cv2.CHAIN_APPROX_SIMPLE,
        )
        contours = contour_sort(contours)
        """This finds the bins and looks for the one that is orange or is not
           orange. Each bin is given an orangeness rating and either the most
           or least orange bin is selected.
        """
        if len(contours) > 0:
            bins = 2
            orangeness = 0 if self.bin_type == "orange" else 100000
            if len(contours) < bins:
                bins = len(contours)
            for i in range(0, bins + 1):
                x, y, w, h = cv2.boundingRect(contours[i])
                roi = debug_image[y : y + h, x : x + w]
                temp = evaluate_bin(roi)
                if (orangeness > temp and self.bin_type == "norange") or (
                    orangeness < temp and self.bin_type == "orange"
                ):
                    orangeness = temp
                    M = cv2.moments(contours[i])
                    cx = int(M["m10"] / M["m00"])
                    cy = int(M["m01"] / M["m00"])
                    img_h, img_w, _ = np.shape(debug_image)
                    point = (cx, cy)
                    (_, _), (_, _), rad = cv2.fitEllipse(contours[i])
                cv2.rectangle(debug_image, (x, y), (x + w, y + h), (127), 2)
                ellipse = cv2.fitEllipse(contours[i])
                cv2.ellipse(debug_image, ellipse, (170), 2)
            if point is not None:
                cv2.circle(debug_image, point, 5, (0, 0, 255), -1)
                pixels = np.copy(point)
                point = [cx - (img_w / 2), cy - (img_h / 2)]
                tuple_center = (point[0], point[1], 0)
                rad = ((rad) * np.pi) / 180.0
                P = np.asarray(self.image_sub.camera_info.P).reshape(3, 4)
                _P = np.linalg.pinv(P)
                pixels = np.asarray([pixels[0], pixels[1], 1])
                ray = _P.dot(pixels)
                tuple_center = self.range * ray
                tuple_center[2] = (
                    -tuple_center[2] + 0.45 + 1
                )  # height of the bin and some buffer
                self.last_draw_image = debug_image
                return tuple_center, rad