Use VisualApplets to realize image gray stretching

  • How to use Applets to implement the function of halcon function (scale_image_max)


    The specific implementation method of the function:


    #Stretch target range

    targetMin = 0; # Target minimum

    targetMax = 255; # Target maximum


    CurrentMin; # The minimum gray value of the current image

    CurrentMax ; # Maximum grayscale of the current image


    #Calculation publicity:

    targetMin+((image_matrix(i,j)-currentMin)*(targetMax-targetMin))/(currentMax-currentMin);

  • Dear Basler China,

    please find attached a VisualApplets design, in which two possibilities are implemented: Scaling based on frame min/max at current pixel position and based on the overall frame min/max value.