Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

line scanning for the bar code

Hello dears, These days, I am working on reading bar code as a projects for school, since I do not have enough experience and familiarity with Opencv , I have been hanged on this projects ,but of course I did some thing to do. Briefly, I would like to create one scan line class in opencv with c++image description ///////////////////////////////code ////////////////////////////// Mat cropped; cvtColor(cropped_rgb,cropped,CV_RGB2GRAY); // cout <<"cols " <<cropped.cols&lt;&lt; "\n"="" &lt;&lt;="" "rows"="" &lt;&lt;="" cropped.rows="" 2="" &lt;&lt;="" "\n"="" &lt;&lt;="" cropped.size()&lt;&lt;="" endl;="" lineiterator="" it(cropped,point(0,cropped.rows="" 2),point(cropped.cols,cropped.rows="" 2),8,false);="" <br=""> vector<point> points(it.count); vector<vec3b> buf;

for(int i=0; i<it.count; i++)="" {="" buf.push_back(="" vec3b(*it)="" );="" it++;="" }="" cerr="" &lt;&lt;="" mat(buf)="" &lt;&lt;="" endl;="" line(cropped,point(0,cropped.rows="" 2),point(cropped.cols,cropped.rows="" 2),scalar(255),1);="" imshow(="" "cropped",="" cropped="" );<="" p="">

the result: image description

as you can see my problem is here,there is <vec3b> which is not desirable for me,just the values has been put inside the box are very important to me. So,is it possible guide me and tell me,how i should catch these values ????really appreciate it.

click to hide/show revision 2
No.2 Revision

updated 2016-04-16 07:47:04 -0600

berak gravatar image

line scanning for the bar code

Hello dears, These days, I am working on reading bar code as a projects for school, since I do not have enough experience and familiarity with Opencv , I have been hanged on this projects ,but of course I did some thing to do. Briefly, I would like to create one scan line class in opencv with c++image description ///////////////////////////////code ////////////////////////////// //////////////////////////////

   Mat cropped;
   cvtColor(cropped_rgb,cropped,CV_RGB2GRAY);
  // cout <<"cols " <<cropped.cols&lt;&lt; "\n"="" &lt;&lt;="" "rows"="" &lt;&lt;="" cropped.rows="" 2="" &lt;&lt;="" "\n"="" &lt;&lt;="" cropped.size()&lt;&lt;="" endl;="" lineiterator="" it(cropped,point(0,cropped.rows="" 2),point(cropped.cols,cropped.rows="" 2),8,false);="" <br="">
  vector<point> <<cropped.cols<< "\n" << "rows" << cropped.rows/2 << "\n"  << cropped.size()<< endl;
  LineIterator it(cropped,Point(0,cropped.rows/2),Point(cropped.cols,cropped.rows/2),8,false);  
  vector<Point> points(it.count);
  vector<vec3b> vector<Vec3b> buf;   

for(int i=0; i<it.count; i++)="" {="" buf.push_back(="" vec3b(*it)="" );="" it++;="" }="" cerr="" &lt;&lt;="" mat(buf)="" &lt;&lt;="" endl;="" line(cropped,point(0,cropped.rows="" 2),point(cropped.cols,cropped.rows="" 2),scalar(255),1);="" imshow(="" "cropped",="" cropped="" );<="" p="">

i++) { buf.push_back( Vec3b(*it) ); it++; } cerr << Mat(buf) << endl; line(cropped,Point(0,cropped.rows/2),Point(cropped.cols,cropped.rows/2),Scalar(255),1); imshow( "cropped", cropped );

the result: image description

as you can see my problem is here,there is <vec3b> <Vec3b> which is not desirable for me,just the values has been put inside the box are very important to me. So,is it possible guide me and tell me,how i should catch these values ????really appreciate it.