AE antibanding mode setting question

Hello,
I am using TX2+argus library+2 Leopard IMX577 cameras to capture images. I am running L4T 32.5. argus library version: 0.97.3.
I have a question to set aeantibanding mode. I use the following function to set AE antibanding mode for the camera:

bool IMX577StereoCamera::configCameraAeAntiBanding(Argus::IAutoControlSettings *iAutoControlSettings, const IMX577AeAntiBanding& aeAntiBandingConfig)
{
    bool res = false;
    std::stringstream ss;
    Argus::Status status = STATUS_OK;
    if(iAutoControlSettings != nullptr)
    {
        std::out << __func__ << "Set ae antibanding to " << std::hex << aeAntiBandingConfig.m_mode->time_low << ", " << IMX577AeAntiBanding::getAeAntiBandingModeStr(aeAntiBandingConfig.m_mode);
        status = iAutoControlSettings->setAeAntibandingMode(*(aeAntiBandingConfig.m_mode));
        if(status == STATUS_OK)
        {
            AeAntibandingMode mode = iAutoControlSettings->getAeAntibandingMode();
            std::out << __func__ << "Get ae antibanding mode: " << std::hex << mode.time_low << ", " << IMX577AeAntiBanding::getAeAntiBandingModeStr(mode);
            res = true;
        }
        else
        {
            ss << "Error lock AE antibanding mode" << VAR_VAL_STREAM(status);
            logAndThrow(ss.str(), __FILE__, __LINE__);
        }
    }
    else
    {
        ss << "nullptr found, " << VAR_VAL_STREAM(iAutoControlSettings);
        logAndThrow(ss.str(), __FILE__, __LINE__);
    }
    return res;
}

class IMX577AeAntiBanding: public ConfigLib::ConfigBase
{
    public:
        std::unique_ptr<Argus::AeAntibandingMode> m_mode;

        std::unique_ptr<Argus::AeFlickerState> m_flickerState;
        std::unique_ptr<Argus::AeState> m_state;
    public:
        IMX577AeAntiBanding();
        IMX577AeAntiBanding(const IMX577AeAntiBanding& aeAntiBanding);
        IMX577AeAntiBanding& operator=(const IMX577AeAntiBanding& aeAntiBanding);
        void setDefaultValues();

        virtual std::string defaultName() const override;
        virtual void read(const Json::Value& value) override;
        virtual Json::Value write() const override;
        virtual Json::Value writeDefinition() const override;

        Json::Value writeSetting() const;

        void setDefinition();

        std::string statusAEAntiBandingConfiguration() const;
        std::string statusAEAntiBandingSetting() const;

        static std::unique_ptr<Argus::AeAntibandingMode> getAeAntiBandingMode(const std::string& modeStr);
        static std::string getAeAntiBandingModeStr(const std::unique_ptr<Argus::AeAntibandingMode>& mode);
        static std::string getAeAntiBandingModeStr(const Argus::AeAntibandingMode& mode);
        static std::string getAeFlickerStateStr(const std::unique_ptr<Argus::AeFlickerState>& flickerState);
        static std::string getAeStateStr(const std::unique_ptr<Argus::AeState>& state);
        static std::string getAeFlickerStateStr(const Argus::AeFlickerState& flickerState);
        static std::string getAeStateStr(const Argus::AeState& state);
};

However, when I do the capture and read metadata. I got the following:
AE Flicker state is either AE_FLICKER_50HZ or AE_FLICKER_60HZ
AE state can be AE_STATE_SEARCHING and AE_STATE_CONVERGED.

I would like to know:

  1. If I set the antibanding off, what are the values of AE flicker state and AE state?
  2. Is there anything wrong with my setting method?
  3. Could you help me to get this antibanding setting working?

Thanks,

Jon

Checking will update to you once get result.

@jon7

  1. AE flicker state should be AE_FLICKER_NONE, AE antiband mode should be AE_ANTIBANDING_MODE_OFF, AE state should be non-AE_STATE_INACTIVE as AE is ON.
  2. Could you please use CAPTURE_INTENT_MANUAL in your request? If you are using CAPTURE_INTENT_PREVIEW, it means AE is active. Then, the flicker correction algorithm will be run in the background.

Please update us if you get the correct behavior after using CAPTURE_INTENT_MANUAL with setAeAntibandingMode() funciton. Thanks

Hi @JeremyHo ,
After setting it to CAPTURE_INTENT_MANUAL, the flicker state goes to AE_ANTIBANDING_MODE_OFF.

I also did some experiment, I found that except manual intent, other capture intents seem to keep anti-banding running in the background. And thus, even if I set AE_ANTIBANDING_MODE_OFF, the flicker mode will still has values as such AE_FLICKER_60HZ. Please confirm if i am correct on this point.

Thanks for your help.

Jon

@jon7

Yes, it matches my assumption. In our design, AE_ANTIBANDING is a part of AE. If you want to manually set antibanding, you should keep AE at the inactive state by using CAPTURE_INTENT_MANUAL.

@JeremyHo
Hi, thanks for you reply, it makes sense! Thank you.
I have some another questions. The reason I ask the following questions is because we changed the CAPTURE INTENT from PREVIEW to MANUAL which disables AE, I need to know what will be affected when we doing the image streaming and image capture.

  1. when we talked about AE(auto exposure), what is it exactly? From my understanding, it is a set of algorithm running in the TX2 background (maybe in ISP??) that controls certain camera settings. Please confirm.

  2. Further, what is “AE is active” and what is “AE is in inactive state”?

  3. Our product currently cares about the following settings:

    1. Exposure time
    2. ISP gain
    3. Analog gain
    4. Edge enhancement
    5. AE antibanding
    6. Exposure compensation
    7. white balance
    8. black level
    9. saturation

    If we turn off AE, which of the above settings will be affected? Some of the settings such as white balance for example, has automatic mode. If we use CAPTURE_INTENT_MANUAL, will this automatic mode still working? will white balance be adjusted automatically?

  4. From argus library header file include/Argus/Settings.h, are all the settings in IAutoControlSettings class related to AE? Is any other settings in other classes in Settings.h related to AE as well?

Thanks,

Jon

Hi,
Today, we did some more tests and have some new findings.

Test:
Modify the argus_camera source code to show the flicker_state. This is in bool EventThread::threadExecute() function in EventThread.cpp.

Position the Leopard IMX577 cameras to a place to have roughly half natural light and half artificial light. This will make the camera image stream constantly flickering if using anti-banding AUTO mode.
Use argus_camera utility provided from the multimedia_api source code to check the camera streams.
Please see the screen capture for the argus_camera settings:

Currently, the argus_camera is running in “Capture” mode and its intent is PREVIEW from the source code. The anti-banding mode is auto. What I see from the screen is that the camera stream is flickering. This makes sense, since we created a half natural light and half artificial light environment.

Then I change the anti-banding setting to OFF. I see that the camera stream stops flickering. However, the argus_camera standard output shows me that the flicker_state is AE_FLICKER_50HZ.

Please see the video for test:

So that means the anti-banding is able to be turned off. It is just the flicker state did not show the correct value? Or I have some misunderstandings of what AE_FLICKER_STATE should show me? Can you explain the behaviour? (If possible, please explain AE_FLICKER_STATE and AE_STATE together)

Thanks

Jon

  1. From my understanding, the AE algorithm takes images and auto-controls settings as input and outputs calculated auto-controls including gains and exposure time.
  2. When AE is in the inactive state, the AE algorithm doesn’t do calculations only passes state info.
  3. Exposure time, ISP gain, Analog gain, AE antibanding should be affected by AE algo.
    When using CAPTURE_INTENT_Manual, AE/AF/AWB should be at off state.
  4. No, some are for AWB/AF. Aperture and gain settings in ISourceSettings are also about AE

Could you please provide the source code so that we can check the exact issue? Thanks

@JeremyHo
Here are the list of files I modified and added, please find the files in the attachement.
./argus/apps/camera/modules/Dispatcher.cpp
./argus/apps/camera/modules/EventThread.cpp
./argus/apps/camera/modules/PerfTracker.cpp
./argus/apps/camera/modules/helper_debug.cpp (add the file)
./argus/apps/camera/modules/helper_debug.h (add the file)
./argus/apps/camera/modules/tasks/StillCapture.cpp

Dispatcher.cpp (74.5 KB)
EventThread.cpp (6.4 KB)
helper_debug.cpp (5.3 KB)
helper_debug.h (923 Bytes)
StillCapture.cpp (12.9 KB)
PerfTracker.cpp (9.8 KB)

Jon

Hi @JeremyHo
any updates after using the source code files I provided?

Jon

Any updates on this topic?

Thanks,

Jon

@jon7

So that means the anti-banding is able to be turned off. It is just the flicker state did not show the correct value? Or I have some misunderstandings of what AE_FLICKER_STATE should show me? Can you explain the behaviour?

  1. AE OFF case (manual):
    AE Antibanding Algorithm off. We still compute flicker state. But do not apply the Antibanding effect as algorithm is off.

  2. AE ON case (preview or others)
    i. setting AE_ANTIBANDING_MODE_OFF:
    AE Antibanding Algorithm off. We still compute flicker state. But do not apply the Antibanding effect as the algorithm is off.
    ii. setting AE_ANTIBANDING_MODE_AUTO:
    AE Antibanding Algorithm on. We apply antibanding effect by using the computed flicker state results.
    iii. setting AE_ANTIBANDING_MODE_50HZ/60HZ:
    You can take this as anitbanding manual mode. Manually use 50Hz or 60Hz. Also, we still compute flicker state. But apply the Antibanding effect with 50HZ or 60HZ

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