opencv
runtime_error
ai_generated
true
cv::calcOpticalFlowPyrLK: input images must be grayscale
ID: opencv/optical-flow-error
82%Fix Rate
86%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4 | active | — | — | — |
Root Cause
Optical flow function received wrong input format.
genericWorkarounds
-
92% success Convert to grayscale before optical flow: cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
-
88% success Ensure previous and current frames have same size and type
Dead Ends
Common approaches that don't work:
-
Use dense flow for everything
68% fail
Slow for sparse tracking
-
Skip optical flow
78% fail
No motion estimation