Crop the irrelevant part of the Image
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zaheer Abbas
am 28 Apr. 2017
Beantwortet: Image Analyst
am 2 Mai 2017
I am new to Matlab. I want to crop the highlighted part of the gray image and remove the rest part. How to do that, kindly explain as well. Thanks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163503/image.jpeg)
3 Kommentare
Image Analyst
am 2 Mai 2017
You have not attached the original image. Not the cropped one, and not the one with the red box on it, but the original image. So, did you even try stdfilt()?
Akzeptierte Antwort
Image Analyst
am 28 Apr. 2017
If you know the bounding rows and columns, you can do indexing
croppedImage = rgbImage(row1:row2, col1:col2, :);
or use imcrop():
croppedImage = imcrop(rgbImage, [leftCol, topRow, (rightCol-leftCol+1), (bottomRow-topRow+1)]);
6 Kommentare
Image Analyst
am 29 Apr. 2017
Yes, but that was not the original question so I didn't answer that. You could use stdfilt() and threshold and find the bounding box. Search for braille here - I know I've done code for it before.
Weitere Antworten (2)
Image Analyst
am 2 Mai 2017
Zaheer, I'm sure by now you've tried to take my suggestion and use stdfilt() to automatically get the bounding box. You can look at how I did it and compare it to your own.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175845/image.png)
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!