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);
Comments
Post a Comment