Is it possible to crop image parallel with angle?

7 views (last 30 days)
If I set a point in the picture with the angle of its orientation, is there a possible way to crop around this point, where the center of the cropped image centers the position of this point and parallels the orientation of this point?

Accepted Answer

Image Analyst
Image Analyst on 22 Sep 2018
Yes, as long as you also specify the width of the box perpendicular to the orientation line. Otherwise you just get the entire image like you have now. Simply create a mask with poly2mask() with the polygon you've created to outline the region you want.
[rows, columns, numberOfcolorChannels] = size(grayImage);
mask = poly2mask(x, y, rows, columns);
then mask it
grayImage(~mask) = 0; % Blacken outside mask.
If you also want to crop in addition to blackening, then find the limits of the mask then use indexing.
[r,c] = find(mask);
topRow = min(r);
bottomRow = max(r);
leftCol = min(c);
rightCol = max(c);
croppedImage = grayImage(topRow:bottomRow, leftCol:rightcol);
wisam kh
wisam kh on 25 Sep 2018
Edited: wisam kh on 25 Sep 2018
Sorry if I could not explain the idea. Each pixel in the image has a orientation angle measured in certain ways, depending on the orientation of the ridges in the fingerprint. If I can find the orthogonal points with this angle I will get a new image that is almost similar to all the pictures when I apply the mask method, because I took into account the angle of point.
thank you again

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!