小编Dev*_*Dev的帖子

使用PCA选择功能

我正在做无监督分类。为此,我有8个特征(绿色方差,绿色标准分区,红色平均值,红色方差,红色标准分区,色调平均值,色调变化,色调标准分区)进行分类每个图片,我想使用PCA选择3个最重要的功能。我编写了以下代码进行特征选择(特征尺寸为:179X8):

for c=1:size(feature,1)
   feature(c,:)=feature(c,:)-mean(feature)
end

DataCov=cov(feature); % covariance matrix
[PC,variance,explained] = pcacov(DataCov)
Run Code Online (Sandbox Code Playgroud)

这给了我:

PC =

0.0038   -0.0114    0.0517    0.0593    0.0039    0.3998    0.9085   -0.0922
0.0755   -0.1275    0.6339    0.6824   -0.3241   -0.0377   -0.0641    0.0052
0.7008    0.7113   -0.0040    0.0496   -0.0207    0.0042    0.0012    0.0002
0.0007   -0.0012    0.0051    0.0101    0.0272    0.0288    0.0873    0.9953
0.0320   -0.0236    0.1521    0.2947    0.9416   -0.0142   -0.0289   -0.0266
0.7065   -0.6907   -0.1282   -0.0851    0.0060    0.0003    0.0010   -0.0001
0.0026   -0.0037    0.0632   -0.0446    0.0053    0.9125   -0.4015    0.0088
0.0543   -0.0006    0.7429   -0.6574    0.0838   -0.0705    0.0311   -0.0001
Run Code Online (Sandbox Code Playgroud)

方差= …

algorithm matlab image-processing pca

5
推荐指数
1
解决办法
7972
查看次数

图像标准化

我有uint8类的RGB图像大小(2048X3072X3),我想规范化RGB图像的绿色和红色通道.我写了以下代码:

      Image_rgb=imread('RGB.jpg');   %Reading RGB image
      Image_red = Image_rgb(:,:,1);   %Reading R channel of  image
      Image_green = Image_rgb(:,:,2); %Reading G channel of  image
      x = double(Image_green(:));  
      m = mean(x);  
      s = std(x);
      x = (x - m) / s;   % normalization of green channel
Run Code Online (Sandbox Code Playgroud)

但是在归一化之后,图像x的尺寸为6291456x1而不是2048X3072.

任何人都可以告诉我如何才能获得2048X3072尺寸的标准化图像?

matlab image-processing

2
推荐指数
1
解决办法
5078
查看次数

使用内核 PCA (KPCA) 进行特征选择

我已经尝试了主成分分析 (PCA) 进行特征选择,它从九个特征的集合中给了我 4 个最佳特征(绿色的均值、绿色的方差、绿色的标准 div、红色的均值、红色的方差、标准的 div) . of Red, Mean of Hue, Variance of Hue, Std. div. of Hue,即 [ MGcorr,VarGcorr, stdGcorr,MRcorr,VarRcorr,stdRcorr,MHcorr,VarHcorr,stdHcorr ]) 用于将数据分类为两个集群。从文献来看,PCA 似乎不是很好的方法,而是更好地应用核 PCA(KPCA)进行特征选择。我想应用 KPCA 进行特征选择,并且尝试了以下操作:

d=4; % number of features to be selected, or d: reduced dimension
[Y2 eigVector para ]=kPCA(feature,d); % feature is 300X9 matrix with 300 as number of  
                                      % observation and 9 features
                                      % Y: dimensionanlity-reduced data
Run Code Online (Sandbox Code Playgroud)

以上 kPCA.m 函数可从以下网址下载:http : //www.mathworks.com/matlabcentral/fileexchange/39715-kernel-pca-and-pre-image-reconstruction/content/kPCA_v1.0/code/kPCA.m

在上面的实现中,我想知道如何从 9 个特征中找到哪 4 个特征来选择(即哪些顶级特征是最佳的)以进行聚类。

或者,我也尝试了 KPCA 实现的以下功能: …

matlab machine-learning image-processing computer-vision

2
推荐指数
1
解决办法
6808
查看次数

在MATLAB中删除结构中的字段

我的结构Vinlu大小为1X36:

        Vinlu = 

        vessel: [1x36 struct]
Run Code Online (Sandbox Code Playgroud)

每个都有5个字段:

Vinlu.vessel

        ans = 

        1x36 struct array with fields:
        pixels
        indexNOmask
        indexWHOLEvessel
        widths
        Meanwidth
Run Code Online (Sandbox Code Playgroud)

有一些容器字段,其中像素字段为空,例如:

Vinlu.vessel(1,4)

   ans = 

              pixels: [0x2 double]
         indexNOmask: [0x1 double]
    indexWHOLEvessel: [0x1 double]
              widths: [1x0 single]
           Meanwidth: NaN
Run Code Online (Sandbox Code Playgroud)

我想从像素字段为空的结构中删除所有那些容器字段(与其他字段无关).容器中的一个或多个字段可能是空的但我想删除那些具有空像素字段的字段,这样我将获得大小为1 X n的结构Vinlu,其中n <36

matlab

2
推荐指数
1
解决办法
757
查看次数