Menu

Capturing images in IYU1 format

Help
ndjankov
2005-07-03
2013-03-22
  • ndjankov

    ndjankov - 2005-07-03

    Hello again,

    I have come across a problem with the unicap library while trying to capture images in the IYU1 (12 bit) format.  It appears that the image data is not being consistently saved at the beginning of the frame buffer, cause the displayed image to appear as though it is "jumping" around from frame to frame.  I have also observed this same phenomenon using the sdl_display example provided (this is also observed with both the Unibrain Fire-i and PGR FireFly II cameras).  The IYU1 image should remain stable in the window just like the Grey and RGB images, even though the colours are skewed (this skewing occurs because the UYVY overlay is still used to display the image on the screen).

    I also tested the IYU1 format using the libdc1394 library and observed no such image instability, leading me to think that it is a problem with the unicap library.

    I am just wondering if you have made similar observations when working with this format.  I have no urgent need for this format right now, but it would be nice to have it available eventually.

    Thanks,

    Nick.

     
    • Arne Caspari

      Arne Caspari - 2005-07-04

      I will test this and let you know my results.

       
      • Arne Caspari

        Arne Caspari - 2005-07-12

        I can reproduce this easily with the 320x240 UYVY format.

        My problem is: I checked all the buffer sizes/DMA sizes/settings on the camera  but everything seems correct :-(

        It is clearly my code though since it works fine with coriander.

        I will continue to investigate.

         
    • ndjankov

      ndjankov - 2005-08-15

      Are there any updates regarding this issue?  Bus bandwidth could also be reduced if I could run the cameras at 12-bit colour.  For my project, I somehow need to get 2 DCAM's and 1 DFG working simultaneously, in colour and at least 15Hz.  

      Thanks for your help,

      Nick.

       
      • Arne Caspari

        Arne Caspari - 2005-08-16

        I am currently working on the DCAM plugin.

        An updated version will be available in the next few days.

         
        • Arne Caspari

          Arne Caspari - 2005-08-17

          I just uploaded version 0.1.3 which fixes the corrupted images with Y411 color format.

          This version also has a simple color conversion code in the GTK library so if you use the "unicapgtk_smallapp" sample program, you should be able to get a live video with all the color formats your camera supports. ( At least I get a correct live video for UYVY, Y411, RGB24 and GREY image formats ).

          Using the 'smallapp' example, I still have some issues with the DFG/1394-1 on switching video formats. I will fix this right on ;-)

           
          • ndjankov

            ndjankov - 2005-08-19

            I can now convert and display the Y411 format without any problems, but I found a new bug when using this format when polling the buffer and using a DCAM.  The buffer counter eventually stops returning the number of buffers in the ready queue (i.e., will only ever return 0). 

            This was a tricky bug to find since the amout of time that elapses until the camera stops working apears to be random.  It runs anywhere from a few seconds to a few minutes (but usually stops within a minute).  I switched my program back to UYVY to make sure it wasn't just my code, and had no problem capturing for half an hour.  I also modified the sdl_display example to use polling and it too eventually stopped when using Y411. 

            The following code was used between the unicap_start/stop_capture() calls:

                if( !SUCCESS( unicap_queue_buffer( handle, &buffer ) ) )
                {
                    fprintf( stderr, "Failed to queue a buffer on device: %s\n", device.identifier );
                    exit( 1 );
                }
                int counter=0;
                int bufferCount;
                while( !quit )
                {
                    bufferCount=0;
                    SDL_Rect rect;
                    SDL_Event event;

                    rect.x = rect.y = 0;
                    rect.w = format.size.width;
                    rect.h = format.size.height;
                   
                    /*
                      Wait until the image buffer is ready
                    */
                    if( !SUCCESS( unicap_poll_buffer(handle, &bufferCount) ))
                    {
                        fprintf( stderr, "Failed to wait for buffer on device: %s\n", device.identifier );
                    }
                   
                    if (bufferCount>0)
                    {
                        if( !SUCCESS( unicap_wait_buffer( handle, &returned_buffer ) ) )
                        {
                            fprintf( stderr, "Failed to wait for buffer on device: %s\n", device.identifier );
                        }
                       
                        process_uyvy( returned_buffer, 0.0f );
               
                        /*
                        Display the video data
                        */
                        SDL_UnlockYUVOverlay( overlay );
                        SDL_DisplayYUVOverlay( overlay, &rect );
                        SDL_LockYUVOverlay(overlay);
               
                        if( !SUCCESS( unicap_queue_buffer( handle, &buffer ) ) )
                        {
                            fprintf( stderr, "Failed to queue a buffer on device: %s\n", device.identifier );
                            exit( 1 );
                        }
               
                        while( SDL_PollEvent( &event ) )
                        {
                            if( event.type == SDL_QUIT )
                            {
                                printf( "Quit\n" );
                                quit=1;
                            }
                        }
                        counter++;
                        printf("%d\n",counter);
                    }
                }

            I hope this helps,

            cheers,

            Nick.

             
            • Arne Caspari

              Arne Caspari - 2005-08-19

              Which kernel version are you running? I had such problems with earlier kernel versions but the situation seems to have improved with more recent kernels.

              I am currently testing with 2.6.13 and the camera is running stable with Y411 for more than half an hour now.

               
              • ndjankov

                ndjankov - 2005-08-20

                I am currently using 2.6.9 (Fedora Core 3).  I'll look into updating to a newer version.  Thanks for the suggestion.

                 
    • ndjankov

      ndjankov - 2005-08-16

      Cool, thanks for the updates.

       

Log in to post a comment.