how to process image with opencv in python?

后端 未结 3 1823
终归单人心
终归单人心 2021-02-02 04:38

I want to use edge detection algorithms from opencv library. Here is a piece of python code:

from opencv.cv import *
from opencv.highgui import *

img = cvLoadIm         


        
3条回答
  •  南旧
    南旧 (楼主)
    2021-02-02 04:55

    You can convert an image to grayscale in a single step instead of two:

    gray = cv.CreateMat(img.height, img.width, cv.CV_8UC1)
    cv.CvtColor(img, gray, cv.CV_BGR2GRAY)
    

提交回复
热议问题