Skip to content

Commit

Permalink
opencv_example now in BGR color (opencv convention)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcoschoneveld committed Jun 10, 2016
1 parent 880657d commit 4792e97
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sw/airborne/modules/computer_vision/opencv_example.cpp
Expand Up @@ -40,18 +40,20 @@ int opencv_example(char *img, int width, int height)
Mat M(height, width, CV_8UC2, img);
Mat image;
// If you want a color image, uncomment this line
// cvtColor(M, image, CV_YUV2RGB_Y422);
cvtColor(M, image, CV_YUV2BGR_Y422);
// For a grayscale image, use this one
cvtColor(M, image, CV_YUV2GRAY_Y422);
// cvtColor(M, image, CV_YUV2GRAY_Y422);

// Blur it, because we can
blur(image, image, Size(5, 5));

// Canny edges, only works with grayscale image
int edgeThresh = 35;
Canny(image, image, edgeThresh, edgeThresh * 3);
// int edgeThresh = 35;
// Canny(image, image, edgeThresh, edgeThresh * 3);

// Convert back to YUV422, and put it in place of the original image
grayscale_opencv_to_yuv422(image, img, width, height);
// grayscale_opencv_to_yuv422(image, img, width, height);
color_opencv_to_yuv422(image, img, width, height);

return 0;
}

0 comments on commit 4792e97

Please sign in to comment.