Home Detect some Region in ISO12233 resolution chart
Reply: 0

Detect some Region in ISO12233 resolution chart

Hunter
1#
Hunter Published in 2018-01-11 06:58:06Z

Hi I want to detect the area circled by red line in ISO12233 resolution chart

Can someone could help me? or give me some idea how to detect it

resolution chart

Thanks

update: I have implement Silencer'answer,

Mat img = imread("testchart.bmp");
int nr = img.rows;
int nc = img.cols;

for(int j = 0;j < nr; j++)
{
  for(int i = 0; i < nc;i++)
   {
      if(img.at<Vec3b>(i,j)[0] > 35 && img.at<Vec3b>(i,j)[1] > 35 && 
         img.at<Vec3b>(i,j)[2] > 35)
      {
           img.at<Vec3b>(i,j)[0] = 255;
           img.at<Vec3b>(i,j)[1] = 255;
           img.at<Vec3b>(i,j)[2] = 255;
      }
  }
}

So I can change black to white,and then I don't konw how to detect the gray area

Can anyone help me?

update: use the this code can get the right result

Mat src_copy = src.clone();
Mat threshold_output;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

/// Detect edges using Threshold
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );

/// Find contours
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, 
CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );

/// Find the convex hull object for each contour
vector<vector<Point> >hull( contours.size() );
for( int i = 0; i < contours.size(); i++ )
  {  convexHull( Mat(contours[i]), hull[i], false ); }

/// Draw contours + hull results
Mat drawing = Mat::zeros( threshold_output.size(), CV_8UC3 );
for( int i = 0; i< contours.size(); i++ )
  {
    Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), 
    rng.uniform(0,255) );
    drawContours( drawing, contours, i, color, 1, 8, vector<Vec4i>(), 0, 
    Point() );
    drawContours( drawing, hull, i, color, 1, 8, vector<Vec4i>(), 0, Point() 
    );
  }

/// Show in a window
namedWindow( "Hull demo", CV_WINDOW_AUTOSIZE );
imshow( "Hull demo", drawing );
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.299103 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO