File: dense.py

package info (click to toggle)
python-imutils 0.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,652 kB
  • sloc: python: 1,178; makefile: 3
file content (24 lines) | stat: -rwxr-xr-x 696 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cv2

class DENSE:
    def __init__(self, step=6, radius=.5):
        self.step = step
        self.radius = radius

    def detect(self, img):
        # initialize our list of keypoints
        kps = []

        # loop over the height and with of the image, taking a `step`
        # in each direction
        for x in range(0, img.shape[1], self.step):
            for y in range(0, img.shape[0], self.step):
                # create a keypoint and add it to the keypoints list
                kps.append(cv2.KeyPoint(x, y, self.radius))

        # return the dense keypoints
        return kps

    def setInt(self, var, val):
        if var == "initXyStep":
            self.step = val