How can i split 2 type of objects ( protrusions and depressions) in 2 different images ?
1 view (last 30 days)
Show older comments
if true
close all ;
clear all;
clc ;
%% read the image i = imread('a.jpg');
%% convert to grayscale x1 = rgb2gray(i);
%% preprocessing % adjusment
ww = fspecial('gaussian' ,[10 10 ] , .66 ); % lowpass gaussian filter www= imfilter(x1,ww,'conv');
x=imadjust(www , [] , [] ,5);
kk = 255-x; %complement figure(2), imshow(kk);
%Histogram of image figure(1); [pixelCount, grayLevels] = imhist(kk); bar(pixelCount); title('Histogram of original image');
%median filter A = medfilt2(kk,[2 2]); J = stdfilt(A);
% fill a gap in the pen's cap se = strel('disk',3); bw = imopen(kk,se);
% fill any holes, so that regionprops can be used to estimate % the area enclosed by each of the boundaries bw = imfill(bw,'holes');
%% centroids
xy= im2bw(kk); bw = imfill(xy,'holes');
se = strel('disk',5); xy=imdilate(xy,se); grayImage = xy ;
[l , num] = bwlabel(bw); stat = regionprops(l,'centroid'); %%%%%%%%%%%STATS = regionprops(bw, properties) ; figure(8),imshow(bw); hold on; for x = 1: num plot(stat(x).Centroid(1),stat(x).Centroid(2),'ro'); end
%%%segmenting cc = bwconncomp(bw); stats = regionprops(cc, 'Area','Eccentricity'); idx = find([stats.Area] < 15 ); idx2 = find([stats.Area] > 15 );
BW1 = ismember(labelmatrix(cc), idx); BW2 = ismember(labelmatrix(cc), idx2); figure(5),imshow(BW1);
figure(6),imshow(BW2);
%%% bad results
endHello
I need help in segmentation ... I have a double sided Braille image I wont to segment the protrusions and the depressions in 2 different images .
I'm lost .........
I converted the image to binary when trying to split the 2 types of objects into 2 images ... I didn't know how to do it ?????
how could I recognise 2 type of objects ?
Answers (0)
See Also
Categories
Find more on Image Segmentation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!