Skip to content

Commit

Permalink
Experiments wthh sharpness-weighted accumulations
Browse files Browse the repository at this point in the history
  • Loading branch information
amyznikov committed Oct 7, 2021
1 parent 52cd5c2 commit e249807
Show file tree
Hide file tree
Showing 17 changed files with 384 additions and 133 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ endif()


# libconfig
set(LIBCONFIG_MINIMUM_VERSION_REQUIRED "1.5")
set(LIBCONFIG_MINIMUM_VERSION_REQUIRED "1.7")
find_package(libconfig)
if( LIBCONFIG_FOUND AND (LIBCONFIG_VERSION VERSION_GREATER ${LIBCONFIG_MINIMUM_VERSION_REQUIRED}) OR (LIBCONFIG_VERSION VERSION_EQUAL ${LIBCONFIG_MINIMUM_VERSION_REQUIRED}))
message(STATUS "libconfig ${LIBCONFIG_VERSION} found")
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ OpenCV >= 4.2

TBB

libconfig >= 1.5
libconfig >= 1.7

libtiff

libraw
libraw >= 0.20 (https://www.libraw.org)

libopenraw-0.3
libopenraw-0.3 (https://libopenraw.freedesktop.org)

cfitsio

Expand Down
43 changes: 30 additions & 13 deletions core/improc/c_smap_routine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,52 @@ c_smap_routine::ptr c_smap_routine::create(bool enabled)
return ptr (new this_class(enabled));
}

c_smap_routine::ptr c_smap_routine::create(double minv, double scale, bool enabled)
c_smap_routine::ptr c_smap_routine::create(int lksize, int scale_size, double minv, bool enabled)
{
ptr obj(new this_class(enabled));
obj->set_lksize(lksize);
obj->set_scale_size(scale_size);
obj->set_minv(minv);
obj->set_scale(scale);
return obj;
}

void c_smap_routine::set_minv(double v)

void c_smap_routine::set_lksize(int v)
{
minv_ = v;
lksize_ = v;
}

double c_smap_routine::minv() const
int c_smap_routine::lksize() const
{
return minv_;
return lksize_;
}


void c_smap_routine::set_scale_size(int v)
{
scale_size_ = v;
}

void c_smap_routine::set_scale(double v)
int c_smap_routine::scale_size() const
{
scale_ = v;
return scale_size_;
}

double c_smap_routine::scale() const
void c_smap_routine::set_minv(double v)
{
return scale_;
minv_ = v;
}

double c_smap_routine::minv() const
{
return minv_;
}


bool c_smap_routine::process(cv::InputOutputArray image, cv::InputOutputArray mask)
{
cv::Mat1f smap;
compute_smap(image, smap, minv_, scale_);
compute_smap(image, smap, lksize_, scale_size_, minv_);
image.move(smap);
return true;
}
Expand All @@ -61,8 +75,9 @@ bool c_smap_routine::deserialize(c_config_setting settings)
return false;
}

settings.get("lksize", &lksize_);
settings.get("scale_size", &scale_size_);
settings.get("minv", &minv_);
settings.get("scale", &scale_);

return true;
}
Expand All @@ -73,8 +88,10 @@ bool c_smap_routine::serialize(c_config_setting settings) const
return false;
}


settings.set("lksize", lksize_);
settings.set("scale_size", scale_size_);
settings.set("minv", minv_);
settings.set("scale", scale_);

return true;
}
18 changes: 11 additions & 7 deletions core/improc/c_smap_routine.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,24 @@ class c_smap_routine
c_smap_routine(bool enabled = true);

static ptr create(bool enabled = true);
static ptr create(double minv, double scale = 1.0 / 16, bool enabled = true);
static ptr create(int lksize, int scale_size, double minv, bool enabled = true);
bool deserialize(c_config_setting settings) override;
bool serialize(c_config_setting settings) const override;
bool process(cv::InputOutputArray image, cv::InputOutputArray mask = cv::noArray()) override;

void set_minv(double v);
double minv() const;
void set_lksize(int );
int lksize() const;

void set_scale_size(int);
int scale_size() const;

void set_scale(double v);
double scale() const;
void set_minv(double);
double minv() const;

protected:
double minv_ = 0;
double scale_ = 1.0/16;
int lksize_ = 7;
int scale_size_ = 6;
double minv_ = 1;
};


Expand Down
2 changes: 1 addition & 1 deletion core/io/c_raw_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int c_raw_file_reader::raw2mat(cv::Mat & output_image)


colorid_ = COLORID_UNKNOWN;
bpc_ = raw.imgdata.color.raw_bps;
bpc_ = 16; // fixme: raw.imgdata.color.raw_bps;
black_level_ = raw.imgdata.color.black;

if ( !output_image.empty() && !output_image.isContinuous() ) {
Expand Down
Loading

0 comments on commit e249807

Please sign in to comment.