How to rearrange pixels into a new matrix form

6 views (last 30 days)
I have 64*64 rgb image. I want to reaarange its pixels in matrix form.I.e lowest intensity value comes to the first place (1,1) Second pixel should come to (2,1) and so on till the end of first column. Then move to the next colum. But I dont know how to do it in matlab.Can any one help me

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 17 Aug 2019
Edited: KALYAN ACHARJYA on 17 Aug 2019
"I have 64*64 rgb image. I want to reaarange its pixels in matrix form.I.e lowest intensity value comes to the first place (1,1) Second pixel should come to (2,1) and so on till the end of first column. Then move to the next colum. But I dont know how to do it in matlab.Can any one help me"
I have done for single gray image (RGB Just having three plane), or you can easily incorparates the same.
image_test=magic(5) % Just for example 5x5 gray image
data1=sort(image_test(:));
final_image=reshape(data1,[5 5])
Command Window:
image_test=
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
final_image =
1 6 11 16 21
2 7 12 17 22
3 8 13 18 23
4 9 14 19 24
5 10 15 20 25
*If you have look for RGB images, just extract the all three plane and do the same and later concanate results again to 3 plane image.
Hope it Helps!

More Answers (0)

Categories

Find more on Image Processing Toolbox 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!