颜色特征提取(三)------颜色聚合向量
2015-05-08 21:21
344 查看
Pass[9]提出了图像的颜色聚合向量(color coherence vector)。它是颜色直方图的一种演变,其核心思想是将属于直方图每一个bin的像素进行分为两部分:如果该bin内的某些像素所占据的连续区域的面积大于给定的阈值,则该区域内的像素作为聚合像素,否则作为非聚合像素。假设αi与βi分别代表直方图的第i个bin中聚合像素和非聚合像素的数量,图像的颜色聚合向量可以表达为<(α1, β1), (α2, β2), …, (αN, βN)>。而<α1+ β1, α2 + β2, …,
αN +βN > 就是该图像的颜色直方图。由于包含了颜色分布的空间信息,颜色聚合向量相比颜色直方图可以达到更好的检索效果。
MATLAB实现:
αN +βN > 就是该图像的颜色直方图。由于包含了颜色分布的空间信息,颜色聚合向量相比颜色直方图可以达到更好的检索效果。
MATLAB实现:
% CCV : This is the normal Color Coherence Vector % % ICCV : This is an Improved Color Coherence Vector by adding max coherent pixels’ spatial information without affecting the performance % % Parallel implementation based on these papers : % % 1) Comparing Images Using Color Coherence Vectors (1996) - http://goo.gl/LkWkbi - % % 2) An Improved Color Coherence Vector - http://goo.gl/FjXHje - % getCCV and getICCV function take an image and return the Color Coherence Vector that describe this Image function CCV = getCCV(img,coherentPrec, numberOfColors) if ~exist('coherentPrec','var') coherentPrec = 1; end if ~exist('numberOfColors','var') numberOfColors = 27; end CCV = zeros(2,numberOfColors); Gaus = fspecial('gaussian',[5 5],2); img = imfilter(img,Gaus,'same'); [img, updNumOfPix]= discretizeColors(img,numberOfColors); imgSize = (size(img,1)*size(img,2)); thresh = int32((coherentPrec/100) *imgSize); parfor i=0:updNumOfPix-1 BW = img==i; CC = bwconncomp(BW); compsSize = cellfun(@numel,CC.PixelIdxList); incoherent = sum(compsSize(compsSize>=thresh)); CCV(:,i+1) = [incoherent; ... sum(compsSize) - incoherent]; end end function ICCV = getICCV(img,coherentPrec, numberOfColors) if ~exist('coherentPrec','var') coherentPrec = 1; end if ~exist('numberOfColors','var') numberOfColors = 27; end ICCV = zeros(4,numberOfColors); Gaus = fspecial('gaussian',[5 5],2); img = imfilter(img,Gaus,'same'); [img, updNumOfPix]= discretizeColors(img,numberOfColors); imgSize = (size(img,1)*size(img,2)); thresh = int32((coherentPrec/100) *imgSize); for i=0:updNumOfPix-1 BW = img==i; CC = bwconncomp(BW); compsSize = cellfun(@numel,CC.PixelIdxList); [~,idx] = max(compsSize); if isempty(idx)==0 [subI, subJ] = ind2sub(size(img),CC.PixelIdxList{idx}); meanPos = uint32(mean([subI subJ],1)); else meanPos = [0 0]; end incoherent = sum(compsSize(compsSize>=thresh)); ICCV(:,i+1) = [incoherent; ... sum(compsSize) - incoherent;meanPos']; end end function [oneChannel, updatedNumC] = discretizeColors(img,numColors) width = size(img,2); height = size(img,1); oneChannel = zeros(height,width); % We have 3 channels. For each channel we have V unique values. % So we want to find the value of V given that V x V x V ~= numColors numOfBins = floor(pow2(log2(numColors)/3)); numOfBinsSQ = numOfBins*numOfBins; img = floor((img/(256/numOfBins))); for i=1:height for j=1:width oneChannel(i,j) = img(i,j,1)*numOfBinsSQ ... + img(i,j,2)*numOfBins + img(i,j,3); end end updatedNumC = power(numOfBins,3); end分别对一张图片得到CCV和ICCV特征,然后进行后续的处理
相关文章推荐
- LIRe 源代码分析 5:提取特征向量[以颜色布局为例]
- LIRE源代码分析 2:建立索引 提取特征向量 检索 [以颜色布局为例]
- LIRe 源代码分析 5:提取特征向量[以颜色布局为例]
- LIRe 源代码分析 5:提取特征向量[以颜色布局为例]
- LIRe 源代码分析 5:提取特征向量[以颜色布局为例]
- 颜色特征提取
- 颜色特征提取(一)------颜色直方图
- 颜色聚合向量(CCV)
- 颜色特征及其提取
- opencv中SiftDescriptorExtractor所做的SIFT特征向量提取工作简单分析
- opencv中SiftDescriptorExtractor所做的SIFT特征向量提取工作简单分析
- 简易三维重建(二) SIFT提取特征向量
- 图像特征提取(颜色,纹理,形状)
- 颜色特征的提取
- 【OpenCV】批量集合特征提取,本地保存成向量
- 颜色特征提取(二)------颜色矩
- 从HTML源代码和页面正文中提取特征向量
- 基于颜色特征提取
- 颜色聚合向量
- 自然语言处理︱简述四大类文本分析中的“词向量”(文本词特征提取)