You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import cv2
from matplotlib import pyplot as plt
import numpy as np
import imutils
import easyocr
import os
Set environment variable to avoid OpenMP duplicate library issue
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
Ensure compatibility with Pillow<9.0
if not hasattr(PIL.Image, 'Resampling'):
PIL.Image.Resampling = PIL.Image
#Read in Image, Grayscale and Blur
img = cv2.imread("frame_0000.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(cv2.cvtColor(gray, cv2.COLOR_BGR2RGB))
#Apply filter and find edges for localization
bfilter = cv2.bilateralFilter(gray, 11, 17, 17) #Noise reduction
edged = cv2.Canny(bfilter, 30, 200) #Edge detection
plt.imshow(cv2.cvtColor(edged, cv2.COLOR_BGR2RGB))
#Find Contours and Apply Mask
keypoints = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
contours = imutils.grab_contours(keypoints)
contours = sorted(contours, key=cv2.contourArea, reverse=True)[:10]
location = None
for contour in contours:
approx = cv2.approxPolyDP(contour, 10, True)
if len(approx) == 4:
location = approx
break
print(location)
Traceback
--- Logging error ---
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\logging\__init__.py", line 1084, in emit
stream.write(msg +self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\spyder\app\start.py", line 232, in <module>
main()
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\spyder\app\start.py", line 228, in main
mainwindow.main(options, args)
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\spyder\app\mainwindow.py", line 2293, in main
mainwindow = create_window(app, splash, options, args)
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\spyder\app\mainwindow.py", line 2192, in create_window
app.exec_()
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\qtconsole\manager.py", line 27, in pollsuper().poll()
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\jupyter_client\restarter.py", line 116, in pollself.kernel_manager.restart_kernel(now=True, newports=newports)
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\jupyter_client\manager.py", line 510, in restart_kernelself.start_kernel(**self._launch_args)
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\jupyter_client\manager.py", line 342, in start_kernelself.post_start_kernel(**kw)
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\qtconsole\manager.py", line 62, in post_start_kernelself.kernel_restarted.emit()
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\spyder\plugins\ipythonconsole\widgets\shell.py", line 786, in _handle_kernel_restartedsuper(ShellWidget, self)._handle_kernel_restarted()
File "C:\ProgramData\Anaconda3\envs\tensorflow_gpu\lib\site-packages\qtconsole\frontend_widget.py", line 530, in _handle_kernel_restartedself.log.warning("kernel restarted")
Message: 'kernel restarted'Arguments: ()
Hey @Abhiramisp1996, thanks for reporting. This problem should be fixed in our latest version available in Anaconda (5.4.3). Please update by closing Spyder, opening the Anaconda Prompt and running there the commands mentioned in our documentation.
Description
What steps will reproduce the problem?
import cv2
from matplotlib import pyplot as plt
import numpy as np
import imutils
import easyocr
import os
Set environment variable to avoid OpenMP duplicate library issue
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
Ensure compatibility with Pillow<9.0
if not hasattr(PIL.Image, 'Resampling'):
PIL.Image.Resampling = PIL.Image
#Read in Image, Grayscale and Blur
img = cv2.imread("frame_0000.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(cv2.cvtColor(gray, cv2.COLOR_BGR2RGB))
#Apply filter and find edges for localization
bfilter = cv2.bilateralFilter(gray, 11, 17, 17) #Noise reduction
edged = cv2.Canny(bfilter, 30, 200) #Edge detection
plt.imshow(cv2.cvtColor(edged, cv2.COLOR_BGR2RGB))
#Find Contours and Apply Mask
keypoints = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
contours = imutils.grab_contours(keypoints)
contours = sorted(contours, key=cv2.contourArea, reverse=True)[:10]
location = None
for contour in contours:
approx = cv2.approxPolyDP(contour, 10, True)
if len(approx) == 4:
location = approx
break
print(location)
Traceback
Versions
Dependencies
The text was updated successfully, but these errors were encountered: