Skip to content

Commit 467e84b

Browse files
committed
Update generate_octave template function implementation
Update generate_octave template function implementation
1 parent 3bcca03 commit 467e84b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

image_operations.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6167,7 +6167,8 @@ namespace TinyDIP
61676167
// Safely deduce the exact returned multi-channel image type directly
61686168
auto deduce_type_lambda = [&](auto&& each_plane)
61696169
{
6170-
return difference_of_gaussian(each_plane, initial_sigma, initial_sigma);
6170+
// Force floating-point precision on the plane before DoG evaluation
6171+
return TinyDIP::difference_of_gaussian(TinyDIP::im2double(each_plane), initial_sigma, initial_sigma);
61716172
};
61726173
using MultiChannelDiffT = decltype(apply_each(input, deduce_type_lambda));
61736174

@@ -6184,10 +6185,11 @@ namespace TinyDIP
61846185
#pragma omp parallel for
61856186
for (int i = 0; i < static_cast<int>(number_of_scale_levels) - 1; ++i)
61866187
{
6187-
octaves[i] = apply_each(input, [&](auto&& each_plane)
6188+
// Safely capture 'i' by value and the rest by reference to prevent race conditions
6189+
octaves[i] = apply_each(input, [&, i](auto&& each_plane)
61886190
{
6189-
return difference_of_gaussian(
6190-
each_plane,
6191+
return TinyDIP::difference_of_gaussian(
6192+
TinyDIP::im2double(each_plane),
61916193
initial_sigma * std::pow(k, static_cast<double>(i)),
61926194
initial_sigma * std::pow(k, static_cast<double>(i + 1))
61936195
);

0 commit comments

Comments
 (0)