Argus 0.97.3 setting camera sharpness in edge enhancement having issue

Hello,
We are using TX2 and two leopard imaging IMX577 cameras. The OS of TX2 is L4T 32.5.0. Argus 0.97.3.

I found that if I set the strength of edge enhancement to say 0.15, then when I read the strength value from the meta data of the frames, its value is 0.85, which is 1 minus 0.15. I have tried multiple values with all 3 modes (EDGE_ENHANCE_MODE_OFF, EDGE_ENHANCE_MODE_FAST and EDGE_ENHANCE_MODE_HIGH_QUALITY), this applies to all of them.

Is there any reason why the strength value read from the metadata of the frame equals 1 minus the value set?

Here is how I set the edge enhancement:

bool IMX577StereoCamera::configCameraSharpness(IEdgeEnhanceSettings *iEdgeEnhanceSettings, const IMX577Sharpness& sharpnessConfig)
{
    bool res = false;
    Argus::Status status = STATUS_OK;
    if(iEdgeEnhanceSettings != nullptr)
    {
        if(sharpnessConfig.m_strength >= 0 && sharpnessConfig.m_strength <= 1)
        {
            status = iEdgeEnhanceSettings->setEdgeEnhanceMode(*(sharpnessConfig.m_mode));
            if(status == STATUS_OK)
            {
                status = iEdgeEnhanceSettings->setEdgeEnhanceStrength(sharpnessConfig.m_strength);
                if(status == STATUS_OK)
                {
                    res = true;
                }
                else
                {
                    logAndThrow("Error setting sharpness strength", __FILE__, __LINE__);
                }
            }
            else
            {
                logAndThrow("Error setting sharpness mode", __FILE__, __LINE__);
            }
        }
        else
        {
            std::stringstream ss;
            ss << VAR_VAL_STREAM(sharpnessConfig.m_strength) << " out of range [0,1]";
            logAndThrow(ss.str(), __FILE__, __LINE__);
        }
    }
    else
    {
        std::stringstream ss;
        ss << "nullptr found, " << VAR_VAL_STREAM(iEdgeEnhanceSettings);
        logAndThrow(ss.str(), __FILE__, __LINE__);
    }
    return res;
}

Here is how I read the settings from the frame:

void LIIMX577Camera::getCurCamSettings(Argus::UniqueObj<EGLStream::Frame>& frame)
{
    LIIMX577CameraSetting setting;
    EGLStream::IArgusCaptureMetadata *iArgusCaptureMetadata = interface_cast<EGLStream::IArgusCaptureMetadata>(frame);
    if(iArgusCaptureMetadata == nullptr)
    {
        logAndThrow("Cannot get IArgusCaptureMetadata", __FILE__, __LINE__);
    }

    CaptureMetadata *metadata = iArgusCaptureMetadata->getMetadata();
    if(metadata == nullptr)
    {
        logAndThrow("Cannot get CaptureMetadata", __FILE__, __LINE__);
    }

    ICaptureMetadata *iMetadata = interface_cast<ICaptureMetadata>(metadata);
    if(metadata == nullptr)
    {
        logAndThrow("Cannot get ICaptureMetadata", __FILE__, __LINE__);
    }

    IEdgeEnhanceMetadata *iEdgeEnahenceMetadata = interface_cast<IEdgeEnhanceMetadata>(metadata);
    if(iEdgeEnahenceMetadata == nullptr)
    {
        logAndThrow("Cannot get IEdgeEnhanceMetadata", __FILE__, __LINE__);
    }

    /* sharpness setting */
    setting.m_sharpness.m_mode.reset(new Argus::EdgeEnhanceMode(iEdgeEnahenceMetadata->getEdgeEnhanceMode()));
    setting.m_sharpness.m_strength = iEdgeEnahenceMetadata->getEdgeEnhanceStrength();
    MMI_INFO_LOG_L << "setting.m_sharpness.m_strength" << setting.m_sharpness.m_strength;

    // .... More code
}

I just check on r32.6.1 with argus_camera by below modify without problem.

diff --git a/public/apps/camera/modules/Dispatcher.cpp b/public/apps/camera/modules/Dispatcher.cpp
index 6c0153e..aac8830 100644
--- a/public/apps/camera/modules/Dispatcher.cpp
+++ b/public/apps/camera/modules/Dispatcher.cpp
@@ -207,6 +207,7 @@ private:
             ORIGINATE_ERROR("Failed to set the edge enhancement strength");
         }

+        printf("get EdgeEnhanceStrength %f\n", m_iEdgeEnhanceSettings->getEdgeEnhanceStrength());
         PROPAGATE_ERROR(Dispatcher::getInstance().restartActiveRequests());

         return true;

Hi Shane, I am using different version than yours. Can you check 32.5.0?

Thanks.

Hi Shane,
I have just double checked the change you ve made to argus_camera. The difference is that I am reading the edge enhancement data from metadata of the frame. If you read my code in detail, you will find that I am reading the edge enhancement metadata. It shows 1 minus the value that I set to.

Update: I have tried to read the edge enhance strength from IEdgeEnhanceSettings * interface. The value equals to the one I set to.

So, I think I need a explanation of why the edge enhancement strength read from metadata is 1 minus the value I set to.

Thanks,

Jon

Could you read it after few frames after set the value.

Hi Shane,
I have tried to read the edge enhancement strength from metadata after few frames, I had the same results. it is still 1 minus the value I set to.

I also modified the argus_camera, I got the same result. The edge enhancement strength from metadata is still 1 minus the value I set to…

Here is the code I added:

                // edge enhancement strengh
                const Argus::IEdgeEnhanceMetadata *iEdgeEnhanceMetadata = Argus::interface_cast<const Argus::IEdgeEnhanceMetadata>(metaData);
                if(iEdgeEnhanceMetadata)
                {
                    printf("iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=%.4f\n", iEdgeEnhanceMetadata->getEdgeEnhanceStrength());
                }
                else
                {
                    PROPAGATE_ERROR(dispatcher.message("Cannot get iEdgeEnhanceMetadata\n"));
                }

This code is added to argus/apps/camera/modules/EventThread.cpp file, line 133. I also attached the EventThread.cpp for your reference.
EventThread.cpp (6.9 KB)

But I found that the strength does work and if the larger the value, the more edge enhancement applied, although I set the value to 0.9 and the meta data read back as 0.1.

Please provide some explanation to this. Is this a bug of the argus library? or the bug of the camera? Or what happened there?

I didn’t get the message by add your code.
I am run the argus_camera by ssh remotely.

./argus_camera --edgeenhancestrength=0.5

I am using the argus_camera GUI. In the GUI, Enable verbose and KPI. Select multi-session. And I have 2 cameras.

If you can follow my steps, you should be able to see the message from terminal.

Looks like the 32.6.1 have fix your problem.

 ./argus_camera --kpi=1 --edgeenhancestrength=0.5
Executing Argus Sample Application (argus_camera)
Argus Version: 0.98.3 (multi-process)
PerfTracker: app initial 577 ms
PerfTracker 1: app intialized to task start 441 ms
get EdgeEnhanceStrength 0.500000
PerfTracker 1: task start to issue capture 56 ms
PerfTracker 1: first request 294 ms
PerfTracker 1: total launch time 1369 ms
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
PerfTracker 1: frameRate 24.41 frames per second at 0 Seconds
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
PerfTracker 1: framedrop current request 0, total 0
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
PerfTracker 1: latency 91 ms average, min 89 max 97
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000
iEdgeEnhanceMetadata->getEdgeEnhanceStrength()=0.5000

Hi Shane,
If you set strength to 0.5, I cannot really see if it fixed it or not, since 1-0.5=0.5. Could you try some other values. For example:

# Check if strength value from meta data is 0.85 or 0.15
./argus_camera --kpi=1 --edgeenhancestrength=0.15

# Check if strength value from meta data is 0.3 or 0.7
./argus_camera --kpi=1 --edgeenhancestrength=0.7

Thank you
Jon

OK, I saw the problem will check it and update it.

Thanks

Hi Shane,
Could you clarify with me that is it an bug from argus lib?
Also, I need to confirm the behavior with you. Say if I set the strength to 0.8 and I read 0.2 back from the meta data. Is the actual strength used by camera 0.8 or 0.2?

I need more detailed explanation here.

Thanks,

Jon

Hi Shane, any response to my most recent post?

I am consulting with developer to clarify it once get result will update to you.

Thanks

@jon7
Just confirm it’s a bug and will fix in next release. For your current version you can consider the value get from metadata classes substracted by 1

Also valid range is [0-1] for manual mode strength. If negative value is set it will be treated as auto mode

I would like to clarify your statement above. Let us take an example, say if I set the strength to 0.15. Then I read 0.85 back from the metadata. Based on your statement, the actual value I should use is 1-0.85=0.15. Is my understanding correct?

We have 3 modes for edge enhancement, EDGE_ENHANCE_MODE_OFF, EDGE_ENHANCE_MODE_FAST and EDGE_ENHANCE_MODE_HIGH_QUALITY. When you talk about manual mode, do you refer to EDGE_ENHANCE_MODE_FAST and EDGE_ENHANCE_MODE_HIGH_QUALITY?

Where can I set the edge enhancement auto mode? is auto mode the same as EDGE_ENHANCE_MODE_FAST or EDGE_ENHANCE_MODE_HIGH_QUALITY?

Thanks,

Jon

Hi @ShaneCCC ,
Can you reply my post please?

Thanks,
Jon

Yes, that is correct.

Auto mode should be the EDGE_ENHANCE_MODE_FAST

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.