How can I crop a picture automatically to get exactly only the Rubik's cube, despite its location or proximity in the image? I am using MATLAB. My aim is to click the picture
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
0 Kommentare
Antworten (1)
Image Analyst
am 17 Okt. 2022
What I'd do is to convert to hsv color space, threshold on the S channel, fill regions, then take the convex hull of the region(s) then take the largest single blob. Something like
hsvImage = rgb2hsv(rgbImage);
sImage = hsvImage(:, :, 2);
mask = sImage > 0.25;
mask = imfill(mask, 'holes');
mask = bwconvhull(mask, 'objects');
mask = bwareafilt(mask, 1);
2 Kommentare
Image Analyst
am 17 Okt. 2022
Did you actually try it? See attached full demo. It produces this:
Siehe auch
Kategorien
Mehr zu Rubik's Cube finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!