opencv改变imshow窗口大小,窗口位置

时间:2023-01-13 03:48:35


cv2.HoughLinesP

cv2.namedWindow("enhanced",0);
cv2.resizeWindow("enhanced", 640, 480);
cv2.imshow("enhanced",lines)
cv2.waitKey(0)


 

创建窗口时候改变下参数就可以鼠标随意拖动窗口改变大小啦

cv::namedWindow("camera", CV_WINDOW_NORMAL);//CV_WINDOW_NORMAL就是0
cv::imshow("camera", frame);


cv2.namedWindow(imgpath, 0);
cv2.resizeWindow(imgpath, int(width*(height-80)/ pheight),height-80);
cv2.imshow(imgpath, img)

这个会让图像变形,比如宽度很小高度变大

# cv2.namedWindow('image', cv2.WINDOW_NORMAL)

改变窗口位置:left top

cv2.moveWindow("trans:"+filename,1000,100)