How to get a matrix which acquires a pixel values along a spiral trajectory of Image.
1 view (last 30 days)
Show older comments
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1081810/image.png)
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 Comments
Matt J
on 29 Jul 2022
Edited: Matt J
on 29 Jul 2022
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.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!