Shrinking an image vertically

  • Hi All,


    I am using GV-5260 CP area scan camera connected with VQ4-GE framegrabber installed with SISO Runtime v5.6.0. I need to scale down an image ( shrink the image) vertically along y-axis. Can I get any example applet for doing so?!. I have attached a sample acquisition applet with source image for your reference.

    ShrinkImage.va


    Thanks,

    Jayasuriya S.

  • Hi Jayasuriya


    what type of shrinking do you need?


    - Binning?

    - Line Dropping? / Decimation?

    - Downsampling by a constant integer value and calculation of the mean value of the lines? (Operator SampleDn)

    - Downsampling by a fractional number and bilinear interpolation?

    Johannes


    Johannes Trein
    Group Leader R&D
    frame grabber

    Basler AG



  • Hi all

    I made a quick sample of a VA design to downscale the input image in vertical Y-direction by a fractional number. So for example an input image of 1024 lines and a downscale factor of 1.5 will result in an image of 683 lines.


    The attached design uses a parameter translate so that you can directly input the fractional downscale value into the H-Box.

    pasted-from-clipboard.png


    The implementation uses a kernel to get a current and previous line simultaneously. By using the remainder of the division between the Y-coordinate and the downscale factor the applet decides if a line shall be deleted or not and will use the remainder to interpolate between the two successive lines.


    Note that the DownscaleFactor must be between 1 and the image height. A factor less than 1 i.e. an enlargement of the image is not possible.

    pasted-from-clipboard.png


    See attached.


    Johannes