kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-host-side-calibration' into 'master'
genesys: Fix host side calibration See merge request sane-project/backends!334merge-requests/340/head
commit
d72e07c671
|
@ -666,16 +666,21 @@ bool ImagePipelineNodeExtract::get_next_row_data(std::uint8_t* out_data)
|
|||
|
||||
ImagePipelineNodeCalibrate::ImagePipelineNodeCalibrate(ImagePipelineNode& source,
|
||||
const std::vector<std::uint16_t>& bottom,
|
||||
const std::vector<std::uint16_t>& top) :
|
||||
const std::vector<std::uint16_t>& top,
|
||||
std::size_t x_start) :
|
||||
source_{source}
|
||||
{
|
||||
auto size = std::min(bottom.size(), top.size());
|
||||
std::size_t size = 0;
|
||||
if (bottom.size() >= x_start && top.size() >= x_start) {
|
||||
size = std::min(bottom.size() - x_start, top.size() - x_start);
|
||||
}
|
||||
|
||||
offset_.reserve(size);
|
||||
multiplier_.reserve(size);
|
||||
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
offset_.push_back(bottom[i] / 65535.0f);
|
||||
multiplier_.push_back(65535.0f / (top[i] - bottom[i]));
|
||||
offset_.push_back(bottom[i + x_start] / 65535.0f);
|
||||
multiplier_.push_back(65535.0f / (top[i + x_start] - bottom[i + x_start]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -476,7 +476,7 @@ class ImagePipelineNodeCalibrate : public ImagePipelineNode
|
|||
public:
|
||||
|
||||
ImagePipelineNodeCalibrate(ImagePipelineNode& source, const std::vector<std::uint16_t>& bottom,
|
||||
const std::vector<std::uint16_t>& top);
|
||||
const std::vector<std::uint16_t>& top, std::size_t x_start);
|
||||
|
||||
std::size_t get_width() const override { return source_.get_width(); }
|
||||
std::size_t get_height() const override { return source_.get_height(); }
|
||||
|
|
|
@ -1350,10 +1350,13 @@ void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
|
|||
}
|
||||
|
||||
if (has_flag(dev->model->flags, ModelFlag::CALIBRATION_HOST_SIDE) &&
|
||||
!has_flag(dev->model->flags, ModelFlag::NO_CALIBRATION))
|
||||
!has_flag(dev->model->flags, ModelFlag::NO_CALIBRATION) &&
|
||||
!has_flag(session.params.flags, ScanFlag::DISABLE_SHADING))
|
||||
{
|
||||
dev->pipeline.push_node<ImagePipelineNodeCalibrate>(dev->dark_average_data,
|
||||
dev->white_average_data);
|
||||
dev->white_average_data,
|
||||
dev->calib_session.params.startx *
|
||||
dev->calib_session.params.channels);
|
||||
|
||||
if (DBG_LEVEL >= DBG_io2) {
|
||||
dev->pipeline.push_node<ImagePipelineNodeDebug>("gl_pipeline_" +
|
||||
|
|
|
@ -445,7 +445,7 @@ void test_node_calibrate_8bit()
|
|||
ImagePipelineStack stack;
|
||||
stack.push_first_node<ImagePipelineNodeArraySource>(1, 1, PixelFormat::RGB888,
|
||||
std::move(in_data));
|
||||
stack.push_node<ImagePipelineNodeCalibrate>(bottom, top);
|
||||
stack.push_node<ImagePipelineNodeCalibrate>(bottom, top, 0);
|
||||
|
||||
ASSERT_EQ(stack.get_output_width(), 1u);
|
||||
ASSERT_EQ(stack.get_output_height(), 1u);
|
||||
|
@ -481,7 +481,7 @@ void test_node_calibrate_16bit()
|
|||
ImagePipelineStack stack;
|
||||
stack.push_first_node<ImagePipelineNodeArraySource>(1, 1, PixelFormat::RGB161616,
|
||||
std::move(in_data));
|
||||
stack.push_node<ImagePipelineNodeCalibrate>(bottom, top);
|
||||
stack.push_node<ImagePipelineNodeCalibrate>(bottom, top, 0);
|
||||
|
||||
ASSERT_EQ(stack.get_output_width(), 1u);
|
||||
ASSERT_EQ(stack.get_output_height(), 1u);
|
||||
|
|
Ładowanie…
Reference in New Issue