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);

답변 (1개)

Image Analyst
Image Analyst 2015년 12월 30일

0 개 추천

The function to reverse sub2ind() is called ind2sub(). Give it a try yourself first.

댓글 수: 1

Image Analyst
Image Analyst 2015년 12월 30일
By the way, attached is an example where I scramble an image matrix, in case you might be interested.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

태그

질문:

2015년 12월 30일

댓글:

2015년 12월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by