bytedeco / javacv-examples

Examples of using JavaCV / OpenCV library on Java Virtual Machine
337 stars 155 forks source link

Unable to Draw Contours using code from examples #2

Closed ahsandar closed 9 years ago

ahsandar commented 9 years ago

Using following code from the examples but the following error is being thrown, any one got any ideas how to solve this ?

def drawContours(image: IplImage, contours: Seq[CvSeq]): IplImage = {
    contours.foreach(cvDrawContours(image, _, colourRandom, colourRandom, -1, 1, CV_AA, cvPoint(0, 0)))
   image
 }


overloaded method value cvDrawContours with alternatives:
[error]   (x$1: org.bytedeco.javacpp.helper.opencv_core.CvArr,x$2:    org.bytedeco.javacpp.opencv_core.CvSeq,x$3: org.bytedeco.javacpp.opencv_core.CvScalar,x$4:   org.bytedeco.javacpp.opencv_core.CvScalar,x$5: Int,x$6: Int,x$7: Int,x$8: Array[Int])Unit <and>
[error]   (x$1: org.bytedeco.javacpp.helper.opencv_core.CvArr,x$2: org.bytedeco.javacpp.opencv_core.CvSeq,x$3: org.bytedeco.javacpp.opencv_core.CvScalar,x$4: org.bytedeco.javacpp.opencv_core.CvScalar,x$5: Int,x$6: Int,x$7: Int,x$8: java.nio.IntBuffer)Unit <and>
[error]   (x$1: org.bytedeco.javacpp.helper.opencv_core.CvArr,x$2: org.bytedeco.javacpp.opencv_core.CvSeq,x$3: org.bytedeco.javacpp.opencv_core.CvScalar,x$4: org.bytedeco.javacpp.opencv_core.CvScalar,x$5: Int,x$6: Int,x$7: Int,x$8: org.bytedeco.javacpp.opencv_core.CvPoint)Unit
[error]  cannot be applied to (org.bytedeco.javacpp.opencv_core.IplImage, org.bytedeco.javacpp.opencv_core.CvSeq, org.bytedeco.javacpp.opencv_core.Scalar, org.bytedeco.javacpp.opencv_core.Scalar, Int, Int, Int, org.bytedeco.javacpp.opencv_core.CvPoint)
[error]       contours.foreach(cvDrawContours(image, _, colourRandom, colourRandom, -1, 1, CV_AA, cvPoint(0, 0)))
jpsacha commented 9 years ago

The second and the third argument of cvDrawContours need to be of type CvScalar. Your colourRandom is of type Scalar.

ahsandar commented 9 years ago

Cheers, this worked