Counter text overlay imaFlex CXP-12 Quad

  • Dear VisualApplets community,


    I have been trying to implement a counter text overlay in VisualApplets. I stumbled across the following thread: Build a Logic Analyzer / Oscilloscope with VisualApplets - Function Generators, Digital IOs, Visualization, Trigger, Text Overlay - No additional Software required - Application Examples, Templates and Design Snippets - VisualApplets User Forum (silicon.software)


    I was wondering if there was an easy solution to running the VisualApplets code from the thread above on the imaFlex CXP-12 Quad framegrabber or if there is a simpler solution to overlay text for displaying the counter.


    Your help is much appreciated!

  • Johan

    Changed the title of the thread from “Timestamp text overlay imaFlex CXP-12 Quad” to “Counter text overlay imaFlex CXP-12 Quad”.
  • Dear Johan,
    Do you wish to have a visual counter representation embedded on the image data or do you want to have an overlay? This means that after saving the image the counter would not be visible anymore.


    Best Regards,

    Kevin

  • Dear Kevin,


    I wish to have a visual counter embedded on the image, such that after saving the image, the counter would still be visible.


    Sincerely

    Johan

  • Dear Johan,


    There are two different ways to achieve this:

    Using the CPU during Acquistion:

    1. Use the FramegrabberSDK and some other library such as OpenCV to embed the frame counter into the image after it was recieved from the host ( https://www.tutorialspoint.com…in-opencv-using-cplusplus ). The benefit is that you can have the original image data without the counter and with the counter as well. The downside is that it is not shown on the image itself, so it won't show up using MicroDisplayX.

    Using VisualApplets / FPGA:


    2. You could embed the logic into the Framegrabber by using a combination of ImageNumber/ModuloCount, IF, Coordinate_X, Coordinate_Y and a LUT. In the LUT you have to save the representation of the numbers 0-9 in pixels. With the Coordinate_X, Coordinate_Y you will get the pixel Positions and may overwrite it with the needed content for the frame.


    What should be the highest number of the counter? 9, 99, 999, 9999,99999 - Depending on this you must adapt your logic accordingly to make more room and adress the LUT differently.

    PostProcessing

    3. MicroDisplayX also shows the FrameNumber under the acquired images, it is not directly on the frame but you can read it there as well. Additionally, if you take a sequence of images and have set a large buffer you can then save the images to the disk and each image gets a frame counter in its name. You could write a small script in your prefered language that iterates over the images and puts the image number on it.
    pasted-from-clipboard.png



    I hope that one of these solutions helps you achieve your desired goal.


    Best Regards,

    Kevin

  • Dear Kevin,


    I understand that it is possible to embed the frame number in pixels using VisualApplets, however, is it possible to embed the frame number as text instead of pixels?


    Sincerely

    Johan

  • Dear Johan,

    That's not what I meant. Instead of using a signle Pixel use a LUT where images of the numbers are stored, e.g. in a size of 16x16 and then replace the pixels of your incoming datastream with the corresponding frame numbers according to the generated LUT adresses and frame indices.

    Best Regards,

    Kevin

  • Dear Kevin,


    Do I understand correctly that each LUT would store a specific number, thus for numbers 0-9, I'd need 10 LUTS.


    Sincerely

    Johan

  • Dear Johan,

    Attached you can find an exemplary design that will write the image numbers 0-2 in the top left corner. This is just a starting point, for larger numbers you must change the logic etc, but it showcases the general idea.

    I also attached a python script that generates the numbers 0-2 to fill up the LUT. You can find them all in the attached .zip.

    Note that this is not exactly an overlay but an overwrite. If you wish to overlay it you can try to work with color or alpha channels (to work with alpha channels you must use the super pixel format).


    If you wish to have Basler implement a solution for you feel free to contact your sales reprsentive.


    Best Regards,

    Kevin


  • To answer your question: No you will not need 10 LUTs, you will need one LUT storing all 10 numbers. However, you can only store 2^16 pixels in one LUT, that means your numbers cannot be that large in the image dimensions.

    So if you only want to use one LUT : 2^16 / 10 = 6553, so one number is not allowed to take up more than 6553 pixels. Numbers are usually not square and are higher than wider, so I would go with a maximum of 60*100 (width*height) - however, smaller dimensions should work fine as well.

    Best Regards,

    Kevin

  • Dear Kevin,


    Would it also be possible to obtain millisecond precision time information from the framegrabber, such that the counter counts milliseconds instead of frames.


    Sincerely

    Johan

  • Hi Johan,

    Are you working with a fixed framerate? If so the time between frames is constant and you could use that to gather the information in ms.
    Otherwise you must use the signal library to get the amount of ms passed. Furthermore, it is not the time of the frame but the exact ms time of the pixel. Additionally, getting the information from a genicam node and then after retrieving the image using the C++ / Python SDK to write the time in ms on the image might be easier.

    Nevertheless, it should be possible but very tricky to do it directly on the framegrabber.


    Best Regards,

    Kevin