Note that there are some explanatory texts on larger screens.

plurals
  1. POOutlining a defect in an image?
    text
    copied!<p>I have the following image on which i have applied bilateral filtering and subtracted it from my original image </p> <p>Is it possible to outline the glass defect as shown </p> <p><img src="https://i.stack.imgur.com/V2PhR.jpg" alt="enter image description here"></p> <p>After apply Hough i got the following result not perfect :/</p> <p><img src="https://i.stack.imgur.com/8qw29.jpg" alt="enter image description here"></p> <p>My matlab code :</p> <pre><code> im = imread('C:\Users\SUJIT\Desktop\image003.jpg'); im=rgb2gray(im); h = fspecial('gaussian', size(im), 1.0); g = imfilter(im, h); im=im2double(g); im=imadjust(im); imgauss = imfilter(im, fspecial('gaussian',[7 7], 6),'conv'); imbi = bilateralfilter(im, [5 5], 3, 3); imbi= im - imbi; imshow(imbi,[]); title('Bilateral Filted Image'); I = imcrop(imbi, [30 30 450 350]); J = imfilter(I, fspecial('gaussian', [17 17], 5), 'symmetric'); BW = edge(J, 'canny'); %# Hough Transform and show matrix [H T R] = hough(BW); imshow(imadjust(mat2gray(H)), [], 'XData',T, 'YData',R, ... 'InitialMagnification','fit') xlabel('\theta (degrees)'), ylabel('\rho') axis on, axis normal, hold on colormap(hot), colorbar %# detect peaks P = houghpeaks(H, 10); plot(T(P(:,2)), R(P(:,1)), 'gs', 'LineWidth',2); %# detect lines and overlay on top of image lines = houghlines(BW, T, R, P); figure, imshow(I), hold on for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1), xy(:,2), 'g.-', 'LineWidth',2); end hold off </code></pre> <p>Please help am i doing something wrong here?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload