VEYE IMAGING Forum
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc
    • Register
    • Login

    Taking images with different shutter settings i2c

    Scheduled Pinned Locked Moved VEYE MIPI camera
    10 Posts 2 Posters 2.0k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Seka
      last edited by

      Hi there,

      I am trying to use the Starvis 327 RPI Mipi Camera with an RPI4B to take images with different illumination settings. For our use case, I need to change the shutter settings to adjust for different levels of light.

      I tried to enable the "capture mode" in order to change the shutter settings but always get a kernel error when trying to do so.

      Here is the script:

      from time import sleep
      from signal import pause
      import datetime
      import time
      import RPi.GPIO as GPIO
      import D_mipicamera as Dcam
      
      
      
      
      
      import os
      status = os.system('sh ./veye_mipi_i2c.sh -w -f videoformat -p1 PAL  -b 10')
      status = os.system('sh ./veye_mipi_i2c.sh -w -f cameramode -p1 0x1 -b 10')
      print status 
      
      
      
      
      camera = Dcam.mipi_camera()
      
      
      camera.init_camera()
      
      
      
      
      
      #Folder CREATION
      
      #os.makedirs("/home/pi/testmipi")
      directory="/home/pi/testmipi/"
      
      
      directory
      
      
      
      
      sleep(2)
      date = datetime.datetime.now().strftime("%m_%d_%Y_%H_%M_%S")
      frame = camera.capture(encoding = 'jpeg')
      frame.as_array.tofile((directory)+"nm385"+ date + ".jpg")
      camera.release_buffer(frame)
      del frame
      
      time.sleep(1)
      
      
      print("Close camera...")
      camera.close_camera()
      GPIO.cleanup(Alled)
      
      

      The error I get is:

      An error ocurred while starting the kernel
      mmal: mmal_component_enable w 1920 h 1080 
      
      

      It works in stream mode, but node in capture mode...

      But in stream mode it seams like i cannot change the shutter speed.

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        Seka @Seka
        last edited by

        These are the 2c settings:

        I2C Settings
        
        Devid: 0x6
        Hdver: 0x3
        Wdrmode: 0x0
        Videomode: frame rate reg 1, NTSC (60Hz)
        Mirrormode: 0x0
        Denoise: 0x5
        AGC: 0x c
        Lowlight: 0x 0
        Daynightmode: 0xfc
        Mshutter: 0x41
        Cameramode: 0x0
        Nodf: 0x0
        CAPTURE  ????
        Csienable 0x1
        Brightness: NTSC60 brightness is 0x20
        Agcspeed: agcspeed is 0x a shutter speed is 0x50
        Contrast: 0x80
        Saturation: 0x28
        Sharpen : enable is 0x1 cal is 0x3
        Wdrtargetbr: 0x30
        Boardmodel: no information
        I2cwen: no information
        I2cauxenable: no information
        
        
        veye_xummV 1 Reply Last reply Reply Quote 0
        • veye_xummV Offline
          veye_xumm @Seka
          last edited by

          @seka

          1. about capture mode:
          • http://wiki.veye.cc/index.php/VEYE-MIPI-290/327_i2c/#cameramode
            Caputre mode: output the next frame each capture cmd.
            You have to run the cmd below to get one picture.
          ./veye_mipi_i2c.sh -w -f capture -b 10
          
          • camera.capture(encoding = 'jpeg')
            This function do CAPTURE one frame from the MIPI csi-2 port.
          1. So I suggest add this cmd before capture a frame.
          ./veye_mipi_i2c.sh -w -f capture -b 10
          

          Questions will be answered as soon as possible, please be patient.
          如果你使用中文,请直接用中文提问。
          May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            Seka @veye_xumm
            last edited by

            @veye_xumm and then change the shutter with mshutter or with lowlight command?

            S veye_xummV 2 Replies Last reply Reply Quote 0
            • S Offline
              Seka @Seka
              last edited by

              @seka Sometimes I have the impression that the frame I get in the images is an old one. Can there be a problem with having "old" frames in the images?

              veye_xummV 1 Reply Last reply Reply Quote 0
              • veye_xummV Offline
                veye_xumm @Seka
                last edited by

                @seka
                mshutter is manual exposure time.

                Questions will be answered as soon as possible, please be patient.
                如果你使用中文,请直接用中文提问。
                May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                1 Reply Last reply Reply Quote 0
                • veye_xummV Offline
                  veye_xumm @Seka
                  last edited by

                  @seka said in Taking images with different shutter settings i2c:

                  an there be a problem with having "old" frames in the images?

                  Could you add a little sleep between mshutter cmd and capture cmd?

                  Questions will be answered as soon as possible, please be patient.
                  如果你使用中文,请直接用中文提问。
                  May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    Seka @veye_xumm
                    last edited by

                    @veye_xumm OK, so accordin to your suggestion,
                    I now switched back to stream mode and discard one frame taken with the capture command before taking another one and saving it:

                    import D_mipicamera as Dcam
                    
                    
                    camera = Dcam.mipi_camera()
                    
                    
                    camera.init_camera()
                    
                    import os
                    status = os.system('sh ./veye_mipi_i2c.sh -w -f cameramode -p1 0x0 -b 10')
                    print status 
                    
                    status = os.system('sh ./veye_mipi_i2c.sh -w -f daynightmode -p1 0xFC -p1 0x00 -b 10')
                    #print status 
                    
                    
                    ##turn off automatic exposure
                    status = os.system('sh ./veye_mipi_i2c.sh -w -f agc -p1 0 -b 10')
                    print status 
                    ##turn off white balance
                    status = os.system('sh ./veye_mipi_i2c.sh -w -f wbmode -p1 0x1b -b 10')
                    print status 
                    
                    
                    
                    status = os.system('sh ./veye_mipi_i2c.sh -w -f lowlight -p1 0x09  -b 10')
                    print status 
                    
                    directory="/home/pi/testmipi/"
                    
                    date = datetime.datetime.now().strftime("%m_%d_%Y_%H_%M_%S")
                    frame = camera.capture(encoding = 'jpeg')
                    
                    camera.release_buffer(frame)
                    del frame
                    time.sleep(1)
                    
                    frame = camera.capture(encoding = 'jpeg')
                    frame.as_array.tofile((directory)+"nm590"+ date + ".jpg")
                    camera.release_buffer(frame)
                    del frame
                    
                    

                    Now it is taking repeatedly and reliably the same images. That is good.

                    However, I feel like I am not in control of the shutter/ frame rate. I tried different framerate settings with *lowlight -p1 XX but nothing changed.

                    How can I change the exposure time now?

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      Seka @Seka
                      last edited by

                      @seka Sorry, my bad, I can change the exposure now with the mshutter command.

                      THANK YOU for your help!

                      veye_xummV 1 Reply Last reply Reply Quote 0
                      • veye_xummV Offline
                        veye_xumm @Seka
                        last edited by

                        @seka
                        It's really nice to know this. You are welcome.

                        Questions will be answered as soon as possible, please be patient.
                        如果你使用中文,请直接用中文提问。
                        May the force be with YOU. (This is the translation of the mysterious Chinese symbol above.)

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post