How to remove white background from image
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Fateme Jalali
am 28 Jul. 2016
Bearbeitet: Image Analyst
am 28 Jul. 2016
Hello,I want to know how to remove white background completely from this image.what is the way?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155233/image.png)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 28 Jul. 2016
Bearbeitet: Image Analyst
am 28 Jul. 2016
I'd use min() to get the min in all three color channels. Then use bwareafilt() to get just the largest blob. This will be the rectangle. You can use find to find the first and last row and column and finally crop the image, something like this untested code.
grayImage = min(rgbImage, [], 3);
binaryImage = grayImage < 200;
binaryImage = bwareafilt(binaryImage, 1);
[rows, columns] = find(binaryImage);
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
% Crop
croppedImage = rgbImage(row1:row2, col1:col2, :);
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!