[OpenCV] IplImage Image pixel access method


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // copy src image content to dst image
  2.  
  3. for (int j = 0; j < src->height; j++) {
  4.  
  5. uchar* pSrc = (uchar*) (src->imageData + j * src->widthStep);
  6. uchar* pDst = (uchar*) (dst->imageData + j * dst->widthStep);
  7.  
  8. for (int k = 0; k < src->width; k++) {
  9. for (int i = 0; i < 3; ++i) {
  10. pDst [3 * k + i] = pSrc [3 * k + i];
  11.  
  12. }
  13. }
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.