OpenCV Support

I am using caffe.
I am trying to run program on tx2 as on my x64 computer.
I always check out version between them and it indeed help me a lot.
I think this maybe because the version about opencv or cv2 module.
However I don’t know how to change my cv2 module version on TX2.
If you need more environment information, please reply me.

import cv2
print cv2.version

python      2.7

python modle:
matplotlib  2.2.2
pylab       1.11.0
cv2         2.4.13

JetPack:     3.0       (more info:

when I tried

sudo apt-get install libopencv-dev


Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libopencv-dev : Depends: libopencv-core-dev (=
                 Depends: libopencv-ml-dev (=
                 Depends: libopencv-imgproc-dev (=
                 Depends: libopencv-video-dev (=
                 Depends: libopencv-objdetect-dev (=
                 Depends: libopencv-highgui-dev (=
                 Depends: libopencv-calib3d-dev (=
                 Depends: libopencv-flann-dev (=
                 Depends: libopencv-features2d-dev (=
                 Depends: libopencv-legacy-dev (=
                 Depends: libopencv-contrib-dev (=
                 Depends: libopencv-ts-dev (=
                 Depends: libopencv-photo-dev (=
                 Depends: libopencv-videostab-dev (=
                 Depends: libopencv-stitching-dev (=
                 Depends: libopencv-gpu-dev (=
                 Depends: libopencv-superres-dev (=
                 Depends: libopencv-ocl-dev (= but it is not going to be installed
                 Depends: libopencv2.4-java (= but it is not going to be installed
                 Depends: libopencv2.4-jni (= but it is not going to be installed
                 Depends: libcv-dev (=
                 Depends: libhighgui-dev (=
                 Depends: libcvaux-dev (=
E: Unable to correct problems, you have held broken packages.

I learn that if I install JetPack I cannot change opencv as this way:

sudo apt-get install libopencv-dev

, right?

then when I try to

import cv2

in python. I meet error:

No module named cv2

so I search an anwser and do it as follow:

sudo apt-get install libopencv4tegra-python
sudo apt-get install opencv-python


libopencv4tegra-python:  2.4.13-17-g5317135

When I try this code:

pkg-config opencv --modversion



my x64 computer DEVICE

When I try this code in python:

import cv2
print cv2.__version



my x64 computer DEVICE


When I run under code:

rectmap = {}

imgdir= datadir+'666.jpg'
img = load_img(imgdir)
imgdata = img[:,:,[2,1,0]]*255. - mn

all_rect = []
work(imgdata, all_rect)
rectmap[imgid] = all_rect
result_annos = anno_func.get_refine_rects(annos, rectmap)
print result_annos['imgs'].keys()
print result_annos['imgs'][imgid]

imgdata_draw = anno_func.draw_all(result_annos,datadir,imgid,img)    

There is error:

Traceback (most recent call last)
<ipython-input-10-5e956b4ea70a> in <module>()
      8 all_rect = []
      9 sys.stdout.flush()
---> 10 work(imgdata, all_rect)
     11 rectmap[imgid] = all_rect
     12 result_annos = anno_func.get_refine_rects(annos, rectmap)

<ipython-input-8-46f307e2a988> in work(imgdata, all_rect)
     42             data = cv2.resize(imgdata, (data_layer.shape[2], data_layer.shape[3]))
     43         else:
---> 44             data = cv2.resize(imgdata, (imgdata.shape[0]*resize, imgdata.shape[1]*resize))
     45         data = data.transpose(2,0,1)
     46         #print data.shape

error: /hdd/buildbot/slave_jetson_tx_3/35-O4T-L4T-R24/opencv/modules/python/src2/cv2.cpp:201: error: (-2) The numpy array of typenum=12, ndims=3 can not be created in function allocate

I will appreciate it if you can give me some suggestion !


I use jupyter notebook.
install by this way:
sudo pip install jupyter 4.4.0
sudo pip install notebook
sudo pip install qtconsole
forget how to install ipython 5.8.0