@oh47 wrote:
I want to combine multiple windows.
In picture, i have two windows and i want to combine both frame1 and frame2.
///////////////////////////////////////////////////////
OF CODE:VideoCapture capture0(0);
VideoCapture capture1(1);void ofApp::update(){
if (!capture0.isOpened())
{
printf("첫번째 카메라를 열수 없습니다. \n");
}if (!capture1.isOpened()) { printf("두번째 카메라를 열수 없습니다. \n"); } Mat frame_original, frame_1, frame_2; //capture0 >> frame_original; // get a new frame from webcam capture0 >> frame_1; capture1 >> frame_2; //flip(frame_original, frame_original, 1); // image flip Mat frame_gray1, frame_gray2; cvtColor(frame_1, frame_gray1, CV_RGB2GRAY); cvtColor(frame_2, frame_gray2, CV_RGB2GRAY); threshold(frame_gray2, frame_gray2, 100, 255, THRESH_BINARY); //equalizeHist(frame_gray, frame_gray); //connectedComponents(frame_gray,frame_gray,4,CV_16U); Mat img_labels, stats, centroids; int numOfLables = connectedComponentsWithStats(frame_gray2, img_labels, stats, centroids, 8, CV_32S); //라벨링 된 이미지에 각각 직사각형으로 둘러싸기 for (int j = 1; j < numOfLables; j++) { int area = stats.at<int>(j, CC_STAT_AREA); int left = stats.at<int>(j, CC_STAT_LEFT); int top = stats.at<int>(j, CC_STAT_TOP); int width = stats.at<int>(j, CC_STAT_WIDTH); int height = stats.at<int>(j, CC_STAT_HEIGHT); //double *centroid = centroids.at<double>(j, 0); //중심좌표 int x = centroids.at<double>(j,0); int y = centroids.at<double>(j,1); circle(frame_gray2, Point(x, y), 5, Scalar(255, 0, 0), 1); putText(frame_gray2, to_string(x)+ ", " +to_string(y), Point(left + 20, top + 20), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 0), 2); //rectangle(frame_gray, Point(left, top), Point(left + width, top + height),Scalar(0, 0, 255), 1); //putText(frame_gray, to_string(j), Point(left + 20, top + 20), FONT_HERSHEY_SIMPLEX,1, Scalar(255, 0, 0), 2); } double D2R = PI / 180; double R2D = 180 / PI; double IRX2DEG = 46, IRY2DEG = 36; double Ax=320, Ay=240, Bx=320, By=240, Wx=0,Wy=0,Wz=0; double ADeg=60, BDeg=120, Am=0, Bm=0; double Lxz=0,WA_UDDeg=0; ADeg = 60 - (Ax - 320) * IRX2DEG; Am = tan(ADeg * D2R); BDeg = 60 - (Bx - 320) * IRX2DEG; Bm = tan(BDeg * D2R); Wx = ((-Bm) * 500) / (Am+1 - Bm); Wz = Am * Wx; cout << Wx << endl; Lxz = sqrt(Wx*Wx + Wz*Wz); WA_UDDeg = 0 - (Ax - 240)*IRY2DEG; Wy = -tan(WA_UDDeg*D2R)*Lxz; DrawMatchesFlags::DRAW_RICH_KEYPOINTS); imshow("frame1", frame_gray1); imshow("frame2", frame_gray2);}
Posts: 1
Participants: 1
