Hi,help me, I want to save the chunk image(3D mode) binary format to file by float four byte code, Can you give me a example?

Continuing the discussion from Working with 3D-Cameras of Automation Technology in CVB:

Hi @wugx

The thread you mentioned explains in details how to grab image and Chunk Data from an AT camera. Your question :“save the chunk image(3D mode) binary format to file by float four byte code, Can you give me a example?” is about how to save the chunk data to a binary data file which is out of scope of this forum but you can get useful information here: BinaryWriter Class (System.IO) | Microsoft Docs

Thank you. But I don’t think I made it clear. The problem is as follows: For AT camera, in 3D profile mode, I want to read the profile data obtained in the form of coordinates(unit: mm) from DC2 chunk data, but I can’t find a function in cvb. I guess the data is a four byte floating point number, and I want to parse the image data. Is that right?
image

Hi @wugx,

We’d interpret the title that you’d like to save a certain amount of data but as far as we hear the description above you may want to read specific information first. Perhaps both are the expected achievement but let’s walk through them step by step.

I want to read the profile data obtained in the form of coordinates(unit: mm)

First, did you know the data can be represented as a GenICam GenApi feature node, and you don’t need to parse a data portion by yourself?

(Well, by the way, (1) which programming language are you going to code? And, (2) though CVB 14 is preferred, could you tell me the CVB version you can use?)

1 Like

@kazunari Thank you. My CVB version is 13.04, language is C#. Actually, I want to get chunk image(point cloud data) in 3D mode(algorithm is TRSH). The manual shows that I can get the profile data by DC2=true,DC1=false,DC0=false, is right? How can I get the data ?This’s my way as “var deviceImage = device.DeviceImage;” , but this’s way is image , How can I get the 3D point clound, and how can save the 3D data as binary files or db for tansformtion to the world coordinate in the later? I don’t know.

using (var device = DeviceFactory.OpenPort("GenICam.vin", i))
                {
                    var nodemap = device.NodeMaps[NodeMapNames.Device];
                    var chunkModeActive = nodemap["ChunkModeActive"] as BooleanNode;
                    chunkModeActive.Value = true;

                    var stream = device.Stream;
                    stream.Start();
                    try
                    {
                        stream.Wait();
                        var deviceImage = device.DeviceImage;

                        deviceImage.Save(@"c:\cam" + (i+4).ToString() + ".tif");

                        //var chunks = GevChunkParser.Parse(deviceImage);
                        //var info = DereferenceAcqInfoOn(deviceImage, chunks.First(chunk => chunk.ID == ATC5AcqInfoChunk.ID));

                        //Console.WriteLine($"FrameCount: {info.FrameCount}");

                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);

                    }
                    finally
                    {
                        stream.Stop();
                    }
                }

@wugx

By setting DC2 = 2 , you set the output of the camera to range map which in most of the cases is a common way to apply 3D image processing or create a pointcloud afterwards. It is important to understand that all 3D Sensors from AT output uncalibrated 2D range maps with no relation to real world units. However, it is possible to easily get calibrated metric 3D points by applying a number of calibration parameters to this range map. For more information please follow this: https://forum.commonvisionblox.com/t/working-with-3d-cameras-of-automation-technology-in-cvb/532/15

Thank you, I will try.