ankesh007 / Body-Measurement-using-Computer-Vision

Given 2D image, determine real-world body measurements
130 stars 54 forks source link

cv2.error: NULL window handler in function 'cvSetMouseCallback' #6

Open sangramrajekakade opened 4 years ago

sangramrajekakade commented 4 years ago
python code2.py -i1 aman1.jpg -i2 aman2.jpg -i3 aman3.jpg -a True
helllooooo
<module 'cv2.cv2' from '/home/panacea/Documents/Yogeshsir/Body-Measurement-using-Computer-Vision/src/venv/lib/python3.5/site-packages/cv2/cv2.cpython-35m-x86_64-linux-gnu.so'>
Traceback (most recent call last):
  File "code2.py", line 401, in <module>
    main()
  File "code2.py", line 376, in main
    metre_pixel_x,metre_pixel_y,coordinate,affine_correct_parameters=analyze_chessboard(image,affine_correct_flag)
  File "code2.py", line 230, in analyze_chessboard
    cv2.setMouseCallback(window_name1, click_and_crop)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window_QT.cpp:714: error: (-27:Null pointer) NULL window handler in function 'cvSetMouseCallback'
jayashreepalliyamakkal commented 4 years ago

Traceback (most recent call last): File "experiment.py", line 378, in main() File "experiment.py", line 341, in main metre_pixel_x,metre_pixel_y,coordinate,affine_correct_parameters=analyze_chessboard(image,affine_correct_flag) File "experiment.py", line 222, in analyze_chessboard clone = image.copy() AttributeError: 'NoneType' object has no attribute 'copy'

please help

StPov commented 4 years ago
python code2.py -i1 aman1.jpg -i2 aman2.jpg -i3 aman3.jpg -a True
helllooooo
<module 'cv2.cv2' from '/home/panacea/Documents/Yogeshsir/Body-Measurement-using-Computer-Vision/src/venv/lib/python3.5/site-packages/cv2/cv2.cpython-35m-x86_64-linux-gnu.so'>
Traceback (most recent call last):
  File "code2.py", line 401, in <module>
    main()
  File "code2.py", line 376, in main
    metre_pixel_x,metre_pixel_y,coordinate,affine_correct_parameters=analyze_chessboard(image,affine_correct_flag)
  File "code2.py", line 230, in analyze_chessboard
    cv2.setMouseCallback(window_name1, click_and_crop)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window_QT.cpp:714: error: (-27:Null pointer) NULL window handler in function 'cvSetMouseCallback'

@sangramrajekakade, simply add cv2.namedWindow(window_name1) before cv2.setMouseCallback(window_name1, click_and_crop)

StPov commented 4 years ago

Traceback (most recent call last): File "experiment.py", line 378, in main() File "experiment.py", line 341, in main metre_pixel_x,metre_pixel_y,coordinate,affine_correct_parameters=analyze_chessboard(image,affine_correct_flag) File "experiment.py", line 222, in analyze_chessboard clone = image.copy() AttributeError: 'NoneType' object has no attribute 'copy'

please help

@jayashreepalliyamakkal, replace clone = image.copy() with clone = np.copy(image)

adarshrana205 commented 4 years ago
python code2.py -i1 aman1.jpg -i2 aman2.jpg -i3 aman3.jpg -a True
helllooooo
<module 'cv2.cv2' from '/home/panacea/Documents/Yogeshsir/Body-Measurement-using-Computer-Vision/src/venv/lib/python3.5/site-packages/cv2/cv2.cpython-35m-x86_64-linux-gnu.so'>
Traceback (most recent call last):
  File "code2.py", line 401, in <module>
    main()
  File "code2.py", line 376, in main
    metre_pixel_x,metre_pixel_y,coordinate,affine_correct_parameters=analyze_chessboard(image,affine_correct_flag)
  File "code2.py", line 230, in analyze_chessboard
    cv2.setMouseCallback(window_name1, click_and_crop)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window_QT.cpp:714: error: (-27:Null pointer) NULL window handler in function 'cvSetMouseCallback'

@sangramrajekakade, simply add cv2.namedWindow(window_name1) before cv2.setMouseCallback(window_name1, click_and_crop)

python code2.py -i1 aman1.jpg -i2 aman2.jpg -i3 aman3.jpg -a True
helllooooo
<module 'cv2.cv2' from '/home/panacea/Documents/Yogeshsir/Body-Measurement-using-Computer-Vision/src/venv/lib/python3.5/site-packages/cv2/cv2.cpython-35m-x86_64-linux-gnu.so'>
Traceback (most recent call last):
  File "code2.py", line 401, in <module>
    main()
  File "code2.py", line 376, in main
    metre_pixel_x,metre_pixel_y,coordinate,affine_correct_parameters=analyze_chessboard(image,affine_correct_flag)
  File "code2.py", line 230, in analyze_chessboard
    cv2.setMouseCallback(window_name1, click_and_crop)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window_QT.cpp:714: error: (-27:Null pointer) NULL window handler in function 'cvSetMouseCallback'

@sangramrajekakade, simply add cv2.namedWindow(window_name1) before cv2.setMouseCallback(window_name1, click_and_crop)

It is not working...

sara-waled123 commented 1 year ago

cv2.error: opencv(4.6.0) d:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1261: error: (-27:null pointer) null window: 'geeksforgeeks' in function 'cvdestroywindow'

solved by cv2.namedWindow("GeeksForGeeks") cv2.destroyWindow("GeeksForGeeks")