How do I know imresize Image is working ?

1 visualización (últimos 30 días)
muhammad imaduddin
muhammad imaduddin el 27 de En. de 2021
Editada: Image Analyst el 27 de En. de 2021
I have the following matrix:
A = [...
171 175 177 173 167 164 170 176 178 177 176 170 175 172 171 180 185 186 192
165 170 173 168 163 164 175 186 188 182 178 175 180 178 178 182 181 182 191
160 164 166 164 159 160 172 184 185 179 174 175 180 180 179 178 171 172 185
160 161 161 158 152 151 158 165 166 164 162 166 170 171 171 166 155 159 179
161 160 161 156 151 147 146 145 145 148 154 157 161 162 161 153 139 147 174
157 161 164 165 162 157 149 140 137 146 159 163 164 163 159 145 128 138 170
152 161 167 176 176 172 160 145 140 153 170 176 175 170 162 144 123 133 166
136 150 162 175 179 178 167 157 158 170 181 191 182 173 159 136 120 133 159
125 142 155 166 171 171 165 158 160 171 182 184 174 164 150 128 115 128 152
117 131 142 141 142 144 145 147 153 162 170 166 156 144 132 116 110 125 146
122 126 128 115 106 100 107 119 128 130 130 129 119 108 101 96 101 119 137
138 129 121 100 78 63 74 96 106 98 88 87 79 70 69 78 95 117 132
157 143 130 94 66 51 69 101 112 98 82 68 61 55 58 78 105 128 139
174 164 150 110 84 72 95 127 134 115 95 71 64 58 64 88 121 142 149
185 179 168 139 115 104 124 148 146 120 97 75 69 62 67 94 127 148 152
177 177 167 158 153 140 124 115 109 97 84 61 55 60 78 101 126 136 128
168 166 156 167 170 158 124 88 68 66 70 51 46 51 72 95 104 104 103
171 171 164 173 177 166 131 85 54 45 47 33 35 36 49 62 59 69 100]
Then I enter the command:
img = imresize (A, [12 12])
And the following matrix is obtained:
A =
171 175 169 165 177 181 177 174 174 177 184 190
163 168 162 163 181 185 176 177 180 179 174 183
160 160 154 150 157 160 160 165 168 165 152 171
159 163 161 153 143 140 154 162 162 153 133 161
150 165 178 173 153 148 170 180 172 150 125 154
132 156 172 173 161 163 181 185 168 140 120 147
121 136 134 132 137 148 158 153 136 115 110 137
132 121 93 74 93 110 102 95 81 79 99 129
159 134 83 59 95 114 89 65 55 70 112 140
181 163 119 99 132 138 101 70 62 80 129 151
175 166 160 144 114 96 82 57 58 89 122 124
170 165 175 162 101 55 50 38 41 64 72 92
I don't know how to get this matrix value. Can anyone help solve my problem in finding math formulas in this imresize process?

Respuestas (1)

Image Analyst
Image Analyst el 27 de En. de 2021
That should not happen. If you did this, as you said:
img = imresize (A, [12 12])
then A would NOT be resized to 12 by 12. You would get a new matrix called img that would be 12 by 12. The original A should not change.
When I do this:
A = [...
171 175 177 173 167 164 170 176 178 177 176 170 175 172 171 180 185 186 192
165 170 173 168 163 164 175 186 188 182 178 175 180 178 178 182 181 182 191
160 164 166 164 159 160 172 184 185 179 174 175 180 180 179 178 171 172 185
160 161 161 158 152 151 158 165 166 164 162 166 170 171 171 166 155 159 179
161 160 161 156 151 147 146 145 145 148 154 157 161 162 161 153 139 147 174
157 161 164 165 162 157 149 140 137 146 159 163 164 163 159 145 128 138 170
152 161 167 176 176 172 160 145 140 153 170 176 175 170 162 144 123 133 166
136 150 162 175 179 178 167 157 158 170 181 191 182 173 159 136 120 133 159
125 142 155 166 171 171 165 158 160 171 182 184 174 164 150 128 115 128 152
117 131 142 141 142 144 145 147 153 162 170 166 156 144 132 116 110 125 146
122 126 128 115 106 100 107 119 128 130 130 129 119 108 101 96 101 119 137
138 129 121 100 78 63 74 96 106 98 88 87 79 70 69 78 95 117 132
157 143 130 94 66 51 69 101 112 98 82 68 61 55 58 78 105 128 139
174 164 150 110 84 72 95 127 134 115 95 71 64 58 64 88 121 142 149
185 179 168 139 115 104 124 148 146 120 97 75 69 62 67 94 127 148 152
177 177 167 158 153 140 124 115 109 97 84 61 55 60 78 101 126 136 128
168 166 156 167 170 158 124 88 68 66 70 51 46 51 72 95 104 104 103
171 171 164 173 177 166 131 85 54 45 47 33 35 36 49 62 59 69 100]
size(A) % Original size.
img = imresize (A, [12 12])
size(img) % Output size
size(A) % Size of A afterwards - should still be the same as the original size.
I get
ans =
18 19
ans =
12 12
ans =
18 19
as expected. The size of A did NOT change -- it stayed 18 by 19.

Community Treasure Hunt

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

Start Hunting!

Translated by