图像凸包是表达图像一维属性(比如长宽、面积等)信息的一种方式。
所以,计算图像凸包对一些图像前期、后期处理都有一定的帮助
看到别人的一篇代码如下
clc; clear all; close all;
I = imread('c://ce.jpg');
I = rgb2gray(I);
bw = im2bw(I, graythresh(I));
figure; imshow(I);
stats = regionprops(bwlabel(bw),'ConvexHull');
tn = stats.ConvexHull;
hold on;
h = patch(tn(:, 1), tn(:, 2), 'r');
set(h, 'FaceColor', 'none', 'EdgeColor','r', 'Marker', '.');
figure; imshow(I);
stats = regionprops(bwlabel(bw),'BoundingBox');
tn = stats.BoundingBox;
hold on;
h = rectangle('Position', tn, 'EdgeColor','r');