def __init__(self): Filter_base.__init__(self) self.i_bwrgb = 'BW or RGB' self.i_ch1 = 'Ch 1, Red' self.i_ch2 = 'Ch 2, Green' self.i_ch3 = 'Ch 3, Blue' self.setupInputsOutputs( [self.i_bwrgb, self.i_ch1, self.i_ch2, self.i_ch3], []) self.description = "\ Display a image in the viewer window. \ If the input images' pixels are not all in the [0,1] range, \ they will get compressed into this range by the 'remap'-function. \n\ If something is connected to the 'B&W or RGB' input, all other inputs \ will be ignored.\ " self.painted = False self.visible = True self.addParam( Parameter(name='Resize (%)', param_type='variable', default=100, minimum=0, maximum=200, rank=1)) self.addParam( Parameter(name='Resize method', param_type='list', default='Bilinear', other_content=['Bilinear', 'Nearest-neighbor'], rank=0.5) ) #Bicubic not offered because of deviating behavior on floating point images. self.pixmap = None self.filtertype = OUTPUT_FILTER
def __init__(self): Filter_base.__init__(self) self.description = "Automatically crop and rotate a frame from a 3:2 aspect ratio picture" self.i_image = "Input image" self.i_lines = "Lines" self.o_output = "Output" self.setupInputsOutputs([self.i_image, self.i_lines], [self.o_output])
def __init__(self): Filter_base.__init__(self) self.description = "\ Will convolve the input image with a specified Gabor kernel. \ Please note that the kernel size at the moment is fixed at 21 pixels. \ Feel free to edit the code to add an autoadjusted kernel size for \ improved performance. \ " self.i_input = 'Input' self.o_gabor = 'Gabor filtered' self.setupInputsOutputs([self.i_input], [self.o_gabor]) self.addParam( Parameter(name="Kernel",param_type="display",rank=0)) self.addParam( Parameter(name='Frequency (cycles / 100 pixels)', param_type='variable', default=10, minimum=2, maximum=50, rank=1) ) self.addParam( Parameter(name='Kernel angle (degrees)', param_type='variable', default=45.0, minimum=0.0, maximum=180, rank=2) ) self.addParam( Parameter(name='Scale (pixels)', param_type='variable', default=3, minimum=1, maximum=20, rank=3) ) self.addParam( Parameter(name='Aspect ratio', param_type='variable', default=0.8, minimum=0, maximum=2, rank=4) ) self.addParam( Parameter(name='Phase (degrees)', param_type='variable', default=0, minimum=-180, maximum=180, rank=1.5) ) self.addParam( Parameter(name="Output only positive pixels", param_type="list", default="No", other_content=["No","Yes"], rank=6)) self.addParam( Parameter(name='Field of view (degrees)', param_type='variable', default=45, minimum=2, maximum=180, rank=5, description="[Does nothing. Not yet implemented.]") ) self.last_kernel = None self.last_params = None self.kernel_fig = None self.kernel_plt = None self.kernelSize = None
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(['Input'], ['Output']) self.description = "Use the Canny algorithm to detect edges. Input must be 8-bit." self.addParam( Parameter(name="First threshold", param_type='variable', default=50, minimum=0, maximum=600, rank=1)) self.addParam( Parameter(name="Second threshold", param_type='variable', default=150, minimum=0, maximum=600, rank=2)) self.addParam( Parameter(name="Aperture size", param_type='list', description="Aperture of the sobel operator.", default="3", other_content=["1", "3", "5", "7"], rank=3))
def __init__(self): Filter_base.__init__(self) self.description = "Resize the input image's dimensions by various methods. \ IMPORTANT IMPLEMENTATION NOTE: If the input pixels have float type and 'Bicubic' is chosen, \ the output image will be clipped to the minimum and maximum pixel values of the input image \ to ensure similar result to the other methods." self.setupInputsOutputs(['Input 1','Input 2','Input 3'], ['Output 1','Output 2','Output 3']) self.addParam( Parameter(name='Resize by', param_type='list', default='percent and aspect ratio', other_content=['percent and aspect ratio', 'width and height', 'width and automatic height', 'height and automatic width'], rank=0) ) self.addParam( Parameter(name='Percent of original size', param_type='variable', default=100, minimum=0, maximum=200, rank=1) ) self.addParam( Parameter(name='Aspect ratio (width:height)', param_type='variable', default=1, minimum=0.2, maximum=2, rank=2) ) self.addParam( Parameter(name='New height', param_type='variable', default=640, minimum=64, maximum=2048, rank=3) ) self.addParam( Parameter(name='New width', param_type='variable', default=640, minimum=64, maximum=2048, rank=4) ) self.addParam( Parameter(name='Resize method', param_type='list', default='Bilinear', other_content=['Bilinear', 'Nearest-neighbor','Bicubic'], rank=0.5) )
def __init__(self): Filter_base.__init__(self) self.i_input = "Input" self.o_output = "Output" self.setupInputsOutputs([self.i_input], [self.o_output]) self.addParam( Parameter(name="Sensitivity reduction", param_type="variable", default=1,minimum=0,maximum=1, rank=1.0) )
def __init__(self): Filter_base.__init__(self) self.description = "Convert the input image to a new colorspace" self.setupInputsOutputs(['Input 1','Input 2','Input 3'], ['Output 1', 'Output 2', 'Output 3', "3ch output"]) self.addParam( Parameter(name='Transformation', param_type='list', default='RGB->HLS', other_content=choices.keys() ))
def __init__(self): Filter_base.__init__(self) self.description = "\ Save the input to single file on the hard drive, \ or to a numbered image file sequence. Input on first input \ is prioritized." self.setupInputsOutputs(['BW,RGB,array','Red', 'Green', 'Blue'], []) self.addParam( Parameter(name='Save file', param_type='file', description="Select a place and name to save the image. \ Enabled filetypes are PNG, JPG, BMP, TIFF, or TXT (textfile)", rank=0) ) self.addParam( Parameter(name='Save mode', param_type='list', default='Overwrite single', other_content=['Overwrite single','Save sequence'], description='Select if a single file should be overwritten \ over and over, or if a numbered sequence of files should be saved.', rank=1) ) self.addParam( Parameter(name="Notification on file write", param_type='list', default='Yes', other_content=['Yes','No'], rank=9) ) self.sequence_no = 0 self.last_file = None self.filtertype = OUTPUT_FILTER
def __init__(self): Filter_base.__init__(self) self.description = "\ Save the input to single file on the hard drive, \ or to a numbered image file sequence. Input on first input \ is prioritized." self.setupInputsOutputs(['BW,RGB,array', 'Red', 'Green', 'Blue'], []) self.addParam( Parameter(name='Save file', param_type='file', description="Select a place and name to save the image. \ Enabled filetypes are PNG, JPG, BMP, TIFF, or TXT (textfile)", rank=0)) self.addParam( Parameter( name='Save mode', param_type='list', default='Overwrite single', other_content=['Overwrite single', 'Save sequence'], description='Select if a single file should be overwritten \ over and over, or if a numbered sequence of files should be saved.', rank=1)) self.addParam( Parameter(name="Notification on file write", param_type='list', default='Yes', other_content=['Yes', 'No'], rank=9)) self.sequence_no = 0 self.last_file = None self.filtertype = OUTPUT_FILTER
def __init__(self): Filter_base.__init__(self) self.description = "Crop the image dimensions." self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Center x-position", param_type="variable", default=0, minimum=0, maximum=2048, rank=0)) self.addParam( Parameter(name="Center y-position", param_type="variable", default=0, minimum=0, maximum=2048, rank=1)) self.addParam( Parameter(name="Width", param_type="variable", default=320, minimum=0, maximum=2048, rank=2)) self.addParam( Parameter(name="Height", param_type="variable", default=240, minimum=0, maximum=2048, rank=3))
def __init__(self): Filter_base.__init__(self) self.description = "\ Convert the channels in the input RGB-image to \ opponent colors channels by simple pixel arithmetic.\ Note that all inputs have to be connected for the filter to work." self.setupInputsOutputs(['Red','Green','Blue'], ['Red-Green','Blue-Yellow','Brightness'])
def __init__(self): Filter_base.__init__(self) self.description = "Split the input image into four new images." self.setupInputsOutputs(["Input"], ["Upper left","Upper right","Lower left","Lower right"]) self.addParam( Parameter(name="Split horizontally at:", param_type="variable", default=0, minimum=0,maximum=2048) ) self.addParam( Parameter(name="Split vertically at:", param_type="variable", default=0, minimum=0,maximum=2048) )
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(["Input"], ["Output"]) self.description = "\ Will act as a time lag and output the n'th frame before \ the current one. n=0: Current frame, n=1: Previous frame\ " self.addParam( Parameter(name="Input interval (frames)", param_type="text", rank=0, default="1") ) self.past_frames = []
def __init__(self): Filter_base.__init__(self) self.description = "Clip the pixel values of an image to a specified range." self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Maximum threshhold", param_type="variable", default=1, minimum=-4, maximum=4, rank=0) ) self.addParam( Parameter(name="Minimum threshhold", param_type="variable", default=0, minimum=-4, maximum=4, rank=1) )
def __init__(self): Filter_base.__init__(self) self.description = "Rotate the input image by 90-degrees increments or flip it." self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Rotate:", param_type="list", default="Rotate upside-down", other_content=["No", "Rotate left","Rotate right","Rotate upside-down"]) ) self.addParam( Parameter(name="Flip:", param_type="list", default="No", other_content=["No","Vertically","Horizontally"]) )
def __init__(self): Filter_base.__init__(self) self.description = "Convert the input image to a new colorspace" self.setupInputsOutputs( ['Input 1', 'Input 2', 'Input 3'], ['Output 1', 'Output 2', 'Output 3', "3ch output"]) self.addParam( Parameter(name='Transformation', param_type='list', default='RGB->HLS', other_content=choices.keys()))
def __init__(self): Filter_base.__init__(self) self.description = "Crop the image dimensions." self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Center x-position", param_type="variable", default=0, minimum=0,maximum=2048, rank=0) ) self.addParam( Parameter(name="Center y-position", param_type="variable", default=0, minimum=0,maximum=2048, rank=1) ) self.addParam( Parameter(name="Width", param_type="variable", default=320, minimum=0,maximum=2048, rank=2) ) self.addParam( Parameter(name="Height", param_type="variable", default=240, minimum=0,maximum=2048, rank=3) )
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(['Input'], ['Output']) self.description = "Use the Canny algorithm to detect edges. Input must be 8-bit." self.addParam( Parameter(name="First threshold", param_type='variable', default=50, minimum=0, maximum=600, rank=1) ) self.addParam( Parameter(name="Second threshold", param_type='variable', default=150, minimum=0, maximum=600, rank=2) ) self.addParam( Parameter(name="Aperture size", param_type='list', description="Aperture of the sobel operator.", default="3", other_content=["1","3","5","7"], rank=3) )
def __init__(self): Filter_base.__init__(self) self.i_input = "Input" self.o_output = "Output" self.setupInputsOutputs([self.i_input], [self.o_output]) self.addParam( Parameter(name="Sensitivity reduction", param_type="variable", default=1, minimum=0, maximum=1, rank=1.0))
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(['Input'], ['RGB Overlay', 'Lines data']) self.description = "Use the Hough transform to detect lines from an edge detected image." self.addParam( Parameter(name="Type of Hough transform", param_type='list', default="Standard", other_content=["Standard", "Probabilistic"], rank=-1)) self.addParam( Parameter(name="Distance resolution", param_type='variable', default=1, minimum=1, maximum=50, rank=1)) self.addParam( Parameter(name="Angle resolution (degrees)", param_type='variable', default=150, minimum=1, maximum=600, rank=2)) self.addParam( Parameter(name="Accumulator threshold", param_type='variable', default=150, minimum=0, maximum=600, rank=3)) self.addParam( Parameter(name="Minimum length", param_type='variable', default=50, minimum=0, maximum=600, rank=4)) self.addParam( Parameter(name="Maximum gap", param_type='variable', default=0, minimum=0, maximum=100, rank=5)) self.addParam( Parameter(name="draw # lines", param_type='variable', default=100, minimum=0, maximum=1000, rank=5))
def __init__(self): Filter_base.__init__(self) self.description = "Blend several pictures together by simple weighting." self.i_input1 = 'Input 1' self.i_input2 = 'Input 2' self.i_input3 = 'Input 3' self.i_input4 = 'Input 4' self.o_output = 'Output' self.setupInputsOutputs([self.i_input1,self.i_input2,self.i_input3,self.i_input4], [self.o_output]) for ind,input_name in enumerate(self.input_names): self.addParam( Parameter(name=input_name+' weight',param_type='variable', default=1,minimum=0,maximum=5, rank=ind))
def __init__(self): Filter_base.__init__(self) self.description = "\ Apply an intensity transformation curve to the input image, \ by mapping old curve values to new ones via a \ look-up table created by linear interpolation.\ " self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Curve plot", param_type="display", rank=0)) self.addParam( Parameter(name="Function/points input", param_type="codebox", rank=1, default=("""\ k = (t-s)/(d-c) m = -k*c+s intervals = [ [(vmin,c), s ], [(c,d), k*x+m ], [(d,vmax), t ] ]\n""") ) ) self.addParam( Parameter(name="c variable", param_type="variable", default=0.25, minimum=0,maximum=1, rank=1) ) self.addParam( Parameter(name="d variable", param_type="variable", default=0.75, minimum=0,maximum=1, rank=2) ) self.addParam( Parameter(name="s variable", param_type="variable", default=0.1, minimum=0,maximum=1, rank=3) ) self.addParam( Parameter(name="t variable", param_type="variable", default=0.9, minimum=0,maximum=1, rank=4) ) self.addParam( Parameter(name="Interpolation resolution", param_type="variable", default=256, minimum=4,maximum=1024, rank=6, description="Number of data points from which to interpolate.") ) self.addParam( Parameter(name="Min pixel value", param_type="variable", default=0, minimum=0,maximum=1, rank=7, description="Start applying curve at this pixel value (vmin).") ) self.addParam( Parameter(name="Max pixel value", param_type="variable", default=1, minimum=0,maximum=1, rank=8, description="Stop applying curve at this pixel value (vmax).") ) self.curve_fig = None self.curve_graph = None self.curve = None self.expression = None self.last_max = None self.last_min = None self.last_res = None self.last_indexes = None self.last_cvar = None self.last_tvar = None self.last_svar = None self.last_dvar = None try: self.processParams() #Create a curve graph from the moment of creation. except Exception: pass
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(["Input"], ["Output"]) self.description = "\ Will act as a time lag and output the n'th frame before \ the current one. n=0: Current frame, n=1: Previous frame\ " self.addParam( Parameter(name="Input interval (frames)", param_type="text", rank=0, default="1")) self.past_frames = []
def __init__(self): Filter_base.__init__(self) self.description = "Simulate different color blindnesses. " self.i_red = 'Red' self.i_green = 'Green' self.i_blue = 'Blue' self.o_red = 'Red' self.o_green = 'Green' self.o_blue = 'Blue' self.setupInputsOutputs([self.i_red,self.i_green,self.i_blue], [self.o_red,self.o_green,self.o_blue]) self.addParam( Parameter(name="Type of blindness", param_type='list', default="Protanope", other_content=["None","Protanope", "Deuteranope"]))
def __init__(self): Filter_base.__init__(self) self.description = "Rotate the input image by 90-degrees increments or flip it." self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Rotate:", param_type="list", default="Rotate upside-down", other_content=[ "No", "Rotate left", "Rotate right", "Rotate upside-down" ])) self.addParam( Parameter(name="Flip:", param_type="list", default="No", other_content=["No", "Vertically", "Horizontally"]))
def __init__(self): Filter_base.__init__(self) self.filtertype = OUTPUT_FILTER self.description = "Produce a histogram of the input image" self.addParam( Parameter(name="Display width (pixels)", param_type='variable', default=400, maximum=600, minimum=50)) self.addParam( Parameter(name="Display height (pixels)", param_type='variable', default=200, maximum=600, minimum=50)) self.addParam( Parameter(name="Plot histogram", param_type='list', default="Yes", other_content=["Yes", "No"], rank=0)) self.addParam( Parameter(name="# of bins", param_type='variable', default=255, maximum=255, minimum=2)) self.addParam( Parameter(name="Log", param_type='list', default='No', other_content=['Yes', 'No'])) self.addParam( Parameter(name="Normalize", param_type='list', default='Yes', other_content=['Yes', 'No'])) self.setupInputsOutputs(['Input'], ['Histogram', 'Bins']) self.hist_fig = None self.hist_axis = None self.hist_curve = None self.last_width = None self.last_height = None self.pixmap = None
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(['Input'], ['Output']) self.description = "Smooth the image. \nTo disable all smoothing, set all sliders to zero." self.addParam( Parameter(name='Smoothing method', param_type='list', default='Gaussian', other_content=['Gaussian','Box blur', 'Median - input must be 8-bit'], rank=0) ) self.addParam( Parameter(name='Smoothing kernel width', param_type='variable', description="Will be rounded to an odd number or zero.", default=3, minimum=0, maximum=15, rank=1) ) self.addParam( Parameter(name="Smoothing kernel height", param_type='variable', description="Is set to equal the kernel width if zero.", default=0, minimum=0, maximum=15, rank=2) ) self.addParam( Parameter(name='Gaussian standard deviation', param_type='variable', description="Will be calculated automatically if zero.\ If not zero while the kernel size is, \ a suitable kernel size will be calculated.", default=0, minimum=0, maximum=15, rank=3) )
def __init__(self): Filter_base.__init__(self) self.description = "Clip the pixel values of an image to a specified range." self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Maximum threshhold", param_type="variable", default=1, minimum=-4, maximum=4, rank=0)) self.addParam( Parameter(name="Minimum threshhold", param_type="variable", default=0, minimum=-4, maximum=4, rank=1))
def __init__(self): Filter_base.__init__(self) self.description = "Simulate different color blindnesses. " self.i_red = 'Red' self.i_green = 'Green' self.i_blue = 'Blue' self.o_red = 'Red' self.o_green = 'Green' self.o_blue = 'Blue' self.setupInputsOutputs([self.i_red, self.i_green, self.i_blue], [self.o_red, self.o_green, self.o_blue]) self.addParam( Parameter(name="Type of blindness", param_type='list', default="Protanope", other_content=["None", "Protanope", "Deuteranope"]))
def __init__(self): Filter_base.__init__(self) self.description = "Split the input image into four new images." self.setupInputsOutputs( ["Input"], ["Upper left", "Upper right", "Lower left", "Lower right"]) self.addParam( Parameter(name="Split horizontally at:", param_type="variable", default=0, minimum=0, maximum=2048)) self.addParam( Parameter(name="Split vertically at:", param_type="variable", default=0, minimum=0, maximum=2048))
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(['Input'], ['RGB Overlay','Lines data']) self.description = "Use the Hough transform to detect lines from an edge detected image." self.addParam( Parameter(name="Type of Hough transform", param_type='list', default="Standard", other_content=["Standard","Probabilistic"], rank=-1) ) self.addParam( Parameter(name="Distance resolution", param_type='variable', default=1, minimum=1, maximum=50, rank=1) ) self.addParam( Parameter(name="Angle resolution (degrees)", param_type='variable', default=150, minimum=1, maximum=600, rank=2) ) self.addParam( Parameter(name="Accumulator threshold", param_type='variable', default=150, minimum=0, maximum=600, rank=3) ) self.addParam( Parameter(name="Minimum length", param_type='variable', default=50, minimum=0, maximum=600, rank=4) ) self.addParam( Parameter(name="Maximum gap", param_type='variable', default=0, minimum=0, maximum=100, rank=5) ) self.addParam( Parameter(name="draw # lines", param_type='variable', default=100, minimum=0, maximum=1000, rank=5) )
def __init__(self): Filter_base.__init__(self) self.description = "\ Load frames from image file, video file or camera. \ The 'original' output type is faster \ than floating point output since no scaling is necessary. \ However, some filters might require floating point input and vice versa.\ If source is monochrome, the output on all channels will be identical" self.o_rgb = "RGB" self.o_red = "Red" self.o_green = "Green" self.o_blue = "Blue" self.setupInputsOutputs([], [self.o_rgb, self.o_red, self.o_green, self.o_blue]) directory, tmp = os.path.split( os.path.dirname(__file__).rstrip('/\\') ) self.addParam( Parameter(name='Input type', param_type='list', default='Image file', other_content=['Camera','Video file','Image file','Image sequence'], rank=0) ) self.addParam( Parameter(name='Image file', description="Select a single image file to be processed repeatedly, \ or select the first image in a sequence to be processed.", param_type='file', rank=1) ) self.setParamContent('Image file', os.path.join(directory,'house.jpg')) self.addParam( Parameter(name='Video file', param_type='file', rank=4) ) self.addParam( Parameter(name='Output type', param_type='list', default='as float, range 0-1', other_content=['original', 'as float, range 0-1'], rank=5)) self.addParam( Parameter(name='Loop video or sequence', param_type='list', default='No', other_content=['No','Yes'], rank=7)) self.addParam( Parameter(name='Camera to use', param_type='list', default='0', other_content=[0,1,2,3,4], rank=8)) self.loaded_image = None self.vid_cap = None self.cam_cap = None self.last_video_path = None self.last_image_path = None self.camera_to_use = None self.image_sequence = None self.last_sequence_dir = None self.next_sequence_ind = 0 self.frame_counter = 0 self.output_names self.filtertype = SOURCE_FILTER
def __init__(self): Filter_base.__init__(self) self.description = "\ Take the fourier transform or it's inverse of the input image. \ The 'Real' output will always provide the real portion of the selected transform. \ If 'Output complex on 'Imag'' is set to 'Yes', the 'Imag' output will \ output complex numbers (complex datatype) instead of just the imaginary part of the transform. \ Complex matrices as input on either of the inputs will be autodetected, and if nothing \ is connected to the other input, the corresponding part (real or imaginary) of the matrix \ will be copied to the empty input." self.setupInputsOutputs([i_REAL,i_IMAG], [o_REAL,o_IMAG]) self.addParam( Parameter(name="Direction of transform", param_type="list",default="Transform", rank=0, other_content=["Transform","Inverse transform"])) self.addParam( Parameter(name="Shift origin", param_type="list",default="No", other_content=["Yes, shift output", "Yes, shift input", "Yes, shift both", "No", ])) self.addParam( Parameter(name="Output complex on 'Imag'", param_type="list", default="No", other_content=["Yes", "No"])) self.addParam( Parameter(name="Use complex single input", param_type="list", default="Yes", other_content=["Yes", "No"]))
def __init__(self): Filter_base.__init__(self) self.description = "\ Take the fourier transform or it's inverse of the input image. \ The 'Real' output will always provide the real portion of the selected transform. \ If 'Output complex on 'Imag'' is set to 'Yes', the 'Imag' output will \ output complex numbers (complex datatype) instead of just the imaginary part of the transform. \ Complex matrices as input on either of the inputs will be autodetected, and if nothing \ is connected to the other input, the corresponding part (real or imaginary) of the matrix \ will be copied to the empty input." self.setupInputsOutputs([i_REAL, i_IMAG], [o_REAL, o_IMAG]) self.addParam( Parameter(name="Direction of transform", param_type="list", default="Transform", rank=0, other_content=["Transform", "Inverse transform"])) self.addParam( Parameter(name="Shift origin", param_type="list", default="No", other_content=[ "Yes, shift output", "Yes, shift input", "Yes, shift both", "No", ])) self.addParam( Parameter(name="Output complex on 'Imag'", param_type="list", default="No", other_content=["Yes", "No"])) self.addParam( Parameter(name="Use complex single input", param_type="list", default="Yes", other_content=["Yes", "No"]))
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(["Input"], ["Output"]) self.description = "Linearly remap the input image's pixel value range to a new range." self.addParam( Parameter(description="Put exactly equal to 'End of old range' \ to automatically set this value to the lowest pixel value in the current image \ (this span may change between images)", name="Start of old range", param_type="variable", default=0, minimum=-4, maximum=4, rank=1)) self.addParam( Parameter(description="Put exactly equal to 'Start of old range' \ to automatically set this value to the highest pixel value in the current image \ (this span may change between images)", name="End of old range", param_type="variable", default=0, minimum=-4, maximum=4, rank=2)) self.addParam( Parameter(name="Start of new range", param_type="variable", default=0, minimum=-4, maximum=4, rank=3)) self.addParam( Parameter(name="End of new range", param_type="variable", default=1, minimum=-4, maximum=4, rank=4))
def __init__(self): Filter_base.__init__(self) self.filtertype = OUTPUT_FILTER self.description = "Produce a histogram of the input image" self.addParam( Parameter(name="Display width (pixels)", param_type='variable', default=400, maximum=600, minimum=50) ) self.addParam( Parameter(name="Display height (pixels)", param_type='variable', default=200, maximum=600, minimum=50) ) self.addParam( Parameter(name="Plot histogram", param_type='list', default="Yes", other_content=["Yes","No"], rank=0)) self.addParam( Parameter(name="# of bins", param_type='variable', default=255, maximum=255, minimum=2) ) self.addParam( Parameter(name="Log", param_type='list', default='No', other_content=['Yes','No']) ) self.addParam( Parameter(name="Normalize", param_type='list', default='Yes', other_content=['Yes','No']) ) self.setupInputsOutputs(['Input'],['Histogram','Bins']) self.hist_fig = None self.hist_axis = None self.hist_curve = None self.last_width = None self.last_height = None self.pixmap = None
def __init__(self): Filter_base.__init__(self) self.i_bwrgb = 'BW or RGB' self.i_ch1 = 'Ch 1, Red' self.i_ch2 = 'Ch 2, Green' self.i_ch3 = 'Ch 3, Blue' self.setupInputsOutputs([self.i_bwrgb,self.i_ch1,self.i_ch2,self.i_ch3], [] ) self.description = "\ Display a image in the viewer window. \ If the input images' pixels are not all in the [0,1] range, \ they will get compressed into this range by the 'remap'-function. \n\ If something is connected to the 'B&W or RGB' input, all other inputs \ will be ignored.\ " self.painted = False self.visible = True self.addParam( Parameter(name='Resize (%)', param_type='variable', default=100, minimum=0, maximum=200, rank=1) ) self.addParam( Parameter(name='Resize method', param_type='list', default='Bilinear', other_content=['Bilinear', 'Nearest-neighbor'], rank=0.5) ) #Bicubic not offered because of deviating behavior on floating point images. self.pixmap = None self.filtertype = OUTPUT_FILTER
def __init__(self): Filter_base.__init__(self) self.setupInputsOutputs(["inA", "inB", "inC"], ["outA","outB","outB"]) self.description = "\ Specify any operations to apply to the input data. \ The command line input will be interpreted as a regular \ python command, so please be very careful not to do anything dangerous. \ If nothing is connected to an input, that input will be set as a scalar zero." self.addParam( Parameter(name="Code for imports", param_type="codebox", default="import numpy as np\n\n\n", rank=0, description="\ This code will only run once upon each edit, and make the declared names \ available in the processing code field below.") ) self.addParam( Parameter(name="Processing code", param_type="codebox", rank=7, default="outA = inA*x-inB*y-inC*z\n\n\n\n\n\n\n\n\n\n") ) self.addParam( Parameter(name="Variable x", param_type="variable", default=1, maximum=1, minimum=0, rank=1)) self.addParam( Parameter(name="Variable y", param_type="variable", default=1, maximum=1, minimum=0, rank=2)) self.addParam( Parameter(name="Variable z", param_type="variable", default=1, maximum=1, minimum=0, rank=3)) self.import_code = "" self.last_code = "" self.compcode = None
def __init__(self): Filter_base.__init__(self) self.description = "\ Will convolve the input image with a specified Gabor kernel. \ Please note that the kernel size at the moment is fixed at 21 pixels. \ Feel free to edit the code to add an autoadjusted kernel size for \ improved performance. \ " self.i_input = 'Input' self.o_gabor = 'Gabor filtered' self.setupInputsOutputs([self.i_input], [self.o_gabor]) self.addParam(Parameter(name="Kernel", param_type="display", rank=0)) self.addParam( Parameter(name='Frequency (cycles / 100 pixels)', param_type='variable', default=10, minimum=2, maximum=50, rank=1)) self.addParam( Parameter(name='Kernel angle (degrees)', param_type='variable', default=45.0, minimum=0.0, maximum=180, rank=2)) self.addParam( Parameter(name='Scale (pixels)', param_type='variable', default=3, minimum=1, maximum=20, rank=3)) self.addParam( Parameter(name='Aspect ratio', param_type='variable', default=0.8, minimum=0, maximum=2, rank=4)) self.addParam( Parameter(name='Phase (degrees)', param_type='variable', default=0, minimum=-180, maximum=180, rank=1.5)) self.addParam( Parameter(name="Output only positive pixels", param_type="list", default="No", other_content=["No", "Yes"], rank=6)) self.addParam( Parameter(name='Field of view (degrees)', param_type='variable', default=45, minimum=2, maximum=180, rank=5, description="[Does nothing. Not yet implemented.]")) self.last_kernel = None self.last_params = None self.kernel_fig = None self.kernel_plt = None self.kernelSize = None
def __init__(self): Filter_base.__init__(self) self.description = "\ Apply an intensity transformation curve to the input image, \ by mapping old curve values to new ones via a \ look-up table created by linear interpolation.\ " self.setupInputsOutputs(["Input"], ["Output"]) self.addParam( Parameter(name="Curve plot", param_type="display", rank=0)) self.addParam( Parameter(name="Function/points input", param_type="codebox", rank=1, default=("""\ k = (t-s)/(d-c) m = -k*c+s intervals = [ [(vmin,c), s ], [(c,d), k*x+m ], [(d,vmax), t ] ]\n"""))) self.addParam( Parameter(name="c variable", param_type="variable", default=0.25, minimum=0, maximum=1, rank=1)) self.addParam( Parameter(name="d variable", param_type="variable", default=0.75, minimum=0, maximum=1, rank=2)) self.addParam( Parameter(name="s variable", param_type="variable", default=0.1, minimum=0, maximum=1, rank=3)) self.addParam( Parameter(name="t variable", param_type="variable", default=0.9, minimum=0, maximum=1, rank=4)) self.addParam( Parameter( name="Interpolation resolution", param_type="variable", default=256, minimum=4, maximum=1024, rank=6, description="Number of data points from which to interpolate.") ) self.addParam( Parameter( name="Min pixel value", param_type="variable", default=0, minimum=0, maximum=1, rank=7, description="Start applying curve at this pixel value (vmin).") ) self.addParam( Parameter( name="Max pixel value", param_type="variable", default=1, minimum=0, maximum=1, rank=8, description="Stop applying curve at this pixel value (vmax).")) self.curve_fig = None self.curve_graph = None self.curve = None self.expression = None self.last_max = None self.last_min = None self.last_res = None self.last_indexes = None self.last_cvar = None self.last_tvar = None self.last_svar = None self.last_dvar = None try: self.processParams( ) #Create a curve graph from the moment of creation. except Exception: pass