Hello, Malcolm ))))
Traceback (most recent call last): File "/project1/script1_callbacks", line 18, in onCook cv2.error: OpenCV(4.5.0) /Users/malcolm/Desktop/devel/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
Script TOP content:
# me - this DAT # scriptOp - the OP which is cooking import cv2 import numpy as np # press 'Setup Parameters' in the OP to call this function to re-create the parameters. def onSetupParameters(scriptOp): return # called whenever custom pulse parameter is pushed def onPulse(par): return def onCook(scriptOp): img = op('null1').numpyArray(delayed=True) gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY) gray = np.float32(gray) dst = cv2.cornerHarris(gray,2,3,0.04) #result is dilated for marking the corners, not important dst = cv2.dilate(dst,None) # Threshold for an optimal value, it may vary depending on the image. img[dst>0.01*dst.max()]=[0,0,255,255] # THIS CODE CALLS THE ERROR BUT NOT WHICH EXPECTED cv2.imshow('dst',img) if cv2.waitKey(0) & 0xff == 27: cv2.destroyAllWindows() # END ERROR AREA return
I just copy-pasted the simple example from Harris Corner Detector in OpenCV. Just like in Feature Tracking with Script TOP and OpenCV in TouchDesigner - Tutorial by Elburz Sorkhabi.
I just forget to remove drawing code in the end and get that error. When I removed that, the error is disappears.
I don’t know is it alright or a bug…
Mac OS 11.0.1, Touchdesigner Experimental 2020.45520 (JAN) and 2020.44350 (DEC). I don’t know is there are that error in older versions.