特征面不能正确显示,并且非常暗 [英] eigenfaces are not showing correctly and are very dark

查看:199
本文介绍了特征面不能正确显示,并且非常暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用PCA为图像特征向量矩阵显示前10个特征面。

I need to show 1st 10 eigenfaces using PCA for a image feature vector matrix.

我使用以下matlab代码创建第一个特征面,而不是这样正确的特征面。
eFea是一个240x4096的矩阵,其中每一行表示64x64的图像

I am using following matlab code to create 1st eigenface but I am getting very dark and not so correct eigenfaces. eFea is a matrix of 240x4096 where each row represents an image of 64x64

 newData = eFea';
data  = newData;
[M,N] = size(data); 

mn = mean(data,2); 
data = double(data) - repmat(mn,1,N); 
% construct the matrix Y 
Y = data' / sqrt(N-1); 
% SVD 
[u,S,PC] = svd(Y,0); 


imshow(reshape(PC(1,:),64,64))


推荐答案

IMSHOW 不会自动缩放图片。因此,如果你在特征面中只有0到0.3的值,一切都会变暗。尝试 imshow(reshape(PC(1,:),64,64),[])

IMSHOW does not automatically scale the image. Thus, if you only have values from, say, 0 to 0.3 in the eigenface, everything will be really dark. Try imshow(reshape(PC(1,:),64,64),[]) instead.

这篇关于特征面不能正确显示,并且非常暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆