How can i extract vertical lines from the print given?

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?

Risposte (1)

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 Commenti

why windowWidth is set to 5? And i just want to extract the vertical lines which might be of different lengths. Which morphological operation I can use? Should I find the height of the lip print?
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?
Bear with me.What am I trying to do is I can get the maximum vertical height of the image by finding the distance between topmost black pixel and bottom most black pixel. Then i can apply that obtained length to select the suitable structuring element set to extract the feature using hit miss. Size function gives the height of the entire image including white pixels.So how can I identify the vertical distance?
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.
And what if my image's first black pixel is not in the first row? what if my actual image starts from somewhere in the middle and ends before the last row itself?
That's what the second, more general snippet of code does.
Thank you. That helped.

Accedi per commentare.

Categorie

Scopri di più su Read, Write, and Modify Image in Centro assistenza e File Exchange

Richiesto:

PP
il 11 Feb 2017

Commentato:

PP
il 23 Feb 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by