Subversion Repositories seema-scanner

Rev

Rev 209 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 209 Rev 210
Line 162... Line 162...
162
        cosTau = min(1,max(-1,cosTau)); %inexact float arithmetic?!
162
        cosTau = min(1,max(-1,cosTau)); %inexact float arithmetic?!
163
        sinTauSq = 1 - cosTau.^2;
163
        sinTauSq = 1 - cosTau.^2;
164
        b = sqrt( (aSq * thirdPtDistsSq(K) .* sinTauSq) ./ (aSq - thirdPtDistsSq(K) .* cosTau.^2 + eps) );
164
        b = sqrt( (aSq * thirdPtDistsSq(K) .* sinTauSq) ./ (aSq - thirdPtDistsSq(K) .* cosTau.^2 + eps) );
165
 
165
 
166
        %proper bins for b
166
        %proper bins for b
167
        idxs = ceil(b+eps);
167
        idxs = round(b)+1;
168
        
168
        
169
        if params.uniformWeights
169
        if params.uniformWeights
170
            weights = 1;
170
            weights = 1;
171
        else
171
        else
172
            weights = img(sub2ind(size(img),Y(K),X(K)));
172
            weights = img(sub2ind(size(img),Y(K),X(K)));
173
        end
173
        end
174
        accumulator = accumarray(idxs, weights, [params.maxMajorAxis 1]);
174
        accumulator = accumarray(idxs, weights, [params.maxMajorAxis 1]);
175
 
175
 
176
        %a bit of smoothing and finding the most busy bin
176
        %a bit of smoothing and finding the most busy bin
177
        accumulator = conv(accumulator,H,'same');
177
        %accumulator = conv(accumulator,H,'same');
178
        accumulator(1:ceil(sqrt(aSq)*params.minAspectRatio)) = 0;
178
        accumulator(1:ceil(sqrt(aSq)*params.minAspectRatio)) = 0;
179
        [score, idx] = max(accumulator);
179
        [score, idx] = max(accumulator);
180
 
180
 
181
        %keeping only the params.numBest best hypothesis (no non-maxima suppresion)
181
        %keeping only the params.numBest best hypothesis (no non-maxima suppresion)
182
        if (bestFits(end,end) < score)
182
        if (bestFits(end,end) < score)
183
            bestFits(end,:) = [x0 y0 sqrt(aSq) idx atand((y1-y2)/(x1-x2)) score];
183
            bestFits(end,:) = [x0 y0 sqrt(aSq) (idx-1) atand((y1-y2)/(x1-x2)) score];
184
            if params.numBest>1
184
            if params.numBest>1
185
                [~,si]=sort(bestFits(:,end),'descend');
185
                [~,si]=sort(bestFits(:,end),'descend');
186
                bestFits = bestFits(si,:);
186
                bestFits = bestFits(si,:);
187
            end
187
            end
188
        end
188
        end