Using ImageJ as a plugin for mass image analysis

15 views (last 30 days)
I am currently trying to use ImageJ as a plug-in where I can open a file and have the script apply certain settings to it (Image>Adjust>Color Threshold> Color Threshold: B&W, Brightness = 75). I've been able to open the image, but I'm having trouble applying the settings I want. The "Apply" command isn't working and I am running out of ideas. I've attached the code below. Can anyone help?
javaaddpath('C:\Program Files\MATLAB\R2023b\java\mij.jar');
javaaddpath('C:\Program Files\MATLAB\R2023b\java\ij.jar');
MIJ.start;
% Browse for the JPEG or TIFF file
[filename, filepath] = uigetfile('*.*');
imagePath = fullfile(filepath, filename);
% Open the image using MIJ
MIJ.run('Open...', ['path=[' imagePath ']']);
% Open the Color Threshold dialog
MIJ.run('Color Threshold...');
% Set color space to B&W
MIJ.run('Set... ', ['thresholded color=B&W']);
% Close the Color Threshold dialog (applies the changes)
MIJ.run('Close');

Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!