matchFilename = os.path.join(path, 'crowd.jpg') matchFilename = os.path.join(path, 'giza.jpg') matchFilename = os.path.join(path, 'lenna.tif') im = cv2.imread(filename, cv2.IMREAD_UNCHANGED) print('Filename = {0}'.format(filename)) print('Data type = {0}'.format(type(im))) print('Image shape = {0}'.format(im.shape)) print('Image size = {0}'.format(im.size)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) print('Linear 2% ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='linear2') print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Linear 2%)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Linear 2%)', enhancedImage) print('Linear 1% ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='linear1') print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Linear 1%)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Linear 1%)', enhancedImage) #print('Equalized ...') #startTime = time.time() #enhancedImage = ipcv.histogram_enhancement(im, etype='equalize') #print('Elapsed time = {0} [s]'.format(time.time() - startTime))
import time home = os.path.expanduser('~') filename = home + os.path.sep + 'src/python/examples/data/lenna.tif' filename = home + os.path.sep + 'src/python/examples/data/giza.jpg' im = cv2.imread(filename) frequencyFilter = ipcv.filter_lowpass(im, 16, filterShape=ipcv.IPCV_GAUSSIAN) startTime = time.clock() offset = 0 filteredImage = ipcv.frequency_filter(im, frequencyFilter, delta=offset) filteredImage = numpy.abs(filteredImage) filteredImage = filteredImage.astype(dtype=numpy.uint8) elapsedTime = time.clock() - startTime print('Elapsed time (frequency_filter)= {0} [s]'.format(elapsedTime)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) cv2.imshow(filename, ipcv.histogram_enhancement(im)) filterName = 'Filtered (' + filename + ')' cv2.namedWindow(filterName, cv2.WINDOW_AUTOSIZE) cv2.imshow(filterName, filteredImage) cv2.imshow(filterName, ipcv.histogram_enhancement(filteredImage)) ipcv.flush()
#matchFilename = home + os.path.sep + 'src/python/examples/data/photo1.png' #matchFilename = home + os.path.sep + 'src/python/examples/data/gecko.jpg' #matchFilename = home + os.path.sep + 'src/python/examples/data/000044290016.jpg' matchFilename = home + os.path.sep + 'src/python/examples/data/Some Wack Shit.tif' im = cv2.imread(filename, cv2.IMREAD_UNCHANGED) print('Filename = {0}'.format(filename)) print('Data type = {0}'.format(type(im))) print('Image shape = {0}'.format(im.shape)) print('Image size = {0}'.format(im.size)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) tgtIm = cv2.imread(matchFilename, cv2.IMREAD_UNCHANGED) tgtPDF = numpy.ones(256) / 256 print('Matched (Distribution) ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='equalize', target=tgtPDF, userInputs=False, showHistogram=True) print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Matched - Distribution)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Matched - Distribution)', enhancedImage) cv2.imwrite('testVillage.tif', enhancedImage) action = ipcv.flush()
matchFilename = home + os.path.sep + 'src/python/examples/data/redhat.ppm' matchFilename = home + os.path.sep + 'src/python/examples/data/giza.jpg' matchFilename = home + os.path.sep + 'src/python/examples/data/crowd.jpg' im = cv2.imread(filename, cv2.IMREAD_UNCHANGED) print('Filename = {0}'.format(filename)) print('Data type = {0}'.format(type(im))) print('Image shape = {0}'.format(im.shape)) print('Image size = {0}'.format(im.size)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) print('Linear 2% ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='linear2') print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Linear 2%)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Linear 2%)', enhancedImage) print('Linear 1% ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='linear1') print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Linear 1%)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Linear 1%)', enhancedImage) print('Equalized ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='equalize') print('Elapsed time = {0} [s]'.format(time.time() - startTime))
#matchFilename = home + os.path.sep + 'src/python/examples/data/lenna.tif' #matchFilename = home + os.path.sep + 'src/python/examples/data/redhat.ppm' #matchFilename = home + os.path.sep + 'src/python/examples/data/crowd.jpg' im = cv2.imread(filename, cv2.IMREAD_UNCHANGED) print('Filename = {0}'.format(filename)) print('Data type = {0}'.format(type(im))) print('Image shape = {0}'.format(im.shape)) print('Image size = {0}'.format(im.size)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) print('Linear 2% ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='linear2') print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Linear 2%)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Linear 2%)', enhancedImage) print('Linear 1% ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='linear1') print('Elapsed time = {0} [s]'.format(time.time() - startTime)) cv2.namedWindow(filename + ' (Linear 1%)', cv2.WINDOW_AUTOSIZE) cv2.imshow(filename + ' (Linear 1%)', enhancedImage) print('Equalized ...') startTime = time.time() enhancedImage = ipcv.histogram_enhancement(im, etype='equalize') print('Elapsed time = {0} [s]'.format(time.time() - startTime))
home = os.path.expanduser('~') filename = home + os.path.sep + 'src/python/examples/data/giza.jpg' filename = home + os.path.sep + 'src/python/examples/data/checkerboard.tif' filename = home + os.path.sep + 'src/python/examples/data/lenna.tif' im = cv2.imread(filename) frequencyFilter = ipcv.filter_bandpass(im, 32, 10, filterShape=ipcv.IPCV_GAUSSIAN) startTime = time.clock() offset = 0 filteredImage = ipcv.frequency_filter(im, frequencyFilter, delta=offset) filteredImage = numpy.abs(filteredImage) filteredImage = filteredImage.astype(dtype=numpy.uint8) elapsedTime = time.clock() - startTime print('Elapsed time (frequency_filter)= {0} [s]'.format(elapsedTime)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) cv2.imshow(filename, ipcv.histogram_enhancement(im)) filterName = 'Filtered (' + filename + ')' cv2.namedWindow(filterName, cv2.WINDOW_AUTOSIZE) cv2.imshow(filterName, filteredImage) cv2.imshow(filterName, ipcv.histogram_enhancement(filteredImage)) ipcv.flush()