Closed wolf943134497 closed 3 months ago
I have the same problem
I0706 18:48:28.640565 3858 net.cpp:761] Ignoring source layer accuracy
I0706 18:48:28.640568 3858 net.cpp:761] Ignoring source layer prob
Traceback (most recent call last):
File "Scripts/webcam_demo.py", line 34, in
Did you solve it?
Probably you give a incorrect path to imread, see: http://www.pyimagesearch.com/2016/12/26/opencv-resolving-nonetype-errors/
this issue could be the '/' in beginning of path, call python Scripts/webcam_demo.py --model Example_Models/segnet_model_driving_webdemo.prototxt --weights Example_Models/segnet_weights_driving_webdemo.caffemodel --colours Scripts/camvid12.png
instead of: python Scripts/webcam_demo.py --model Example_Models/segnet_model_driving_webdemo.prototxt --weights /Example_Models/segnet_weights_driving_webdemo.caffemodel --colours /Scripts/camvid12.png
import numpy as np import cv2
def update(val = 0):
stereo.setBlockSize(cv2.getTrackbarPos('window_size', 'disparity'))
stereo.setUniquenessRatio(cv2.getTrackbarPos('uniquenessRatio', 'disparity'))
stereo.setSpeckleWindowSize(cv2.getTrackbarPos('speckleWindowSize', 'disparity'))
stereo.setSpeckleRange(cv2.getTrackbarPos('speckleRange', 'disparity'))
stereo.setDisp12MaxDiff(cv2.getTrackbarPos('disp12MaxDiff','disparity'))
print ('computing disparity...')
disp = stereo.compute(imgL, imgR).astype(np.float32) / 16.0
cv2.imshow('left', imgL)
cv2.imshow('disparity', (disp-min_disp)/num_disp)
if name == "main": window_size = 5 min_disp = 16 num_disp = 192-min_disp blockSize = window_size uniquenessRatio = 1 speckleRange = 3 speckleWindowSize = 3 disp12MaxDiff = 200 P1 = 600 P2 = 2400 imgL = cv2.imread('images/color1_small.jpg') imgR = cv2.imread('images/color2_small.jpg') cv2.namedWindow('disparity') cv2.createTrackbar('speckRange', 'disparity', speckleRange, 50, update) cv2.createTrackbar('window_size', 'disparity', window_size, 21, update) cv2.createTrackbar('speckleWindowSize', 'disparity', speckleWindowSize, 200, update) cv2.createTrackbar('uniquenessRatio', 'disparity', uniquenessRatio, 50, update) cv2.createTrackbar('disp12MaxDiff', 'disparity', disp12MaxDiff, 250, update) stereo = cv2.StereoSGBM_create( minDisparity = min_disp, blockSize = window_size, uniquenessRatio = uniquenessRatio, speckleRange = speckleRange, speckleWindowSize = speckleWindowSize, disp12MaxDiff = disp12MaxDiff, P1 = P1, P2 = P2, ) update() cv2.waitKey()
File "c:/Users/diego/OneDrive/Escritorio/8vo cuatrimestre/SISTEMAS DE VISIÓN ARTIFICIAL/ProgramasPython/Practica visión estereoscopica.py", line 21, in update disp = stereo.compute(imgL, imgR).astype(np.float32) / 16.0 AttributeError: 'NoneType' object has no attribute 'astype' PS C:\Users\diego>
me pueden ayudar con este error (esta en negritas) gracias
I0310 14:31:03.640287 7170 net.cpp:761] Ignoring source layer accuracy I0310 14:31:03.640292 7170 net.cpp:761] Ignoring source layer prob Traceback (most recent call last): File "Scripts/webcam_demo.py", line 34, in
label_colours = cv2.imread(args.colours).astype(np.uint8)
AttributeError: 'NoneType' object has no attribute 'astype'
HOW to solve this problem? Thanks