chapter12 CameraEntity.CaptureScene

Jan 7, 2012 at 2:27 PM

In

Namespace: Microsoft.Robotics.Simulation.Engine
Assembly: SimulationEngine (in SimulationEngine.dll) Version: 4.0.228.0 (4.0.228.0)

The CaptureScene method has the following signature:

public void CaptureScene(PortSet<int[], Exception> resultPort)

but in the the SimPhotoCell example of chapter 12 is used as:

                    // get the image from the CameraEntity
                    PortSet<Bitmap, Exception> result = new PortSet<Bitmap, Exception>();
                    _entity.CaptureScene(System.Drawing.Imaging.ImageFormat.MemoryBmp, result);
and the example dont compile, i'm not able to find a workaround.

Someone knows how to fix it.

Thanks a lot

Alessandro 

Jan 7, 2012 at 7:00 PM
Edited Jan 7, 2012 at 7:03 PM
alexbaroni wrote:

In

Namespace: Microsoft.Robotics.Simulation.Engine
Assembly: SimulationEngine (in SimulationEngine.dll) Version: 4.0.228.0 (4.0.228.0)

The CaptureScene method has the following signature:

public void CaptureScene(PortSet<int[], Exception> resultPort)

but in the the SimPhotoCell example of chapter 12 is used as:

                    // get the image from the CameraEntity
                    PortSet<Bitmap, Exception> result = new PortSet<Bitmap, Exception>();
                    _entity.CaptureScene(System.Drawing.Imaging.ImageFormat.MemoryBmp, result);
and the example dont compile, i'm not able to find a workaround.

Someone knows how to fix it.

Thanks a lot

Alessandro 



Hi Alessandro,

I changed the code as follows, and it works for me.

// get the image from the CameraEntity
PortSet<int[], Exception> result = new PortSet<int[], Exception>();
_entity.CaptureScene(result);
double brightness = 0;
    yield return Arbiter.Choice(result,
        delegate(int[] array)
        {
            Bitmap b = _entity.CreateBitmapFromArray(array);
            int count = 0;

 The code i have changed is underlined.

Bert Berrevoets.


Jan 8, 2012 at 9:49 AM

Hi Bert

Thanks a lot.

It works!!!