Esempio n. 1
0
# the purpose of this code is to find fps
# so that we can figure out how does each detector/descriptor affect on fps rate
import cv2
import datetime
from myPackage.KeyPointDetectors import detectKeypoints
from myPackage.KeyPointsDescriptors import computeKeypoints

video = cv2.VideoCapture(0)

start = datetime.datetime.now()
numFrames = 0
while True:
    isGrabbed, frame = video.read()

    ORB = detectKeypoints(frame)
    outputImage, keypoints = ORB.detectORB(True)
    SURF = computeKeypoints(frame, keypoints)
    kps, des = SURF.computeSURF()

    cv2.imshow("Video", outputImage)
    key = cv2.waitKey(1) & 0xFF

    if key == ord("q"):
        break
    numFrames += 1

fps = video.get(cv2.CAP_PROP_FPS)
print("fps is: {:.2f}".format(fps))
video.release()

end = datetime.datetime.now()
Esempio n. 2
0
# the purpose of this code is to find fps
# so that we can figure out how does each detector/descriptor affect on fps rate
import cv2
import datetime
from myPackage.KeyPointDetectors import detectKeypoints

video = cv2.VideoCapture(0)

start = datetime.datetime.now()
numFrames = 0
while True:
    isGrabbed, frame = video.read()

    keypoints = detectKeypoints(frame)
    outputImage = keypoints.detectSURF()

    cv2.imshow("Video", outputImage)
    key = cv2.waitKey(1) & 0xFF

    if key == ord("q"):
        break
    numFrames += 1

fps = video.get(cv2.CAP_PROP_FPS)
print("fps is: {:.2f}".format(fps))
video.release()

end = datetime.datetime.now()
frameRate = numFrames / (end - start).total_seconds()
print("Approximate fps is %(fps)d: " % {"fps": frameRate})
Esempio n. 3
0
# the purpose of this code is to calculate the time needed to
# apply the detectors on different sets of images
from __future__ import print_function
from imutils import paths
from imutils.video import FPS
import cv2
from myPackage.KeyPointDetectors import detectKeypoints
import glob

totalTime = 0
for x in range(0, 99):
    subTotalTime = 0
    for imagePath in glob.glob("dataset/Images/Random/*"):

        image = cv2.imread(imagePath)

        fps = FPS().start()
        keyPoints = detectKeypoints(image)
        outputImage = keyPoints.detectFAST()
        fps.stop()
        subTotalTime = subTotalTime + fps.elapsed()

    totalTime = totalTime + subTotalTime

print("Average elapsed time: ", totalTime / 100)
from __future__ import print_function
import argparse
from imutils import paths
from imutils.video import FPS
import cv2
from myPackage.KeyPointDetectors import detectKeypoints

ap = argparse.ArgumentParser()
ap.add_argument("-d", "--dataset", required=True, help="Path to the image")
args = vars(ap.parse_args())


imagePaths = list(paths.list_images(args["dataset"]))
fps = FPS().start()
for (i, imagePath) in enumerate(imagePaths):
    filename = imagePath[imagePath.rfind("/") + 1:]
    image = cv2.imread(imagePath)

    SURF = detectKeypoints(image)
    outputImage = SURF.detectSURF()

    cv2.imshow("SIFT", outputImage)
    cv2.waitKey()
fps.stop()
print("Elasped time: {:.2f}".format(fps.elapsed()))
Esempio n. 5
0
# the purpose of this code is to calculate the time needed to
# apply the descriptors on different sets of images
from __future__ import print_function
from imutils import paths
from imutils.video import FPS
import cv2
from myPackage.KeyPointDetectors import detectKeypoints
from myPackage.KeyPointsDescriptors import computeKeypoints
import glob

totalTime = 0
for x in range(0, 99):
    subTotalTime = 0
    for imagePath in glob.glob("dataset/Images/Random/*"):

        image = cv2.imread(imagePath)

        ORB = detectKeypoints(image)
        (outputImage, keypoints) = ORB.detectORB(True)
        fps = FPS().start()
        SURF = computeKeypoints(image, keypoints)
        kps, des = SURF.computeSURF()
        fps.stop()
        subTotalTime = subTotalTime + fps.elapsed()
    totalTime = totalTime + subTotalTime

print("Average elapsed time: ", totalTime / 100)
from __future__ import print_function
import argparse
import cv2
from imutils import paths
from imutils.video import FPS
from myPackage.KeyPointDetectors import detectKeypoints

ap = argparse.ArgumentParser()
ap.add_argument("-d", "--dataset", required=True, help="Path to the image")
args = vars(ap.parse_args())


imagePaths = list(paths.list_images(args["dataset"]))
fps = FPS().start()
for (i, imagePath) in enumerate(imagePaths):
    filename = imagePath[imagePath.rfind("/") + 1:]
    image = cv2.imread(imagePath)

    HarrisKeyPoints = detectKeypoints(image)
    outputImage = HarrisKeyPoints.detectHarris()

    cv2.imshow("Harris", outputImage)
    cv2.waitKey()
fps.stop()
print("Elasped time: {:.2f}".format(fps.elapsed()))
from __future__ import print_function
import argparse
from imutils import paths
from imutils.video import FPS
import cv2
from myPackage.KeyPointDetectors import detectKeypoints

ap = argparse.ArgumentParser()
ap.add_argument("-d", "--dataset", required=True, help="Path to the image")
args = vars(ap.parse_args())

imagePaths = list(paths.list_images(args["dataset"]))
fps = FPS().start()
for (i, imagePath) in enumerate(imagePaths):
    filename = imagePath[imagePath.rfind("/") + 1:]
    image = cv2.imread(imagePath)

    SIFT = detectKeypoints(image)
    outputImage = SIFT.detectSIFT()

    cv2.imshow("SIFT", outputImage)
    cv2.waitKey()
fps.stop()
print("Elasped time: {:.2f}".format(fps.elapsed()))