def main(): imagePath = optcheck.getArguments()[0] image = highgui.openImage(imagePath) image = imgproc.detectLines(image, 100, 200) highgui.showImage("name", image) highgui.saveImage(image, highgui.getSavePath(imagePath, '11'))
def main(): (image1_path, image2_path) = optcheck.getArguments() image1 = highgui.openImage(image1_path) image2 = highgui.openImage(image2_path) imgproc.detectORBFeatures(image1, 96) imgproc.detectORBFeatures(image2, 96) matches = imgproc.matchORBFeatures(image1, image2, 96, 48) highgui.showImagesHorizontally("ORB feature detection", matches) highgui.saveImage(matches, 'Images\matchesEX13.png')
def main(): (image1_path, image2_path) = optcheck.getArguments() image1 = highgui.openImage(image1_path) image2 = highgui.openImage(image2_path) imgproc.detectCorners(image1) imgproc.detectCorners(image2) highgui.showImagesHorizontally("Corner feature detection", image1, image2) highgui.saveImage(image1, highgui.getSavePath(image1_path, '12')) highgui.saveImage(image2, highgui.getSavePath(image2_path, '12'))
import cv2 import sys import os.path import numpy from Modules import optcheck, highgui, imgproc #blots.png fullPath = optcheck.getArguments()[0] filepath, filename = os.path.split(fullPath) cv2.namedWindow(filename) image = cv2.imread(fullPath) size = 15 kernel = numpy.zeros( (size, size)) # de matrix zal de figuur uitsmeren naar rechtsonder for i in range(0, 7): kernel[i][i] = 1 / 7 filteredImage = cv2.imread(fullPath) cv2.filter2D(image, -1, kernel, filteredImage, (size - 1, size - 1)) highgui.showImagesHorizontally(filename, image, filteredImage) filename, extension = filename.split(".") savePath = filepath + "\\" + filename + "EX6." + extension highgui.saveImage(filteredImage, savePath)
def main(): imagePath = optcheck.getArguments()[0] image = highgui.openImage(imagePath) result = imgproc.extractEdges(image, -15) highgui.showImage(imagePath, result) highgui.saveImage(result, highgui.getSavePath(imagePath, '10'))
import cv2 import numpy import os from Modules import optcheck, highgui, imgproc import pickle from pathlib import Path #shadow_box.png imagePath = optcheck.getArguments()[0] windowName = imagePath image = highgui.openImage(imagePath) image = cv2.resize(src=image, dsize=(1000, 1000)) cv2.imshow(windowName, image) filepath, filename = os.path.split(imagePath) filename, extension = filename.split(".") src = numpy.array([[0, 0], [0, 0], [0, 0], [0, 0]], numpy.float32) dst = numpy.array([[100, 200], [200, 200], [200, 500], [100, 500]], numpy.float32) # predefined coördinates of the rectangle def onMouse(event, x, y, flags, userdata): global mouseClicks, image, windowName, imagePath if (cv2.EVENT_LBUTTONDOWN == event and mouseClicks < 4): src[mouseClicks] = [x, y] mouseClicks += 1 if (mouseClicks == 4): mouseClicks += 1 # increase one more time so this function will basically do nothing anymore for i in range(0, 3): cv2.line(img=image,