Imread---The difference between MATLAB and OPENCVF return values

Source: Internet
Author: User

matlab

img = Imread ('.//img01.jpg ');
Disp (IMG);

Results

disp (IMG (:,:, 1)) Columns 1 through 30 189 59 1 0 52 51 40 32 0 4 115   202 215 205 206 207 222 211 197 0 31 165 162 163 165 165 166 166 161 169 192 95 1 0 53 
  49 43 41 0 3 99 203 221 205 207 208 221 214 199 4 37 156 164 164 164 166 166 165 165 167  197 123 1 1 55 52 48 44 0 0 79 202 225 209 207 208 220 211 200 26 29 156 163 164  165 164 165 167 165 168 196 141 0 1 59 55 51 44 0 0 66 203 226 214 208 208 220 215 206 49 8 159 164 164 166 166 167 167 168 170 198 156 0 0 60 58 52 45 0 0 35 198 2 29 215 209 209 218 213 207 75 0 149 165 163 165 171 167 167 167 167 196 159 0 0 59 60 5 3 45 1 0 3 196 227 217 209 210 218 211 221 94 1 140 165 166 167 175 170 169 171 171 .... ..
disp (IMG (:,:, 2)) Columns 1 through 30 192 63 4 4 55 53 45 35 2 6 114   202 216 206 208 209 222 212 198 2 36 169 167 168 170 170 170 170 167 175 195 99 4 3 55 
  51 48 44 2 5 100 205 222 206 209 210 221 215 200 6 39 160 168 169 169 171 170 169 171 173  202 127 4 3 57 54 50 47 2 0 80 204 226 212 209 210 223 214 201 28 31 158 167 168  169 168 171 173 169 172 204 148 5 3 61 57 53 47 2 1 69 205 230 217 210 210 223 218 207 50 10 161 168 168 170 170 171 171 172 174 205 162 5 5 62 58 54 48 2 0 37 201 2 30 216 211 211 220 216 208 76 2 153 169 167 169 175 171 171 171 173 203 166 5 5 61 60 5 4 47 1 1 3 197 228 218 211 212 220 214 222 95 3 144 169 170 171 179 171 173 175 177 .... ..
Disp (IMG (:,:, 3))

  Columns 1 through
  175    0    0   47  171  254  247  224  223  221  1 216  168  171  172  174  173  173  171  167  175
  178    0    0  156  255  252  224  224  222  229  219  202    5  159  171 173 172 174  173  169  173
  182    0    0 (  253) 134  255  229  224  222  232  219  205  171 157 168  169  171  171  168  173
  183    0    0   50  124  255  255  234  225  223  232  225  211    9  169  169  171  171  171  175
  ...

OpenCV

Mat img = Imread ('.//img01.jpg ');
for (int. k=0; k<12; k++) for
    (int l=0; l<12; l++)
        std::cout << img.at<vec3b> (k, L);

Results

Print the last channel separately

for (int. k=0; k<12; k++) for
        (int l=0; l<12; l++)
            std::cout << (int) img.at<vec3b> (k, L) [2] <& Lt " ";

Results

Summary

The two channels are exactly the opposite.
MATLAB is the first to print a channel and then print a channel, OPENCV is 3 channels simultaneously printing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.