How to get a matrix which acquires a pixel values along a spiral trajectory of Image.
1 次查看(过去 30 天)
显示 更早的评论
Hi, I'm working on compressive sensing for laser scanning applications. I want to sample the image along a continuous trajectory and get the pixel values. I'm able to get the pixel values along a continuous trajectory. In this case, a spiral trajectory. However, I don't know how to obtain the sampling matric C in y = Cx, where x is the input vector image, C is the sampling matrix which, on multiplying, gives values along the defined trajectory and y is the pixel values along that trajectory.
clear all;
clc;
%% Goal is to acuqire a pixel values along a spiral trajectory of Image (X).
% i.e y = Cx;
% where y is a m*1 measument matrix
% C is a m*N sampling matrix
% X is a N by 1 vectorized Image.
% N = n1*n2 where n1, n2 are size of the image
% Paramters for Spiral
dSpirals = 30;
nSpirals = 20;
CompresRatio = 0.4;
InputImage = imread('barbara1.png');
[height width] = size(InputImage);
N = height*width;
m = round(CompresRatio*N);
nPoints = m;
theta = linspace(0,360*nSpirals, nPoints);
% Define Spiral
x = round(((width/2)+1) +(theta/dSpirals).*cosd(theta));
y = round(((height/2)+1) +(theta/dSpirals).*sind(theta));
plot(x,y);
axis([0 width 0 height]);
grid on;
%% Measure the pixel values along the spiral trajectory
Measure = zeros(m,1);
for i = 1:m
Measure(m) = InputImage(x(i),y(i));
end
%% How to find C in y = CX where:
% y = Measure
% X = InputImageV %i.e., InputImageV = InputImage(:);
4 个评论
Matt J
2022-7-29
编辑:Matt J
2022-7-29
I don't see how you'd be able to solve for x, because C is non-square. If C were square and invertible, it would be a permutation matrix. You don't need the matrix form of C to solve an equation which is just a permutation.
In any case, if you are certain that C is what you want, you will hopefully consider Accept-clicking my answer below.
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!