Esempio n. 1
0
def main():
    
    # Read images from dir
    images = ImageProc.readFiles("Images/")
    
    # The result image
    resultImage = ImageProc.getImage(r'Images\Package142.bmp')
    
    # Image6 serves as an example image
    image6 = ImageProc.getImage(r'Images\Package142.bmp')
    
    # The template
    template = ImageProc.getImage(r'Images\Loetstelle2.bmp')
    
    # Convert the images to grayscale images
    grayImages = ImageProc.getGrayscaleImages(images) 
    
    # Convert the template to a grayscale image
    templateGray = ImageProc.getGrayscaleImages(template)
    
    # Calculate the keypoints and descriptors of the grayscale images
    keypointsImages = ImageProc.getKeypoints(grayImages)
    
    # Calculate the keypoints and descriptors of the grayscale template
    (keypointsTemplate, descriptorTemplate) = ImageProc.getKeypoints(templateGray)
    
    # Get the matching keypoints in the grayscale images for every keypoint in the grayscale template
    matches = ImageProc.filterMatches(ImageProc.getMatches(keypointsImages, (keypointsTemplate, descriptorTemplate)))   
    
    print ("Anzahl d. Loetstellen: " + str(len(matches)))    
    (keypoints6, desc6) = keypointsImages[5]
    
    # Draws the keypoints in the resulting images
    keypointsImage1 = ImageProc.drawKeypoints(image6, keypoints6)
    keypointsImage2 = ImageProc.drawKeypoints(template, keypointsTemplate)
    matchingKeypointsImage = ImageProc.drawKeypoints(resultImage, matches)
    ImageProc.safeMatches(matches)    
    #ImageProc.safeMatches(matches)
    
    # Displays the resulting images
    ImageProc.displayImage(ImageProc.getImage(r'Images\Package142.bmp'), 'image')
    ImageProc.displayImage(keypointsImage1, 'key1')
    ImageProc.displayImage(keypointsImage2, 'key2')
    ImageProc.displayImage(matchingKeypointsImage, 'matches')
Esempio n. 2
0
'''
Created on 15.03.2012

@author: Marcus
'''
from ImageProc import ImageProc
import cv
import os
if __name__ == '__main__':
    images = ImageProc.getGrayscaleImages(ImageProc.readFiles("../stack/"))
    resultImages = []    
    stack1 = images[57:70]
    stack2 = images[71:85]
    stack3 = images[86:108] 
    intervalls = [stack1, stack2, stack3]
    partialStacks = []
    partialResults = []
    partialLaplaceResults = []
    for stack in intervalls:
        partialStacks.append(ImageProc.buildPartialStacks(stack))    
    for partialStack in partialStacks[1]:
        partialResults.append(ImageProc.findHoughMax(partialStack))  
    i = 0
    print partialResults
    for partialResult in partialResults:
        partialLaplaceResults.append(ImageProc.getLaplace(partialResult))
    resultImage = ImageProc.appendPartialImages(partialResults)
    laplaceResultImage = ImageProc.appendPartialImages(partialLaplaceResults)
    ImageProc.displayImage(laplaceResultImage, "res")
    ImageProc.displayImage(resultImage, "res2")
Esempio n. 3
0
'''
Created on 23.02.2012

@author: Marcus
'''
from ImageProc import ImageProc
import cv
import os

if __name__ == '__main__':    
    images = ImageProc.getGrayscaleImages(ImageProc.readFiles("../Bilder/"))
    resultImages = []
    cannyResultImages = []
    stack1 = images[0:31]
    stack2 = images[59:65]
    stack3 = images[80:85]
    stack4 = images[92:102] 
    intervalls = [stack1, stack2, stack3, stack4]
    names = []
    for stack in intervalls:
        count = 0  
        resultImage = 0
        cannyResultImage = 0         
        for image in stack:            
            newCount = ImageProc.countWhitePixels(image, 70)
            if (newCount > count):
                count = newCount
                resultImage = (image, count)
                cannyResultImage = (ImageProc.getCanny(image), count)                
        resultImages.append(resultImage) 
        cannyResultImages.append(cannyResultImage)