Detecting an object in binary image and cropping it
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Farshad Bolouri
am 24 Sep. 2020
Kommentiert: Walter Roberson
am 25 Sep. 2020
Hello, I am currently working on a project and I am stuck on one part. I am trying to detect the a playing a card in an image and then rotate it and then crop it out. The figure below depcits what I'm trying to achieve:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365980/image.jpeg)
I've already achieved this goal using functions like edge() and regionprops(). But I am trying to do it without using those. This is what I have so far:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365983/image.jpeg)
Now im trying to align the image and then crop it without using regionprops(). Do you have any suggestion on what approach I should take?
I want to do it as simple as possible without using any big matlab functions(No machine learning techniques either)
Thank You
1 Kommentar
Walter Roberson
am 25 Sep. 2020
There are similar questions, but we only routinely delete duplicate questions from the same person (or cases where the question is obviously identical, leading us to believe the same person posted under different names.)
Akzeptierte Antwort
Walter Roberson
am 24 Sep. 2020
maskvert = any(YourBinaryImage, 1);
firstcol = find(maskvert, 1, 'first');
lastcol = find(maskvert, 1, 'last');
with obvious extension for horizontal.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Image Processing Toolbox 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!