draco icon indicating copy to clipboard operation
draco copied to clipboard

how to understand draco::EncoderOptions

Open leviskim17 opened this issue 3 years ago • 1 comments

Can somebody help me understand the below function?

I am struggling to understand draco::EncoderOptions This is the function implemented by the former worker. After getting this draco process, the intensity values seem to be different with original value. May I know how to get the original value in cesium side?

        draco::PointCloudBuilder builder;
        draco::EncoderBuffer encoder_buffer;
        draco::PointCloudSequentialEncoder encoder;
        draco::EncoderOptions options = draco::EncoderOptions::CreateDefaultOptions();
    void DPNTSGenerator::finalizePoints()
    {
        const auto point_cloud = builder.Finalize(false);

        options.SetAttributeFloat(point_cloud->GetNamedAttributeId(draco::GeometryAttribute::POSITION), "quantization_bits", 14);
        options.SetAttributeFloat(point_cloud->GetNamedAttributeId(draco::GeometryAttribute::NORMAL), "quantization_bits", 14);
        options.SetAttributeInt(point_cloud->GetNamedAttributeId(draco::GeometryAttribute::COLOR), "quantization_bits", 8);
        options.SetAttributeFloat(intensity_id, "quantization_bits", 14);

        encoder.SetPointCloud(*point_cloud);

        encoder_buffer.Clear();
        const auto status = encoder.Encode(options, &encoder_buffer);
        if (!status.ok())
        {
            // failed to encode
            std::cerr << status << std::endl;
            return;
        }

        const auto& buffer = encoder_buffer;
        writeFeatureTableBinary(buffer.data(), buffer.size());
    }

I have tried to adjust there parameters

        options.SetAttributeFloat(point_cloud->GetNamedAttributeId(draco::GeometryAttribute::POSITION), "quantization_bits", 14);
        options.SetAttributeFloat(point_cloud->GetNamedAttributeId(draco::GeometryAttribute::NORMAL), "quantization_bits", 14);
        options.SetAttributeInt(point_cloud->GetNamedAttributeId(draco::GeometryAttribute::COLOR), "quantization_bits", 8);
        options.SetAttributeFloat(intensity_id, "quantization_bits", 14);

But I can't get satisfactory results.

Is there any mention of the API's comment of SetAttributeFloat?

leviskim17 avatar Sep 16 '22 08:09 leviskim17

Can you share the code where you initialize and set the intensity attribute? Btw, quantization bits should be set using SetAttributeInt() method (but it shouldn't really make a difference in this case).

ondys avatar Sep 16 '22 17:09 ondys