How can i extract vertical lines from the print given?
Show older comments
I want to extract only the verticle lines which might be present in the lip print given using only morphological operations. Is there any preprocessing required before doing so?


Answers (1)
Image Analyst
on 11 Feb 2017
You can use bwareaopen() to get rid of the large blobs. Then get rid of horizontal lines using
windowWidth = 5; % Whatever...some odd number.
verticalLines = imerode(binaryImage, ones(windowWidth, 1));
7 Comments
PP
on 16 Feb 2017
Image Analyst
on 16 Feb 2017
If you don't like 5, change it to whatever works. What is your definition of a vertical line? There are very very few perfectly vertical lines, but lots of irregularly shaped blobs and spider shaped blobs. So how do you define it? By bounding box aspect ratio?
PP
on 20 Feb 2017
Image Analyst
on 20 Feb 2017
Since you have black on the very top row and the very bottom row, the vertical height would simply be the number of rows in the image:
[rows, columns, numColorChannels] = size(yourImage);
or more generally
verticalProfile = mean(yourImage, 2);
topRow = find(verticalProfile < 255, 1, 'first');
bottomRow = find(verticalProfile < 255, 1, 'last');
height = bottomRow - topRow; % optionally add 1 if you want.
PP
on 23 Feb 2017
Image Analyst
on 23 Feb 2017
That's what the second, more general snippet of code does.
PP
on 23 Feb 2017
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!