Is there a way to reduce the processing time of a pixelseparator code?

I am trying to convert an image into a set of arrays that can be useful for digital processing and analytics for commercial purposes. A code has already been created and it works, but is there any way to reduce the time taken for the code to be executed?

This is a final stage for the commercialisation of a new form of technology that will need to take into account real time analysis of images taken by the technology.

function pixelseperator()

clear all

close all
Image=imread(‘flirpolarcamtest3.png’);

Image=uint16(Image);
[m,n]=size(Image);
Imagex=zeros(m/2,n/2);
Imagexrows=zeros((m/2),1);
col=1;
for ni=1:2:n-1
row=1;
for mi=1:2:m-1
Imagexrows(row)=Image(mi,ni);
row=row+1;
end
col=col+1;
Imagex(:,col)=Imagexrows;
end
Image0=Imagex;

The average time taken for the code to be actuated was apprximately 0.74 seconds, which was expected but a bit too long for the desired time and contained a bit too many intermediates making the code a bit redundant. I am looking for a way to cut down on redundancues and hence reduce the time taken for processing.

#matlab

4 Likes1.45 GEEK