Misc (#19)
* get image returns optional<Mat> instead of unique_ptr<Mat> * introduce complexity * rename image load function * add example for a basic reader for binary image files * fix windows build? * add a status bar underneath the menu bar * use status bar in custom_0 example app * clang formats * packing w/ pragma push * add "Save As" functions to image views * resize over reserve * rm local override uri * add simple thread pool * rename to simple_thread_pool * get rid of useless renderlib * document version inc * extract hardcoded values to in-header * clang format patch * clone registered image in custom_0 * document binary-file header * minor fixes * clang format * rm unused render cmake
This commit is contained in:
committed by
Maximilian Kueffner
parent
e3e161ce52
commit
b37814204f
@@ -52,7 +52,7 @@ class Selector
|
||||
if (ImGui::BeginCombo("Select first image", preview_0_.c_str()))
|
||||
{
|
||||
pool_.Enumerate(
|
||||
[&](resources::ResourceKey key, size_t idx, const imaging::IPixelariumImage& img) -> void
|
||||
[&](resources::ResourceKey key, size_t idx, const imaging::IPixelariumImage<cv::Mat>& img) -> void
|
||||
{
|
||||
const bool is_selected = static_cast<int>(idx) == selected_idx_0;
|
||||
if (ImGui::Selectable(img.Name().c_str(), is_selected))
|
||||
@@ -74,7 +74,7 @@ class Selector
|
||||
if (ImGui::BeginCombo("Select second image", preview_1_.c_str()))
|
||||
{
|
||||
pool_.Enumerate(
|
||||
[&](resources::ResourceKey key, size_t idx, const imaging::IPixelariumImage& img) -> void
|
||||
[&](resources::ResourceKey key, size_t idx, const imaging::IPixelariumImage<cv::Mat>& img) -> void
|
||||
{
|
||||
const bool is_selected = static_cast<int>(idx) == selected_idx_1;
|
||||
if (ImGui::Selectable(img.Name().c_str(), is_selected))
|
||||
@@ -100,11 +100,12 @@ class Selector
|
||||
auto img1 = pool_.GetResource(selected_key_1);
|
||||
auto img_mat1 = img1.lock()->TryGetImage();
|
||||
|
||||
if (img_mat0 == nullptr || img_mat1 == nullptr || img_mat0->empty() || img_mat1->empty()) return;
|
||||
if (!img_mat0.has_value() || !img_mat1.has_value() || img_mat0.value().empty() || img_mat1.value().empty())
|
||||
return;
|
||||
|
||||
if (img_mat0->size != img_mat1->size) return;
|
||||
|
||||
cv::multiply(*img_mat0, *img_mat1, *img_mat0);
|
||||
cv::multiply(img_mat0.value(), img_mat1.value(), img_mat0.value());
|
||||
|
||||
std::string name{std::format("Multiply_{}", idx_)};
|
||||
pool_.SetResource(std::make_unique<imaging::PixelariumMem>(*img_mat0, name, *logger));
|
||||
|
||||
Reference in New Issue
Block a user