Installed OpenCV on Raspberry Pi 3, created (in fact, took from the tutorial ) a file for getting frames by the algorithm: [Get frame from camera] -> [Display frame in window]
The code itself:
import cv2 import video if __name__ == '__main__': # ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΠΊΠ½ΠΎ Ρ ΠΈΠΌΠ΅Π½Π΅ΠΌ result cv2.namedWindow( "result" ) # ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΠ±ΡΠ΅ΠΊΡ cap Π΄Π»Ρ Π·Π°Ρ
Π²Π°ΡΠ° ΠΊΠ°Π΄ΡΠΎΠ² Ρ ΠΊΠ°ΠΌΠ΅ΡΡ cap = video.create_capture(0) while True: # Π·Π°Ρ
Π²Π°ΡΡΠ²Π°Π΅ΠΌ ΡΠ΅ΠΊΡΡΠΈΠΉ ΠΊΠ°Π΄Ρ ΠΈ ΠΊΠ»Π°Π΄Π΅ΠΌ Π΅Π³ΠΎ Π² ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ img flag, img = cap.read() try: # ΠΎΡΠΎΠ±ΡΠ°ΠΆΠ°Π΅ΠΌ ΠΊΠ°Π΄Ρ Π² ΠΎΠΊΠ½Π΅ Ρ ΠΈΠΌΠ΅Π½Π΅ΠΌ result cv2.imshow('result', img) except: cap.release() raise ch = cv2.waitKey(5) if ch == 27: break cap.release() cv2.destroyAllWindows() And the error:
Traceback (most recent call last): File "eye.py", line 6, in cv2.namedWindow ("result") cv2.error: OpenCV (4.0.0-pre) / home / pi / Downloads / opencv-
master / modules / highgui / src / window.cpp: 615: error: (-2: Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK + 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow'
From what they write to us in the error, you can understand that they are asking to install libgtk2.0-dev and pkg-config , restart cmake or configure script functions. When installing libgtk2.0-dev, errors and files get out (most likely due to that it is already installed), and pkg-config writes that nothing new has been added.
I do not understand how to restart Cmake and how to "configure the script functions." If you have thoughts on how this should work and how to fix it, I will be very grateful
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.1.zipsince the example you are referring to may not work for 4.0.0 - mr NAE