Skip to main content

Trying to use Mono16




  • Official comment
    Community team
    Great answers
    Expert (Gold)

    Hi Nathaniel,

    You could reference example code for more details of how to set pixel format to mono12p/packed:

     node_pixel_format = PySpin.CEnumerationPtr(nodemap.GetNode('PixelFormat'))
            if PySpin.IsReadable(node_pixel_format) and PySpin.IsWritable(node_pixel_format):

                # Retrieve the desired entry node from the enumeration node
                node_pixel_format_mono12p = PySpin.CEnumEntryPtr(node_pixel_format.GetEntryByName('Mono12p'))
                if PySpin.IsReadable(node_pixel_format_mono12p):

                    # Retrieve the integer value from the entry node
                    pixel_format_mono12p = node_pixel_format_mono12p.GetValue()

                    # Set integer as new value for enumeration node

    However, 12-bit is packed pixel format and require to unpack before retrieving numpy array. With our sdk, user could unpack to 16-bit without affecting the actual resolution:

    image_converted = processor.Convert(image_result_in_12bit_packed, PySpin.PixelFormat_Mono16)

    Please let me know if this information answered your question.



  • TDY_Ifeanyi
    Community team
    Great answers
    Expert (Gold)

    Hello Nathaniel,

    If I understood very well, it seems you are trying to convert 8-bit pixel format to 16-bit format. Our sdk does not support such image processing and enlargement.

    One approach is to set image pixel format to 16-bit and retrieve numpy array of grabbed image directly. Another approach is to set pixel format to 12-bit packed, unpack the raw image to 16-bit using 'processor.Convert', and then retrieve numpy array of resultant image. 

    I hope the provided information help to resolve this issue.





  • Nathaniel Weger

    Hello Ifeanyi,

    Thanks for your response! It looks like the camera only goes up to 12 bits, so that's my goal I guess. But yes, I would really like to directly retrieve a numpy array of the image in 12 bit (I never need it to be in 8-bit), but I am not sure how to do this. Is there an extra line I need to add to make sure that the image is in Mono12?




Please sign in to leave a comment.

Powered by Zendesk