Skip to content

Instantly share code, notes, and snippets.

@nibasya
Created October 28, 2016 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nibasya/bf94f58807437b2d0ad1dd8947d5b50a to your computer and use it in GitHub Desktop.
Save nibasya/bf94f58807437b2d0ad1dd8947d5b50a to your computer and use it in GitHub Desktop.
CRect targetRect;
CImage img;
cv::Mat tmp;
pWnd->GetClientRect(&targetRect);
img.Create(targetRect.Width(), targetRect.Height(), 24);
/* snip some codes */
// 画像イメージ変換
tmp.create(targetRect.Height(), targetRect.Width(), CV_8UC3);
if(img.GetPitch()>0){
memcpy(tmp.data, img.GetBits(), img.GetPitch()*img.GetHeight());
} else {
memcpy(tmp.data, (BYTE *)img.GetBits()+img.GetPitch()*(img.GetHeight()-1), -img.GetPitch()*img.GetHeight());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment