matlab - Using radon function to find black bar position in white background image -


i want use radon projection find horizontal position (x coordinate) of black bar in white image (first image). code returns result in third image while expectation second image. problem, code here:

clear; clc; img = rgb2gray(imread('2.png')); bwimg = ~im2bw(img);  [r, xp] = radon(bwimg, 0);  [h w] = size(img);     dw = w / length(xp); [a ix] = max(r(:,1)); pos = round(w/2 + xp(ix)*dw); bwimg(:, pos) = 1; figure; imshow(bwimg); 

enter image description here enter image description here enter image description here


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -