Hello, I am currently facing an issue:
I am randomly setting the exposure time in libcamera/.../ipa_base.cpp and retrieving the exposure time from the metadata in rpicam/.../output.cpp. However, it seems that the exposure time does not always match the set value. What could be the reason for this difference?
Here's the log:
libcamera/.../ipa_base.cpp: timestamp 85463377259000
libcamera/.../ipa_base.cpp: set Pi exp_time 5000
rpicam/.../output.cpp: timestamp 85463377259000
rpicam/.../output.cpp: get Pi exp_time 4999 // match the 5000 setting
libcamera/.../ipa_base.cpp: timestamp 85463410592000
libcamera/.../ipa_base.cpp: set Pi exp_time 9000
rpicam/.../output.cpp: timestamp 85463410592000
rpicam/.../output.cpp: get Pi exp_time 4999 // dismatch the 9000 setting
libcamera/.../ipa_base.cpp: timestamp 85463443921000
libcamera/.../ipa_base.cpp: set Pi exp_time 5000
rpicam/.../output.cpp: timestamp 85463443921000
rpicam/.../output.cpp: get Pi exp_time 8998 // dismatch the 5000 setting
libcamera/.../ipa_base.cpp: timestamp 85463477246000
libcamera/.../ipa_base.cpp: set Pi exp_time 5000
rpicam/.../output.cpp: timestamp 85463477246000
rpicam/.../output.cpp: get Pi exp_time 4999 // match the 5000 setting
Here's the code:
libcamera/.../ipa_base.cpp
void IpaBase::processStats(const ProcessParams ¶ms)
{
...
...
struct AgcStatus agcStatus;
if (rpiMetadata.get("agc.status", agcStatus) == 0) {
ControlList ctrls(sensorCtrls_);
// my implementation
int32_t value = getRandomValue(); //values ∈ {5000, 7000, 9000};
std::cout << "libcamera/.../ipa_base.cpp: set Pi exp_time " << value << std::endl;
agcStatus.shutterTime = value * 1.0us;
agcStatus.analogueGain = 1.0;
// my implementation
applyAGC(&agcStatus, ctrls);
setDelayedControls.emit(ctrls, ipaContext);
setCameraTimeoutValue();
}
...
...
}
int32_t getRandomValue()
{
// Define possible values
std::vector<int32_t> values = {5000, 7000, 9000};
// Use random device and generator
std::random_device rd;
std::mt19937 gen(rd());
// Define distribution range
std::uniform_int_distribution<> distrib(0, values.size() - 1);
// Generate random index and return the corresponding value
return values[distrib(gen)];
}
I'm not sure if this topic has been discussed before. If anyone could provide some guidance, I would greatly appreciate it.
I am randomly setting the exposure time in libcamera/.../ipa_base.cpp and retrieving the exposure time from the metadata in rpicam/.../output.cpp. However, it seems that the exposure time does not always match the set value. What could be the reason for this difference?
Here's the log:
libcamera/.../ipa_base.cpp: timestamp 85463377259000
libcamera/.../ipa_base.cpp: set Pi exp_time 5000
rpicam/.../output.cpp: timestamp 85463377259000
rpicam/.../output.cpp: get Pi exp_time 4999 // match the 5000 setting
libcamera/.../ipa_base.cpp: timestamp 85463410592000
libcamera/.../ipa_base.cpp: set Pi exp_time 9000
rpicam/.../output.cpp: timestamp 85463410592000
rpicam/.../output.cpp: get Pi exp_time 4999 // dismatch the 9000 setting
libcamera/.../ipa_base.cpp: timestamp 85463443921000
libcamera/.../ipa_base.cpp: set Pi exp_time 5000
rpicam/.../output.cpp: timestamp 85463443921000
rpicam/.../output.cpp: get Pi exp_time 8998 // dismatch the 5000 setting
libcamera/.../ipa_base.cpp: timestamp 85463477246000
libcamera/.../ipa_base.cpp: set Pi exp_time 5000
rpicam/.../output.cpp: timestamp 85463477246000
rpicam/.../output.cpp: get Pi exp_time 4999 // match the 5000 setting
Here's the code:
libcamera/.../ipa_base.cpp
void IpaBase::processStats(const ProcessParams ¶ms)
{
...
...
struct AgcStatus agcStatus;
if (rpiMetadata.get("agc.status", agcStatus) == 0) {
ControlList ctrls(sensorCtrls_);
// my implementation
int32_t value = getRandomValue(); //values ∈ {5000, 7000, 9000};
std::cout << "libcamera/.../ipa_base.cpp: set Pi exp_time " << value << std::endl;
agcStatus.shutterTime = value * 1.0us;
agcStatus.analogueGain = 1.0;
// my implementation
applyAGC(&agcStatus, ctrls);
setDelayedControls.emit(ctrls, ipaContext);
setCameraTimeoutValue();
}
...
...
}
int32_t getRandomValue()
{
// Define possible values
std::vector<int32_t> values = {5000, 7000, 9000};
// Use random device and generator
std::random_device rd;
std::mt19937 gen(rd());
// Define distribution range
std::uniform_int_distribution<> distrib(0, values.size() - 1);
// Generate random index and return the corresponding value
return values[distrib(gen)];
}
I'm not sure if this topic has been discussed before. If anyone could provide some guidance, I would greatly appreciate it.
Statistics: Posted by pyc700 — Fri Jun 07, 2024 4:54 am — Replies 1 — Views 34