cv 정렬관련하여.. 이렇게 질문좀...
안녕하세요
정렬 부분 때문에 이렇게 올리게 되었습니다. 이상한 현상이 있어서...
원하는 이미지를 부분 짜르고 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
혹시 아시는분 ... 답변좀 부탁드립니다.
헐.. 정리해서 썼는데..
이거 다 지워지고 써졌네요 헐.. 다시 써야 하나... 아우..
미정렬
여기에 뭔가 문제가 되나 코드를 넣을수가 없네요 위에 처럼 나와서 ..
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 이 데이터들이 빠져서 나오는데..
그게 뭐가 잘못되는지...
글쓰기 창 밑에 있는 "입력형식"을 누르고 주의깊게
글쓰기 창 밑에 있는 "입력형식"을 누르고 주의깊게 살펴보세요. 코드를 잘 쓸 수 있게 됩니다.
피할 수 있을때 즐겨라! http://melotopia.net/b
아...
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이렇게 출력햇을때 두가지 누락되어 집니다.
댓글 달기