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 回表示 (過去 30 日間)

回答 (1 件)

Image Analyst
Image Analyst 2022 年 10 月 17 日
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 件のコメント
Sang
Sang 2022 年 10 月 17 日
Still not quite what I mean. My idea is how can I cut the Rubik's Cube as shown below
Image Analyst
Image Analyst 2022 年 10 月 17 日
Did you actually try it? See attached full demo. It produces this:

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRubik's Cube についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by