IC-Imaging-Control-Samples icon indicating copy to clipboard operation
IC-Imaging-Control-Samples copied to clipboard

DisplayImageBuffer(IFrameQueueBuffer buffer) doesn't update ICImagingControl

Open 5CoJL opened this issue 2 years ago • 8 comments

Hi,

I'm having a bit of an issue displaying saved frames one by one via DisplayImageBuffer, in .NET.

I have set up a FrameQueueSink alongisde a FrameQueueSinkListener. Whenever the listener has a frame queued in output, I save it in a IFrameQueueBuffer[] array to save the last 10 seconds of live imaging, and replay them when I hit a button.

However calling DisplayImageBuffer after calling ic.LiveStop() seems to never update the display (as in the last frame before the call to ic.LiveStop() is frozen).

I have set the ic.LiveDisplay to false before attempting to DisplayImageBuffer.

I understand I might be completely misunderstanding the tools at my disposal, but I have gone through the entire documentation as well as the samples and fall short of understanding my problem.

Thank you for any insight.

5CoJL avatar May 05 '22 08:05 5CoJL

Hello

I have a complete sample that shows, what you want to do. Currently I am not in the office, therefore, I do not have access to my sample repository. I would like you to repeat your request on Monday or Tuesday, so I can provide better help.

Stefan

TIS-Stefan avatar May 06 '22 07:05 TIS-Stefan

Hello Stefan,

I reach out to you as suggested for the potential sample you mentioned ?

Best, Julien

5CoJL avatar May 09 '22 06:05 5CoJL

For the moment, I am using a workaround where I save my entire buffer as JPEGs, and display the images in a PictureBox. This is inefficient but definetely does the trick.

I think I don't understand how the DisplayImageBuffer function works. I thought it would simply display whichever buffer I'd send to the function, but apparently not.

5CoJL avatar May 09 '22 12:05 5CoJL

Hello

Capture before and after event.zip

You may try this sample. It displays the frame buffer queue in a picture box and allows to save the images into an mp4 file using the NAudio library.

No JPEG conversion necessary

Stefan

TIS-Stefan avatar May 09 '22 14:05 TIS-Stefan

Thanks a lot for the sample ! I actually never used the Bitmap wrapper which makes things way easier to directly acquire an image.

I managed to find another way to get what i was looking for with Ic Imaging Control.

However I still fail to understand how the DisplayImageBuffer function is supposed to work. Based on the documentation alone, I could not make it work the way it is described.

5CoJL avatar May 09 '22 15:05 5CoJL

Hello

please look at the sample "Documents\IC Imaging Control 3.5\samples\C#\Display Buffer\Display Buffer"

It passes a callback function "ShowBuffer" to the sink:

icImagingControl1.Sink = new FrameQueueSink(ShowBuffer, MediaSubtypes.RGB32, 5);

The display is:

        private FrameQueuedResult ShowBuffer( IFrameQueueBuffer buffer )
        {
            try
            {
                icImagingControl1.DisplayImageBuffer( buffer );
            }
            catch( Exception ex )
            {
                System.Diagnostics.Trace.WriteLine( ex.Message );
            }
            return FrameQueuedResult.ReQueue;
        }

TIS-Stefan avatar May 09 '22 15:05 TIS-Stefan

Hi, sorry for the delayed answer.

Indeed, this example works. But by using a FrameQueueListener to instanciate the FrameQueueSink, as opposed to the FrameQueuedResult of this example, then I could not get any display by calling DisplayImageBuffer.

5CoJL avatar May 23 '22 08:05 5CoJL

You may send a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), so I can , what you are doing and may fix that issue.

TIS-Stefan avatar May 23 '22 10:05 TIS-Stefan