Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Getting pixels out of a bounding box

Hi,

I am conducting template matching over an image to get the bounding boxes, and it works.

   # Apply template Matching
    # loop over the list of templates and draw bounding boxes around them in the image
    for i in range(len(templates)):
        w, h = templates[i].shape[::-1]
        res = cv2.matchTemplate(backgroundImage_Gray, templates[i], cv2.TM_SQDIFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        top_left = min_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        cv2.rectangle(backgroundImage, top_left, bottom_right, 255, 2)
        # get the pixels of the rectangle in a variable that can hold them all conveniently

I'd like to keep the pixels in each bounding box in a list though, so that I can, later on, access them. Does anyone know how to keep the pixels in a suitable variable?

I'd appreciate any suggestion.

Getting pixels out of a bounding box

Hi,

I am conducting template matching over an image to get the bounding boxes, and it works.

   # Apply template Matching
    # loop over the list of templates and draw bounding boxes around them in the image
    for i in range(len(templates)):
        w, h = templates[i].shape[::-1]
        res = cv2.matchTemplate(backgroundImage_Gray, templates[i], cv2.TM_SQDIFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        top_left = min_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        cv2.rectangle(backgroundImage, top_left, bottom_right, 255, 2)
        # get the pixels of the rectangle in a variable that can hold them all conveniently

I'd like to keep the pixels in each bounding box in a list though, so that I can, later on, access them. Does anyone know how to keep the pixels in a suitable variable?

I'd appreciate any suggestion.

Getting pixels out of a bounding box

Hi,

I am conducting template matching over an image to get the bounding boxes, and it works.

   # Apply template Matching
    # loop over the list of templates and draw bounding boxes around them in the image
    for i in range(len(templates)):
        w, h = templates[i].shape[::-1]
        res = cv2.matchTemplate(backgroundImage_Gray, templates[i], cv2.TM_SQDIFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        top_left = min_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        cv2.rectangle(backgroundImage, top_left, bottom_right, 255, 2)
        # get the pixels of the rectangle in a variable that can hold them all conveniently

I'd like to keep the pixels in each bounding box in a list though, so that I can, later on, access them. Does anyone know how to keep the pixels in a suitable variable?container?

I'd appreciate any suggestion.

Getting pixels of a bounding box

Hi,

I am conducting template matching over an image to get the bounding boxes, and it works.

   # Apply template Matching
    # loop over the list of templates and draw bounding boxes around them in the image
    for i in range(len(templates)):
        w, h = templates[i].shape[::-1]
        res = cv2.matchTemplate(backgroundImage_Gray, templates[i], cv2.TM_SQDIFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        top_left = min_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        cv2.rectangle(backgroundImage, top_left, bottom_right, 255, 2)
        # get the pixels of the rectangle in a variable that can hold them all conveniently

I'd like to keep the pixels in each bounding box in a list though, so that I can, later on, access them. Does anyone know how to keep the pixels in a suitable container?

I'd appreciate any suggestion.

Getting pixels position of a bounding box

Hi,

I am conducting template matching over an image to get the bounding boxes, and it works.

   # Apply template Matching
    # loop over the list of templates and draw bounding boxes around them in the image
    for i in range(len(templates)):
        w, h = templates[i].shape[::-1]
        res = cv2.matchTemplate(backgroundImage_Gray, templates[i], cv2.TM_SQDIFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        top_left = min_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        cv2.rectangle(backgroundImage, top_left, bottom_right, 255, 2)
        # get the pixels of the rectangle in a variable that can hold them all conveniently

I'd like to keep the pixels in location of each bounding box in a list though, so that I can, later on, access them. Does anyone know how to keep the pixels position in a suitable container?

I'd appreciate any suggestion.

Getting position of a bounding box

Hi,

I am conducting template matching over an image to get the bounding boxes, and it works.

   # Apply template Matching
    # loop over the list of templates and draw bounding boxes around them in the image
    for i in range(len(templates)):
        w, h = templates[i].shape[::-1]
        res = cv2.matchTemplate(backgroundImage_Gray, templates[i], cv2.TM_SQDIFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        top_left = min_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        cv2.rectangle(backgroundImage, top_left, bottom_right, 255, 2)
        # get the pixels of the rectangle in a variable that can hold them all conveniently

I'd like to keep the location of each bounding box in a list though, so that I can, later on, access them. Does anyone know how to keep the position in a suitable container?

I'd appreciate any suggestion.