フィルターのクリア

How can I make each pair of pixels from the matrix in a row major order?

3 ビュー (過去 30 日間)
SUBROTO KUNDU
SUBROTO KUNDU 2019 年 11 月 24 日
コメント済み: SUBROTO KUNDU 2019 年 11 月 24 日
Imag A=[ 43 36 31 35 35 29 29 25
33 33 32 29 25 25 22 22
33 33 31 32 31 27 25 29
28 33 35 27 25 29 32 51
23 26 30 38 31 43 47 57
27 29 30 37 40 52 63 61
23 24 32 42 52 62 72 66
24 30 44 54 65 71 70 74 ]
How can I make each pair of pixels from the matrix in a row major order? Such as (43,36)-first pair, (31,35)-second pair, (35,29)-third pair etc....

採用された回答

Darshan Sen
Darshan Sen 2019 年 11 月 24 日
Hello Subroto. I have used a couple of steps to convert A into a vector of paired up pixels and stored it in A_paired.
>> A=[43 36 31 35 35 29 29 25
33 33 32 29 25 25 22 22
33 33 31 32 31 27 25 29
28 33 35 27 25 29 32 51
23 26 30 38 31 43 47 57
27 29 30 37 40 52 63 61
23 24 32 42 52 62 72 66
24 30 44 54 65 71 70 74 ];
>> A_transpose = A';
>> A_vector = A_transpose(:);
>> A_paired = reshape(A_vector, 2, length(A_vector) / 2)'
A_paired =
43 36
31 35
35 29
29 25
33 33
32 29
25 25
22 22
33 33
31 32
31 27
25 29
28 33
35 27
25 29
32 51
23 26
30 38
31 43
47 57
27 29
30 37
40 52
63 61
23 24
32 42
52 62
72 66
24 30
44 54
65 71
70 74
I hope this was helpful. :)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by