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')
'''
Created on 09.05.2012

@author: Marcus
'''
from ImageProc import ImageProc

if __name__ == '__main__':
    template = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\template.bmp'))
    templateBright = ImageProc.brighten(template)    
    ImageProc.saveImage(templateBright, r'Images\template_bright.bmp')
    image = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\templa.png.bmp'))
    sample = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\Package142.bmp'))
    ImageProc.displayImage(sample, 'samp')
    ImageProc.displayImage(image, 'inverted')    
    for i in xrange(0, image.height):
        for j in xrange(0, image.width):
            if image[i, j] > 50:
                image[i, j] = 255
    ImageProc.displayImage(image, 'inverted2')
    ImageProc.saveImage(image, r'Images\templa_invert4')
                    
                
    
Esempio n. 3
0
"""
Created on 05.05.2012

@author: Marcus
"""
from ImageProc import ImageProc

if __name__ == "__main__":
    image = ImageProc.getGrayscaleImages(ImageProc.getImage(r"Bilder\Package142.bmp"))
    resultImage = ImageProc.getCanny(image)
    ImageProc.displayImage(image, "nocanny")
    ImageProc.displayImage(resultImage, "canny")
    ImageProc.saveImage(resultImage, r"Bilder\canny.png")
Esempio n. 4
0
'''
Created on 05.05.2012

@author: Marcus
'''
from ImageProc import ImageProc

if __name__ == '__main__':
    image = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\Package142.bmp'))
    resultImage = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\Package142.bmp'))
    template = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\template.bmp'))    
    res = ImageProc.templateMatching(image, template)
    ImageProc.saveImage(res, r'Images\templa.png')
    #image = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\templa.png.bmp'))
    #result = ImageProc.getBinaryImage(ImageProc.invert(image), 155)
                
    #ImageProc.displayImage(result, 'inv')
    
Esempio n. 5
0
'''
Created on 04.03.2012

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

if __name__ == '__main__': 
    image = ImageProc.getImage('t1.jpg')
    image = ImageProc.getGrayscaleImages(image) 
    image = ImageProc.transformToRange(image, 0, 4)   
    dm = [[1, 3], [2, 0]] 
    image = ImageProc.dither(image, dm)  
    ImageProc.displayImage(image, 'img')
Esempio n. 6
0
'''
Created on 10.04.2012

@author: Marcus
'''

from ImageProc import ImageProc
import cv
import os
if __name__ == '__main__':
    image = ImageProc.getGrayscaleImages(ImageProc.getImage("hough92.bmp"))    
    binary = ImageProc.getBinaryImage(image, 30)     
    d = ImageProc.distanceTransformation(binary)
    thres = ImageProc.valueBetweenThresholds(d, 20, 100)  
    '''Erosion'''
    
    ImageProc.displayImage(d, "d")
    ImageProc.displayImage(thres, "thres")
    
    
    
    
    
    """value = image[20, 20]
    for i in xrange(0, image.height):
            for j in xrange(0, image.width):
                if (image[i, j] == value):
                    image[i, j] = 0"""
    
    
Esempio n. 7
0
'''
Created on 09.05.2012

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

if __name__ == '__main__':
    image = ImageProc.getGrayscaleImages(ImageProc.getImage(r'Images\templa2.bmp'))
    '''minima = ImageProc.extractPartialImage(image, 0, 0)'''
    minima = ImageProc.countLocalMinima(image)
    ImageProc.saveImage(minima, r'Images\minima')
    ImageProc.displayImage(minima, 'minima')