![]() |
Microscopy Image Browser
1.10
|
TEMPLATE_MATCHING is a cpu efficient function which calculates matching score images between template and an (color) 2D or 3D image. It calculates: More...
Functions | |
function [
I_SSD , I_NCC , Idata ] = | template_matching (T, I, IdataIn) |
TEMPLATE_MATCHING is a cpu efficient function which calculates matching score images between template and an (color) 2D or 3D image. It calculates: More... | |
function [
I_SSD , I_NCC , Idata ] = | templatematching>template_matching_color (T, I, IdataIn) |
function [
I_SSD , I_NCC , Idata ] = | templatematching>template_matching_gray (T, I, IdataIn) |
function T = | templatematching>rot90_3D (T) |
function B = | templatematching>unpadarray (A, Bsize) |
function
local_sum_I = | templatematching>local_sum (I, T_size) |
TEMPLATE_MATCHING is a cpu efficient function which calculates matching score images between template and an (color) 2D or 3D image. It calculates:
function local_sum_I = templatematching>local_sum | ( | I, | |
T_size | |||
) |
function T = templatematching>rot90_3D | ( | T | ) |
function [I_SSD , I_NCC , Idata ] = templatematching>template_matching_color | ( | T, | |
I, | |||
IdataIn | |||
) |
function [I_SSD , I_NCC , Idata ] = templatematching>template_matching_gray | ( | T, | |
I, | |||
IdataIn | |||
) |
function B = templatematching>unpadarray | ( | A, | |
Bsize | |||
) |
function [ I_SSD , I_NCC , Idata ] = template_matching | ( | T, | |
I, | |||
IdataIn | |||
) |
TEMPLATE_MATCHING is a cpu efficient function which calculates matching score images between template and an (color) 2D or 3D image. It calculates:
The normalized cross correlation (NCC), independent of illumination, only dependent on texture The user can combine the two images, to get template matching which works robust with his application. Both measures are implemented using FFT based correlation.
[I_SSD,I_NCC,Idata]=template_matching(T,I,Idata)
inputs, T : Image Template, can be grayscale or color 2D or 3D. I : Color image, can be grayscale or color 2D or 3D. (optional) Idata : Storage of temporary variables from the image I, to allow faster search for multiple templates in the same image.
outputs, I_SSD: The sum of squared difference 2D/3D image. The SSD sign is reversed and normalized to range [0 1] I_NCC: The normalized cross correlation 2D/3D image. The values range between 0 and 1 Idata : Storage of temporary variables from the image I, to allow faster search for multiple templates in the same image.
Example 2D, Find maximum response I = im2double(imread(lena.jpg
)); Template of Eye Lena T=I(124:140,124:140,:); Calculate SSD and NCC between Template and Image [I_SSD,I_NCC]=template_matching(T,I); Find maximum correspondence in I_SDD image [x,y]=find(I_SSD==max(I_SSD(:))); Show result figure, subplot(2,2,1), imshow(I); hold on; plot(y,x,r*
); title(Result
) subplot(2,2,2), imshow(T); title(The eye template
); subplot(2,2,3), imshow(I_SSD); title(SSD Matching
); subplot(2,2,4), imshow(I_NCC); title(Normalized-CC
);
Example 3D, Make some random data I=rand(50,60,50); Get a small volume as template T=I(20:30,20:30,20:30); Calculate SDD between template and image I_SSD=template_matching(T,I); Find maximum correspondence [x,y,z]=ind2sub(size(I_SSD),find(I_SSD==max(I_SSD(:)))); disp(x); disp(y); disp(z);
Function is written by D.Kroon University of Twente (February 2011)
Referenced by ib_alignstack(), and ib_alignstacks().