MATLAB Answers

0

Remove the unwanted region from an image and rotate it to 45 degree

Asked by ashwini patil on 12 Oct 2018
Latest activity Commented on by ashwini patil on 29 Oct 2018
I have an image attached with this question. I wanted to remove the unwanted white portion and rotate image to 45 degree angle. The unwanted portion contains values either 255 or 0. Please help me.

  1 Comment

Remove the unwanted region
What does it mean?
Remove the pixel?? Then what remains there?

Sign in to comment.

4 Answers

Answer by Image Analyst
on 12 Oct 2018
 Accepted Answer

Try this:
grayImage = imread('11.bmp');
subplot(2, 2, 1);
imshow(grayImage)
title('Original Image', 'FontSize', 15);
grayImage = imrotate(grayImage, -45);
subplot(2, 2, 2);
imshow(grayImage)
title('Rotated Image', 'FontSize', 15);
% Get mask
mask = bwconvhull(grayImage ~= 255 & grayImage ~= 0);
subplot(2, 2, 3);
imshow(mask)
title('mask', 'FontSize', 15);
% Find cropping index
[rows, columns] = find(mask)
% Crop
croppedImage = grayImage(min(rows):max(rows), min(columns):max(columns));
subplot(2, 2, 4);
imshow(croppedImage)
title('Cropped Image', 'FontSize', 15);

  1 Comment

Now in my project I have to compute energy and entropy of the above cropped Images. Can you please guide me that how should the energy and entropy of an image is calculated??

Sign in to comment.


Answer by ashwini patil on 15 Oct 2018

Thats great..... Thank you ... Its working fine.... and thanks again for quick response...

  0 Comments

Sign in to comment.


Answer by ashwini patil on 15 Oct 2018

Same thing I was trying to do on attached image. I want only ridge region of the fingerprint from the image attached with this question. I wrote following program for that. But gives same image as output. Please help me.
grayImage = imread('123.bmp'); subplot(2, 2, 1); imshow(grayImage) title('Original Image', 'FontSize', 15); % grayImage = imrotate(grayImage, -45); % subplot(2, 2, 2); % imshow(grayImage) % title('Rotated Image', 'FontSize', 15); % Get mask mask = bwconvhull(grayImage ~= 252 & grayImage ~= 253 & grayImage ~= 255 ); subplot(2, 2, 3); imshow(mask) title('mask', 'FontSize', 15); % Find cropping index [rows, columns] = find(mask); % Crop croppedImage = grayImage(min(rows):max(rows), min(columns):max(columns)); subplot(2, 2, 4); figure,imshow(croppedImage) title('Cropped Image', 'FontSize', 15);

  0 Comments

Sign in to comment.


Answer by ashwini patil on 16 Oct 2018
Edited by Image Analyst
on 16 Oct 2018

Hello sir, Please help me.. I want the solution as early as possible.. I attached one image with this question. I want only region of interest of this image. Means I want to remove white portion from image. Please guide me.

  1 Comment

What do you want in place of the white? Because images cannot have ragged bottoms or sides - they MUST remain rectangular.

Sign in to comment.