how to solve the problem when run python program and VNC problem

Dear friends

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

So I always post some stupid questions, I hope all guys do not be mad! :stuck_out_tongue: sorry about that, I am really fresh man to do that.

Until now, I just find the monitor, mouse, keypad and bought a webcam( C920), and my project environment as shown as the attachment file.(Ubuntu 12.04 LTS, Beaglebone Black: Ubuntu 12.04.4 LTS with XFCE desktop)

I got two problems are:
1:
when I run python program like following command:

#!/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

hug_img = cv.CreateImage(cv.Getsize(img), 8, 3)

cv2.erro: Array should be CvMat or IplImage

I check this problem for a long time, I did not get usefull answer. I hope someone can help me to solve that.

One crazy thing is I use the Ubuntu system (12.04LTS) and not use windows system

I would like to save space on my desk to using vnc viewer(SSL/SSH VNC Viewer(Ubuntu Edition) and Gtk VNC Viewer) this are not can be connect with BBB desktop

This are reference all have read. But I think this all can not help me?

https://wiki.archlinux.org/index.php/x11vnc

https://groups.google.com/forum/#!msg/beagleboard/D2e1tcLCANo/a1b4csCLPdYJ

https://help.ubuntu.com/community/VNC/Servers

https://www.digitalocean.com/community/articles/how-to-setup-vnc-for-ubuntu-12

http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot

The serious problem, when I use VNC Viewer, it cannot be fine the BBB device. : (

I think this are a lit bit long and waste some time to solve, I am really looking forward someone who can help me to solve that.

Your Sincerely

Ian

problem 1.png

Ubuntu 12.04 System .jpg

working environment (Ubuntu12.04.4 XFCE).png