A list,

1 Origin and development history of Ant Colony Algorithm (ACA) Marco Dorigo et al. found that ant colonies can quickly find targets by secreting biohormones called pheromones to communicate foraging information when searching for food. Therefore, in his doctoral dissertation in 1991, he first systematically proposed a new intelligent optimization algorithm “Ant System” (AS for short) based on Ant population. Later, the proposer and many researchers made various improvements to the algorithm and applied it to a wider range of fields. Figure coloring problem, secondary assignment problem, workpiece sequencing problem, vehicle routing problem, job shop scheduling problem, network routing problem, large-scale integrated circuit design and so on. In recent years, M.Dorigo et al. further developed Ant algorithm into a general Optimization technology “Ant Colony Optimization (ACO)”, and called all the algorithms conforming to ACO framework “ACO algorithm”.



Specifically, individual ants start looking for food without first telling them where it is. When an ant finds food, it releases a volatile pheromone (called a pheromone, it evaporates over time and its concentration indicates how far the path is) into the environment that other ants sense as a guide. Generally, when there are pheromones on multiple paths, the ant will preferentially choose the path with high pheromone concentration, so that the pheromone concentration of the path with high pheromone concentration will be higher, forming a positive feedback. Some ants do not repeat the same route as others. They take a different route. If the alternative path is shorter than the original one, gradually more ants are attracted to the shorter path. Finally, after some time of running, there may be a shortest path repeated by most ants. In the end, the path with the highest pheromone concentration is the optimal one selected by the ant.

Compared with other algorithms, ant colony algorithm is a relatively young algorithm, characteristics, such as distributed computing center control and asynchronous indirect communication between individuals, and is easy to be combined with other optimization algorithms, through many healthyenterprise continuously explore, to today has developed a variety of improved ant colony algorithm, but the principle of ant colony algorithm is still the main.

2. Solving principle of ant colony algorithm

Based on the above description of ant colony foraging behavior, the algorithm mainly simulates foraging behavior from the following aspects:

(1) The simulated graph scene contains two pheromones, one representing home and one representing food location, and both pheromones are volatilized at a certain rate.

(2) Each ant can perceive information only in a small part of the area around it. Ants searching for food, if within the scope of the perception, can directly in the past, if is beyond the scope of awareness, will be toward more than pheromones, ants can have a small probability pheromone many places don’t go, and instead, it is very important to the small probability event, represents a way of innovation, is very important to find a better solution.

(3) Ants return to the nest using the same rules as when they find food.

(4) When ants move, they will first follow the guidance of pheromone. If there is no guidance of pheromone, they will follow the direction of their moving inertia, but there is a certain probability of changing direction. Ants can also remember the path they have already walked, so as to avoid repeating the same place.

(5) The ants leave the most pheromones when they find food, and then the farther away they are from the food, the less pheromone they leave. The rules for finding nest pheromones are the same as for food. Ant colony algorithm has the following characteristics: positive feedback algorithm, concurrency algorithm, strong robustness, probabilistic global search, does not rely on strict mathematical properties, long search time, easy to stop phenomenon.

Ant transfer probability formula:



In the formula, is the probability of ant K transferring from city I to city J; α and β were the relative importance of pheromones and heuristic factors, respectively. Is the pheromone quantity on edge (I, j); Is the heuristic factor; The next step for Ant K allows the selection of cities. The above formula is the pheromone update formula in the ant system, and is the pheromone quantity on the edge (I,j). ρ is the evaporation coefficient of pheromone, 0<ρ<1; Is the pheromone quantity left by the KTH ant on the edge (I,j) in this iteration; Q is a normal coefficient; Is the path length of the k ant during this tour.

In ant system, pheromone update formula is:



3. Solving steps of ant colony algorithm:

(1) Initialization parameters At the beginning of calculation, it is necessary to initialize related parameters, such as ant colony size (ant number) m, pheromone importance factor α, heuristic function importance factor β, pheromone will emit money ρ, total pheromone release Q, maximum iteration times iter_max, initial value of iteration times iter=1.

(2) construct solution space and randomly place each ant at different starting points. For each ant k (k=1,2,3… M), calculate the next city to be visited according to (2-1) until all ants have visited all cities.

(3) update information su to calculate the path length of each ant Lk(k=1,2… , m), record the optimal solution (shortest path) in the current iteration number. At the same time, pheromone concentration on the connection path of each city was updated according to Equations (2-2) and (2-3).

(4) Determine whether to terminate if iter<iter_max, set iter=iter+1 to clear the record table of ant paths and return to Step 2; Otherwise, the calculation is terminated and the optimal solution is output.

(5) Determine whether to terminate if iter<iter_max, set iter=iter+1 to clear the record table of ant paths and return to Step 2; Otherwise, the calculation is terminated and the optimal solution is output. 3. Determine whether to terminate. If iter<iter_max, set iter=iter+1 to clear the record table of ant paths and return to Step 2. Otherwise, the calculation is terminated and the optimal solution is output.

Ii. Source code

function varargout = ImageRegistration(varargin)
% IMAGEREGISTRATION M-file for ImageRegistration.fig
%      IMAGEREGISTRATION, by itself, creates a new IMAGEREGISTRATION or raises the existing
%      singleton*.
%
%      H = IMAGEREGISTRATION returns the handle to a new IMAGEREGISTRATION or the handle to
%      the existing singleton*.
%
%      IMAGEREGISTRATION('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in IMAGEREGISTRATION.M with the given input arguments.
%
%      IMAGEREGISTRATION('Property'.'Value',...). creates anew IMAGEREGISTRATION or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before ImageRegistration_OpeningFcn gets called.  An
%      unrecognized property name orinvalid value makes property % application % stop. All inputs are passed to ImageRegistration_OpeningFcn via varargin. %  % *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one % instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help ImageRegistration

% Last Modified by GUIDE v2. 5 24-May- 2021. 17:01:50

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ImageRegistration_OpeningFcn, ...
                   'gui_OutputFcn',  @ImageRegistration_OutputFcn, ...
                   'gui_LayoutFcn', [],...'gui_Callback'[]);if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

addpath(pwd);
% --- Executes just before ImageRegistration is made visible.
function ImageRegistration_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to ImageRegistration (see VARARGIN)

% Choose default command line output for ImageRegistration
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes ImageRegistration wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = ImageRegistration_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)CLC % % % % % % % % % % % % % % % call OpenImage. The m reading in the reference image and get the filename, image size % % % % % % % % % % % % [fname, pname, index]=uigetfile({'*.jpg; *.bmp; *.png; *.tif; *.gif; *.jpeg'},'Select reference image');
if index
    name=[pname fname];
    temp=imread(name);
    [m,n]=size(temp);
    m=num2str(m);
    n=num2str(n);
    imsize=[' ',m,The '*',n];
    handles.ImsizeI=imsize;
    handles.filenameI=name;
    handles.names_dispI=[fname,imsize];
end
set(handles.text2,'String',handles.names_dispI); guidata(hObject,handles); % % % % % % % % % % % % % % % % % % according to the reference image % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % axes (handles. Axes1) I = imread (handles. FilenameI); save I; imshow(I) figure(5)
imshow(I)


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)CLC % % % % % % % % % % % call OpenImage. The m read in floating image and get the file name and image size using % % % % % % % % % % [fname, pname, index]=uigetfile({'*.jpg; *.bmp; *.png; *.tif; *.gif; *.jpeg'},'Select floating Image');
if index
    name=[pname fname];
    temp=imread(name);
    [m,n]=size(temp);
    m=num2str(m);
    n=num2str(n);
    imsize=[' ',m,The '*',n];
    handles.ImsizeJ=imsize;
    handles.filenameJ=name;
    handles.names_dispJ=[fname,imsize];
end
set(handles.text3,'String',handles.names_dispJ); guidata(hObject,handles); % % % % % % % % % % % % % % % % % % floating images displayed % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % axes (handles. Axes2) J = imread (handles. FilenameJ); imshow(J) figure(6)
imshow(J)


% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)CLC % % % % % % % % % % % % % % % % check has input the reference image and floating image % % % % % % % % % % % % % % % % % % % % % % % % % % axesIbox=get(handles.axes1,'box');
axesJbox=get(handles.axes2,'box');
if strcmp(axesIbox,'off')||strcmp(axesJbox,'off')
    errordlg('Please select Image for Registration'.'Error')
    error('NO Image! ')End % % % % % % % % % % % % % % % detection reference images and floating image size is the same % % % % % % % % % % % % % % % % % % % % % % % % % handles. The isSameSizeIJ=strcmp(handles.ImsizeI,handles.ImsizeJ);
if handles.isSameSizeIJ~=1
    errordlg('Please select the Same Size Image'.'Error')
    error('Image Size doesn"t match! ') end % % % % % % % % % % % % % read and copy the image, an image is used in the registration process, another for registration after output I1% % % % % % % % % = imread (handles. FilenameI); J1=imread(handles.filenameJ); handles.Old_I=I1; handles.Old_J=J1; I=I1; J=J1; handles.I=I; handles.J=J; guidata(hObject,handles); %%%%%%%%%%%%% displays the "fusion" of the reference image and the floating image before registration"Rendering % % % % % % % % % % % % % % % % % % % % axes (handles. Axes4), imshow (uint8 (I + J)) % % % % % % % % % % % % % % % GLPF call function. The m (gaussian low-pass filter). %%%%%%%%%%%%% [I,J]=GLPF(handles); handles.I=I; handles.J=J; guidata(hObject,handles); % % % % % % % % % % % % % % Powell calls the function. The m, to realize image registration % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % tic RegistrationParameters = Powell (handles); %RegistrationParameters=AntColony(handles); %RegistrationParameters=AntColonyimprove(handles); toc ElapsedTime=toc; % % % % % % % % % % % % % % show registration results % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % handles.RegistrationParameters=RegistrationParameters; y=RegistrationParameters(1); x=RegistrationParameters(2); ang=RegistrationParameters(3); RegistrationResult=sprintf('X,Y,Angle=[%.5f][%.5f][%.5f]',x,y,ang); MI_Value=RegistrationParameters(4); MI_Value=sprintf('MI_Value=[%.4f]',MI_Value); ElapsedTime=sprintf('Elapsed Time=[%.3f]',ElapsedTime); axes(handles.axes5) [FusionImage,RegistrationImage]=Fusion(handles); imshow(FusionImage) axes(handles.axes3) imshow(RegistrationImage) figure(7) imshow(RegistrationImage) set(handles.text8,'string',RegistrationResult); set(handles.text9,'string',MI_Value); set(handles.text10,'string',ElapsedTime);Copy the code

3. Operation results

Fourth, note

Version: 2014 a