grouping the pixel pairs and vice versa
Mostra commenti meno recenti
Hello everybody. I found the following codes for grouping the pixels and that works very nice. Can anybody help me to back to the original pixels format. That means i want the pixels values grouping and vice versa.
%grouping the pixel pairs
img=imread('C:\Users\Desktop\image\t1.png');
[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);
3 Commenti
Walter Roberson
il 30 Nov 2016
Why are you not just using
pixels1 = img(:, 1:2:end);
pixels2 = img(:, 2:2:end);
?
Mahmudul Hasan
il 2 Dic 2016
Modificato: Mahmudul Hasan
il 2 Dic 2016
Walter Roberson
il 2 Dic 2016
The results pixels1 and pixels2 are arrays that represent images. You can resize images in multiple ways including imresize() . You can concatenate arrays with cat() or horzcat() or vertcat() or []
Risposte (0)
Categorie
Scopri di più su Images in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!