grouping the pixel pairs
Ältere Kommentare anzeigen
I have the code for grouping the pair of pixel. The code executed correctly. Please help me to reverse the same to get the original pixel matrix of the image
%grouping the pixel pairs
img=imread('cameraman.tif');
[rows,cols]=size(img);
[x,y]=ndgrid(1:rows,1:2:cols);
ind=sub2ind(size(img),x,y);
ind_shift=sub2ind(size(img),x,y+1);
pixels1=img(ind);
pixels2=img(ind_shift);
pixels=[pixels1(:) pixels2(:)];
[row1,cols1]=size(pixels);
Antworten (1)
Image Analyst
am 30 Dez. 2015
0 Stimmen
The function to reverse sub2ind() is called ind2sub(). Give it a try yourself first.
1 Kommentar
Image Analyst
am 30 Dez. 2015
By the way, attached is an example where I scramble an image matrix, in case you might be interested.
Kategorien
Mehr zu Images finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!