python opencv TypeError: Layout of the output array incompatible with cv::Mat

前端 未结 5 1116
温柔的废话
温柔的废话 2021-01-02 01:54

I\'m using the selective search here: http://koen.me/research/selectivesearch/ This gives possible regions of interest where an object might be. I want to do some processing

5条回答
  •  孤城傲影
    2021-01-02 02:12

    My own solution was simply to ask a copy of original array...(god & gary bradski knows why...)

    im = dbimg[i]
    bb = boxes[i]  
    m = im.transpose((1, 2, 0)).astype(np.uint8).copy() 
    pt1 = (bb[0],bb[1])
    pt2 = (bb[0]+bb[2],bb[1]+bb[3])  
    cv2.rectangle(m,pt1,pt2,(0,255,0),2)  
    

提交回复
热议问题