Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion from mono12packed without grabResult (using raw bytes) #8

Open
Niv-R opened this issue Jun 10, 2024 · 1 comment
Open

Conversion from mono12packed without grabResult (using raw bytes) #8

Niv-R opened this issue Jun 10, 2024 · 1 comment

Comments

@Niv-R
Copy link

Niv-R commented Jun 10, 2024

Use Case
My use case can benefit from performing the conversion from mono12packed in another Python process.

Problem
I've attempted to use ImageFormatConverter.Convert, and the docstring details the parameters as follows:

"""
Parameters
        ----------
        * `pDestinationBuffer` :  
            The pointer to the buffer of the destination image.  
        * `destinationBufferSizeBytes` :  
            The size of the buffer of the destination image.  
        * `pSourceBuffer` :  
            The pointer to the buffer of the source image.  
        * `sourceBufferSizeBytes` :  
            The size of the buffer of the source image.  
        * `sourcePixelType` :  
            The pixel type of the source image.  
        * `sourceWidth` :  
            The number of pixels in a row in the source image.  
        * `sourceHeight` :  
            The number of rows in the source image.  
        * `sourcePaddingX` :  
            The number of extra data bytes at the end of each row. The default value is
            usually 0.  
        * `sourceOrientation` :  
            The vertical orientation of the source image in the image buffer. The
            default value is usually ImageOrientation_TopDown. 
"""

However, the method actually expects a PylonImage object, as indicated by the following error message:

  Possible C/C++ prototypes are:
    Pylon::CImageFormatConverter::Convert(Pylon::IReusableImage &,Pylon::IImage const &)
    Pylon::CImageFormatConverter::Convert(Pylon::IReusableImage &,Pylon::CGrabResultPtr const &)

Attempted Solution
I tried converting my bytes to a PylonImage using:

image = pylon.PylonImage()
image.AttachUserBuffer(...)

However, AttachUserBuffer failed with the same error regardless of the arguments provided:

    return _pylon.PylonImage_AttachUserBuffer(self, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Wrong number or type of arguments for overloaded function 'PylonImage_AttachUserBuffer'.
  Possible C/C++ prototypes are:
    Pylon::CPylonImage::AttachUserBuffer(void *,size_t,Pylon::EPixelType,uint32_t,uint32_t,size_t,Pylon::EImageOrientation,CPylonImageUserBufferEventHandler *)
    Pylon::CPylonImage::AttachUserBuffer(void *,size_t,Pylon::EPixelType,uint32_t,uint32_t,size_t,Pylon::EImageOrientation)
    Pylon::CPylonImage::AttachUserBuffer(void *,size_t,Pylon::EPixelType,uint32_t,uint32_t,size_t)

Question
Is it possible to use Pylon's conversion on a raw buffer instead of a grabResult? If so, how can this be achieved?

@HighImp
Copy link
Collaborator

HighImp commented Nov 22, 2024

Hi,
can you please try the latest version from today?
There was a bugfix for the user buffer attachment.

If you still have the problem, please use the pypylon-issue room,
as this is for the samples.
Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants