Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The Opencv problem with OpenCV Error: Bad argument (Array should be CvMat or IplImage) in cvGetSize

Recently, I do my final project for my bachelor degree with Beaglebone Black.

I got problems is: 1: when I run python program like following command with pyhton using the Ubuntu (XFCE Desktop) connect with Beaglebone Black

!/usr/bin/python

import cv2.cv as cv iport time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0) cv.SetCaptureProperty(capture, 3, 360) cv.SetCaptureProperty(capture, 4, 240)

while True: img = cv.QueryFrame(capture)

 cv.Smooth(img,img,cv.CV_BLURK,3)
 hue_img = cv.CreateImage(cv.GetSize(img), 8, 3)
 cv.CvtColor(img,hue_img, cv.CV_BGR2HSV)

 threshold_img = cv.CreateImage(cv.GetSize(hue_img), 8, 1)
 cv.InRangeS(hue_img, (38, 120, 60), (75, 255, 255), threshold_img)

 cv.ShowImage("Color Tracking", img)
 cv.ShowImage("threshold", threshold_img)

 if cv.WaitKey(10) == 27:
        break

and then, I run this python file use "./name.py"

**it show : init done OpenCV Error: Bad argument (Array should be CvMat or IplImage) in cvGetSize, file /home/ubuntu/finalproject/(this is my opencv directory)

opencv-2.4.7/modules/core/src/array.cpp, line 1238 Traceback (most recent call last): File “./example.py”, line 16, in <module> hug_img = cv.CreateImage(cv.Getsize(img), 8, 3) cv2.erro: Array should be CvMat or IplImage**

Should I re-install OpenCV on my Beaglebone Black Board, or reset something?

Thank you

click to hide/show revision 2
retagged

updated 2014-04-23 01:49:13 -0600

berak gravatar image

The Opencv problem with OpenCV Error: Bad argument (Array should be CvMat or IplImage) in cvGetSize

Recently, I do my final project for my bachelor degree with Beaglebone Black.

I got problems is: 1: when I run python program like following command with pyhton using the Ubuntu (XFCE Desktop) connect with Beaglebone Black

!/usr/bin/python

import cv2.cv as cv iport time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0) cv.SetCaptureProperty(capture, 3, 360) cv.SetCaptureProperty(capture, 4, 240)

while True: img = cv.QueryFrame(capture)

 cv.Smooth(img,img,cv.CV_BLURK,3)
 hue_img = cv.CreateImage(cv.GetSize(img), 8, 3)
 cv.CvtColor(img,hue_img, cv.CV_BGR2HSV)

 threshold_img = cv.CreateImage(cv.GetSize(hue_img), 8, 1)
 cv.InRangeS(hue_img, (38, 120, 60), (75, 255, 255), threshold_img)

 cv.ShowImage("Color Tracking", img)
 cv.ShowImage("threshold", threshold_img)

 if cv.WaitKey(10) == 27:
        break

and then, I run this python file use "./name.py"

**it show : init done OpenCV Error: Bad argument (Array should be CvMat or IplImage) in cvGetSize, file /home/ubuntu/finalproject/(this is my opencv directory)

opencv-2.4.7/modules/core/src/array.cpp, line 1238 Traceback (most recent call last): File “./example.py”, line 16, in <module> hug_img = cv.CreateImage(cv.Getsize(img), 8, 3) cv2.erro: Array should be CvMat or IplImage**

Should I re-install OpenCV on my Beaglebone Black Board, or reset something?

Thank you