Skip to content

Brightness computation #245

@Feddockh

Description

@Feddockh

Is this behavior also observed when using SpinVIew?
No

Describe the bug
In spinnaker_wrapper_impl.cpp, the brightness is only computed for bayer images. Additionally, this compatibility is poorly documented and there are no error messages for users.

static int16_t compute_brightness(
pixel_format::PixelFormat pf, const uint8_t * data, size_t w, size_t h, size_t stride, int skip)
{
if (!pixel_format::is_bayer(pf)) {
return (0);
}
const uint64_t cnt = int_ceil(w, skip) * int_ceil(h, skip);
uint64_t tot = 0;
const uint8_t * p = data;
for (size_t row = 0; row < h; row += skip) {
for (size_t col = 0; col < w; col += skip) {
tot += p[col];
}
p += stride * skip;
}
return (tot / cnt);
}

These were from print statements I've added myself. My image format is RBG8Packed and when I try to get the brightness it just returns 1 and therefore my gain/exposure jumps way up.

Useful logging output
[component_container-1] Current Brightness: 1
[component_container-1] Target Brightness: 120

System details

  • operating system/version: Ubuntu 22.04
  • ROS Humble
  • FLIR Firefly cameras (I don't have the full id), but they worked after adding my own params file. If you would like to add it to your existing configs just let me know.

Metadata

Metadata

Assignees

Labels

ROS2This problem occurs with the ROS2 driver

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions