morefigs/pymba

Can't open camera after setting multicast

Opened this issue ยท 6 comments

Dear pymba team:
Thank you for making such brilliant package.
It's convenient and easy learning.
I used pymba for a while, it worked well.
I could acquire the video stream with my python program smoothly.

But my team decided to share the screen with different users.
So, I use Vimba to set the multicast.
After then, I ran the example "opencv_acquire_streaming_images.py" from this site.
And it stuck at the camera opening step.
Saying "pymba.vimba_exception.VimbaException: Operation is invalid with the current access mode."

Below is the part of the code:

from time import sleep
from pymba import Vimba
from examples.camera.display_frame import display_frame


if __name__ == '__main__':

    with Vimba() as vimba:
        camera = vimba.camera(0)
        camera.open() #--------The error line--------#

I am not sure if this is because of my Vimba setting incorrectly, or pymba doesn't support multicast?

I didn't found any answer at internet or this site.
So, sorry if the answer is already existed.
And also sorry for my poor English.

I've never tried so can't say for sure, however:

  • which OS?
  • do you already have a "master" instance of vimba viewer connected to the camera?
  • you may need to call open with a different access mode - the default is VimbaObject.VMB_ACCESS_MODE_FULL, which is possibly the issue here.

Dear morefigs:

  • which OS?

    Windows 10 Professional, 64-bit


  • do you already have a "master" instance of vimba viewer connected to the camera?

    I am not sure what "master" instance means?
    The multicast is set on other computer, my computer is only for getting the video.
    Maybe that means "No, I don't have a master instance" ?

    But I can use vimba viewer to see the video stream, only the python program can't acquire that.


  • you may need to call open with a different access mode - the default is VimbaObject.VMB_ACCESS_MODE_FULL, which is possibly the issue here.

    I tried that, and these are my code and result:

    from time import sleep
    from pymba import Vimba, vimba_object
    from examples.camera.display_frame import display_frame
    
    if __name__ == '__main__':
    
        with Vimba() as vimba:
            VO = vimba_object.VimbaObject(vimba) #Add the VimbaObject
            camera = vimba.camera(0)
            camera.open(camera_access_mode = VO.VMB_ACCESS_MODE_READ) #Change the access mode
    
    

I tried VMB_ACCESS_MODE_(FULL, READ, CONFIG, LITE).
They gave me the same error message --- "VimbaException: Operation is invalid with the current access mode."

And the VMB_ACCESS_MODE_NONE gave me the error like ---"VimbaException: API feature is not implemented."
I guess these are all the modes I can try.

The access-mode of the camera provides information in which mode the camera "can" be opened. So before opening the camera, the full access mode will be available. After opening the camera from the current application instance, the camera can not opened anymore at full access mode because it is already opened by the instance of the instance which will result in "no access".

Dear SunnyAVT:
So, I guess that's a death sentence to my program?
Because if I want to get the video in pymba, I have to open camera first.
(I ever tried to arm or start_frame_acquisition without opening camera, but they all failed)
But I can't open an already opened camera.
So, there's a dead-end.

You can open camera in pymba or open camera in other application, but cannot be both. :(-

Dear SunnyAVT:
So, there's no way to turn off the the redundant acquirement.
And make my python program like Vimba viewer, which can see other computer's multicast data but not to access the camera...

Thank you for replying.
I will figure other way to reach my target.