I am using the Scripting tool in ImageJ/Fiji to process two images (Gaussian blur) and then run the SIFT algorithm on those images. I am having trouble passing my image variable that has been modified with the Gaussian blur into the run() command for SIFT.
I am getting this error:
TypeError: cannot concatenate 'str' and 'ij.ImagePlus' objects
Here is my code:
from ij import IJ # Open images img1 = IJ.openImage('img1.jpg') img2 = IJ.openImage('img2.jpg') # Gaussian blur IJ.run(img1, "Gaussian Blur...", "sigma=5") IJ.run(img2, "Gaussian Blur...", "sigma=5") # Sift and feature matching IJ.run("Extract SIFT Correspondences", "source_image=["+img1+"] target_image=["+img2+"] initial_gaussian_blur=1.60 steps_per_scale_octave=3 minimum_image_size=64 maximum_image_size=1024 feature_descriptor_size=4 feature_descriptor_orientation_bins=8 closest/next_closest_ratio=0.92 filter maximal_alignment_error=25 minimal_inlier_ratio=0.05 minimal_number_of_inliers=7 expected_transformation=Similarity")
I also tried using & to pass in variables:
IJ.run("Extract SIFT Correspondences", "source_image=&img1 target_image=&img2
In this case, the code runs but I get the following message:
Is there any way to pass in img1 and img2 without opening them?