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 image; | |
Mat result; | |
cv::Mat_<cv::Vec3b>::const_iterator it = image.begin<cv::Vec3b>(); | |
cv::Mat_<cv::Vec3b>::const_iterator itend = image.end<cv::Vec3b>(); | |
cv::Mat_<uchar>::iterator itout=result.begin<uchar>(); | |
for ( ; it!=itend; ++it, ++itout){ | |
if (getDistance(*it) < minDist){ | |
*itout = 255; |
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); |