cv 정렬관련하여.. 이렇게 질문좀...

huss5210의 이미지

안녕하세요
정렬 부분 때문에 이렇게 올리게 되었습니다. 이상한 현상이 있어서...
원하는 이미지를 부분 짜르고 X좌표에 젤 근처에 있는 애들 부터 뽑으려고 하는데요..

opencv findContours를 통해서 포인트 처리 부분 가져왓습니다.

vector< vector< Point> > contours 값들을 잘라서 저장하게 되면 ABCD가 아니라 DCAB이런식으로 되어 있어서 이거를 조정하려고..

vector< vector< Point> > contour_p;
for (int i = 0; i < contours.size(); i++){
for (int j = i + 1; j < contours.size(); j++){
Rect mr= boundingRect(Mat(contours[i]));
Rect mrg= boundingRect(Mat(contours[j]));
if (mr.x < mrg.x) contour_p.push_back(contours[j]);
}
}

미정렬 데이터
for(int i=0; i {
Rect mr= boundingRect(Mat(contours[i]));
Mat auxRoi(img_threshold, mr);

sprintf(buffer,"./tempimage/tsxtemp%d.jpg",i);
imwrite( buffer, auxRoi );

x=>42y=>5
x=>117y=>3
x=>101y=>3
x=>86y=>3
x=>70y=>3
x=>12y=>3
x=>27y=>2
}
재 정렬 부분
for(int i=0; i {
Rect mr= boundingRect(Mat(contour_p[i]));
Mat auxRoi(img_threshold, mr);

sprintf(buffer,"./tempimage/temp%d.jpg",i);
imwrite( buffer, auxRoi );

x=>117y=>3
x=>101y=>3
x=>86y=>3
x=>70y=>3
x=>27y=>2


}

이렇게 작성을 해봤는데.. 문제는 그 값들중에 FEDCBA 가 나올거라 생각했지만.. FED B 이렇게 누락이 되어서 나옵니다.;;
어디가 잘못되었을까 하고 해매고 잇는중입니다.
두개가 빠져있습니다.

x=>12y=>3,x=>42y=>5

혹시 아시는분 ... 답변좀 부탁드립니다.


huss5210의 이미지

이거 다 지워지고 써졌네요 헐.. 다시 써야 하나... 아우..

미정렬

여기에 뭔가 문제가 되나 코드를 넣을수가 없네요 위에 처럼 나와서 ..
x=>42y=>5height=>23width=>16
x=>117y=>3height=>26width=>15
x=>101y=>3height=>26width=>15
x=>86y=>3height=>26width=>14
x=>70y=>3height=>26width=>14
x=>12y=>3height=>26width=>14
x=>27y=>2height=>27width=>14

정렬

x=>117y=>3height=>26width=>15
x=>101y=>3height=>26width=>15
x=>86y=>3height=>26width=>14
x=>70y=>3height=>26width=>14
x=>27y=>2height=>27width=>14

데이터가 누락 된다는 애기 입니다. x=>12y=>3,x=>42y=>5 이 데이터들이 빠져서 나오는데..
그게 뭐가 잘못되는지...

snowall의 이미지

글쓰기 창 밑에 있는 "입력형식"을 누르고 주의깊게 살펴보세요. 코드를 잘 쓸 수 있게 됩니다.

피할 수 있을때 즐겨라! http://melotopia.net/b

huss5210의 이미지

미정렬 for(int i=0; i<contours.size(); i++) { Rect mr= boundingRect(Mat(contours[i])); Mat auxRoi(img_threshold, mr);

sprintf(buffer,”./tempimage/tsxtemp%d.jpg”,i); imwrite( buffer, auxRoi ); }

x=>42y=>5height=>23width=>16 x=>117y=>3height=>26width=>15 x=>101y=>3height=>26width=>15 x=>86y=>3height=>26width=>14 x=>70y=>3height=>26width=>14 x=>12y=>3height=>26width=>14 x=>27y=>2height=>27width=>14

정렬

for(int i=0; i<contour_p.size(); i++) { Rect mr= boundingRect(Mat(contour_p[i])); Mat auxRoi(img_threshold, mr);

sprintf(buffer,”./tempimage/temp%d.jpg”,i); imwrite( buffer, auxRoi );

}

x=>117y=>3height=>26width=>15 x=>101y=>3height=>26width=>15 x=>86y=>3height=>26width=>14 x=>70y=>3height=>26width=>14 x=>27y=>2height=>27width=>14

이렇게 출력햇을때 두가지 누락되어 집니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.