matlab - Edge detection and segmentation -
i trying extract object paper currency image. on original image applied sobel border detection. here image:
my question in next cropped image want have number 100 displayed out other noises. how can please?
the code used far is:
close all; clear all; note1 = imread('0001.jpg'); note2 = imread('0007.jpg'); figure(1), imshow(note1); figure(2), imshow(note2); note1=rgb2gray(note1); note2=rgb2gray(note2); edge1=edge(note1,'sobel'); edge2=edge(note2,'sobel'); figure(5), imshow(edge1),title('edge sobel1'); figure(6), imshow(edge2),title('edge sobel2'); rect_note1 = [20 425 150 70]; rect_note2 = [20 425 150 70]; sub_note1 = imcrop(edge1,rect_note1); sub_note2 = imcrop(edge2,rect_note2); figure(7), imshow(sub_note1); figure(8), imshow(sub_note2);
for completeness, original image:
use gaussian filter clean noise before applying border detector:
% create gaussian filter hsize = [5 5] , sigma = 3.5 g = fspecial('gaussian',[7 7], 3.5); note1f = imfilter(note1,g,'same'); edge1f=edge(note1f,'sobel'); sub_note1f = imcrop(edge1f,rect_note1); figure(6), imshow(sub_note1f);
this results in much cleaner 100 image
you utilize canny border detector instead of sobel transform.
edge1c = edge(note1,'canny', [0.2, 0.4] , 3.5); sub_note1c = imcrop(edge1c,rect_note1); figure(7), imshow(sub_note1c);
matlab image-processing image-segmentation edge-detection
No comments:
Post a Comment