Bugfixes, minor modifications.

This commit is contained in:
Karthik 2025-09-12 17:31:46 +02:00
parent 85ade404f2
commit b6a49ff0f7
3 changed files with 15 additions and 8 deletions

View File

@ -114,4 +114,7 @@ function val = nearestOdd(x, minVal)
% Enforce minimum
val = max(n, minVal);
if mod(val,2) == 0
val = val + 1; % bump to next odd
end
end

View File

@ -29,9 +29,9 @@ function plotDetectedPatches(img, patchProps, results, params, xStart, yStart, f
if isempty(hFig)
% If not found, create a new figure
hFig = figure('Name','Bayesian Optimization Live Viewer', ...
hFig = figure('Name','Optimization Live Viewer', ...
'NumberTitle','off', ...
'Position', [50 50 1000 800], ...
'Position', [200 200 600 600], ...
'KeyPressFcn',@keyPressCallback, ...
'Tag','OptimizerViewer'); % <-- unique tag
else

View File

@ -3,20 +3,24 @@
% Joint optimization across all training images
% ------------------ USER INPUTS ------------------
imageFolder = 'OptimizationImages';
maskFolder = 'OptimizationMasks';
% Use folder where this script is located
thisScriptPath = mfilename('fullpath');
[thisScriptDir, ~, ~] = fileparts(thisScriptPath);
baseimageFolder = fullfile(thisScriptDir, 'OptimizationImages');
basemaskFolder = fullfile(thisScriptDir, 'OptimizationMasks');
% Load all images and ground truth masks
imgFiles = dir(fullfile(imageFolder, '*.png'));
maskFiles = dir(fullfile(maskFolder, '*.png'));
imgFiles = dir(fullfile(baseimageFolder, '*.png'));
maskFiles = dir(fullfile(basemaskFolder, '*.png'));
nImages = min(numel(imgFiles), numel(maskFiles));
imgs = cell(1, nImages);
masks = cell(1, nImages);
for i = 1:nImages
imgs{i} = im2double(imread(fullfile(imageFolder, imgFiles(i).name)));
masks{i} = imread(fullfile(maskFolder, maskFiles(i).name)) > 0;
imgs{i} = im2double(imread(fullfile(baseimageFolder, imgFiles(i).name)));
masks{i} = imread(fullfile(basemaskFolder, maskFiles(i).name)) > 0;
end
% ------------------ BASE PARAMETERS ------------------