Subversion Repositories seema-scanner

Rev

Rev 209 | Rev 211 | 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);
210 jakw 28
 
29
    %edge0 = edge0(1190:1290, 1975:2045);
209 jakw 30
    %figure; imagesc(edge0);
31
 
210 jakw 32
    ep = struct('minMajorAxis', 25, 'maxMajorAxis', 35, 'minAspectRatio', 0.4, 'numBest', 10, 'randomize', 2, 'smoothStddev', 1);
209 jakw 33
    e0 = ellipseDetection(edge0, ep);
34
 
35
    figure; hold('on'); imshow(edge0); ellipse(e0(:,3), e0(:,4), e0(:,5)*pi/180, e0(:,1), e0(:,2), 'r'); 
36
 
37
 
38
 
204 jakw 39
end
40
 
209 jakw 41
end
42