Created
November 4, 2011 18:30
-
-
Save larrykite/1340099 to your computer and use it in GitHub Desktop.
Convert 32F to 8U for display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat img = imread("image.jpg"); | |
Mat grey; | |
cvtColor(img, grey, CV_BGR2GREY); | |
Mat sobelx; | |
Sobel(grey, sobelx, CV_32F, 1, 0); | |
double minVal, maxVal; | |
minMaxLoc(sobelx, &minVal, &maxVal); //find minimum and maximum intensities | |
Mat draw; | |
sobelx.convertTo(draw, CV_8U, 255.0/(maxVal - minVal), -minVal); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment