Subversion Repositories seema-scanner

Rev

Rev 204 | Rev 210 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
209 jakw 1
function MSE = alignSubScansMarkers(calibrationFileName, scanDir, alnFileName)
204 jakw 2
%ALIGNSUBSCANSMARKERS Determines an exact alignment of sub scans (scans
3
% from e.g. one revolution of the rotation stage). 
4
% The method searches for circular white markers of the specified diameter.
5
% White frames corresponding to each sub scan must be available.
209 jakw 6
% A coarse alignment in the form of an aln-file must be provided. 
204 jakw 7
%
8
% 2017 Jakob Wilm, DTU
9
 
209 jakw 10
calibration = readOpenCVXML(calibrationFileName);
11
initialAlign = readMeshLabALN(alnFileName);
12
whiteFrameDirs = dir(fullfile(scanDir, 'sequence_*'));
13
 
14
assert(length(whiteFrameDirs) == length(initialAlign));
15
 
16
nSubScans = length(whiteFrameDirs);
17
 
18
for i=1:nSubScans
19
    frame0 = imread(fullfile(whiteFrameDirs(i).folder, whiteFrameDirs(i).name, 'frames0_0.png'));
20
    frame1 = imread(fullfile(whiteFrameDirs(i).folder, whiteFrameDirs(i).name, 'frames1_0.png'));
21
 
22
    %BW0 = im2bw(frame0, graythresh(frame0));
23
    %RP0 = regionprops(BW0, 'Area', 'Solidity', 'Eccentricity', 'Orientation', 'Centroid');
24
 
25
    gray0 = rgb2gray(frame0);
26
 
27
	[edge0, tr] = edge(gray0, 'Canny', [0.08 0.1], 2);
28
 
29
    %figure; imagesc(edge0);
30
 
31
    ep = struct('minMajorAxis', 15, 'maxMajorAxis', 25, 'minAspectRatio', 0.3, 'numBest', 50);
32
    e0 = ellipseDetection(edge0, ep);
33
 
34
    figure; hold('on'); imshow(edge0); ellipse(e0(:,3), e0(:,4), e0(:,5)*pi/180, e0(:,1), e0(:,2), 'r'); 
35
 
36
 
37
 
204 jakw 38
end
39
 
209 jakw 40
end
41