Example #1
0
        xx = ISSIMAGE(filename)

        xx.resize()

        xx.show()

        # ----------------------
        # Get the sun elevation
        # ----------------------
        sunElev = xx.get_sun_elev()
        logging.debug("Sun elevation = %s", sunElev)

        # ----------------------
        # Get the focal length
        # ----------------------
        focalLength = xx.get_focal_length()
        logging.debug("Focal length = %s", focalLength)

        # -----------------
        # convert to gray
        # -----------------
        gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY)

        # ------------------------------------------------------
        # Smooth the image
        # nn = the neighborhood size
        # For finding the limb, want the image to be very smooth
        # -------------------------------------------------------
        nn = 11  # Get less edges w/ higher n
        #nn = 5
        #gray = cv2.GaussianBlur(gray, (nn, nn), 0)
        opened4 = cv2.morphologyEx(opened3, cv2.MORPH_OPEN, kernel)

        opened = opened4.copy()  # to make sure I'm using the right one

    else:
        opened = filtered.copy()

    # Need to mask out by color, then get blobs
    # Convert to HSV color
    if (doHSV):
        hsvImage = cv2.cvtColor(opened, cv2.COLOR_BGR2HSV)
    else:
        hsvImage = opened.copy()

    # Dilate the binary image to compare binary pixel values
    focalLength = issimg.get_focal_length()

    # Algorithm won't work on very large focal lengths :
    # if (focalLength > 200) :
    #     logging.info("Focal length > 200, skipping")
    #     continue

    # The attribute .size is the diameter of the blob, not its area!!!!!!!!!!
    # Size determines the diameter of the meaningful keypoint neighborhood.
    # # You can use that size and roughly calculate the area of the blob.

    # intitialize min/max area
    params.minArea = 50.
    params.maxArea = 10000.
    kNum = 7