Ask Your Question

moresnow's profile - activity

2017-08-21 05:07:52 -0500 received badge  Student (source)
2017-08-15 20:48:55 -0500 received badge  Famous Question (source)
2017-03-06 10:04:43 -0500 received badge  Notable Question (source)
2017-01-30 07:11:25 -0500 received badge  Popular Question (source)
2016-04-17 00:54:18 -0500 commented question Segmentation fault while import cv2 in centos

well, what do you know...that worked. It created a cv2.so as well and after moving it to /usr/lib/python2.6/site-packages/ i was able to import cv2.

2016-04-17 00:11:09 -0500 commented question Segmentation fault while import cv2 in centos

I'm unaware what the difference is? can you please explain. if I use that flag, will it make the cv2.so that I then move to PYTHON PATH?

2016-04-16 22:48:17 -0500 asked a question Segmentation fault while import cv2 in centos

I'm installing Opencv3 on Centos 2.6 with Python 2.6. I get the error when I import cv. I get a Segmentation fault error.

I'm installing OpenCV like this:

yum update && \
yum install -y libjpeg-turbo && \
yum install -y libtiff-devel && \
yum install -y libpng-devel && \
yum install -y cmake python-devel numpy gcc gcc-c++ gtk2-devel libdc1394-devel libv41-devel ffmpeg-devel gstreamer-plugins-base-devel && \
yum groupinstall -y "Development Tools"

cmake -D CMAKE_BUILD_TYPE=RELEASE -D \
CMAKE_INSTALL_PREFIX=/usr/local -D \
OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules/ .. 

make -j4 
make install 

/usr/local/lib/python2.6/site-packages/cv2.so /usr/lib/python2.6/site-packages/

Importing cv2 gives a segmentation fault error. I get the following output:

[root@localhost ~]# python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Segmentation fault
2016-03-20 07:52:57 -0500 received badge  Scholar (source)
2016-03-20 07:51:37 -0500 commented answer How to perform intersection or union operations on a rect in Python?

Thank you for clarifying that. I was able to use the Non-Maximal Suppression technique mentioned here http://www.pyimagesearch.com/2014/11/...

2016-03-19 06:56:44 -0500 asked a question How to perform intersection or union operations on a rect in Python?

I saw a question that is solved by using &(intersection) on rectangles http://answers.opencv.org/question/67...

I am trying to do the same in python.

I draw the rectangles like this:

for rect in rects_new:
    #print (str(type(rect))) #<class 'numpy.ndarray'>
    #print (rect.area()) # gives error that 'numpy.ndarray' object has no attribute 'area'
    cv2.rectangle(vis, (rect[0],rect[1]), (rect[0]+rect[2],rect[1]+rect[3]), (0, 255, 255), 2)

but the rectangles are overlapping. I would only like to keep the outermost rectangle. However, I don't know how to perform & intersect operations. I can't even call area() on it.

2016-02-12 00:13:37 -0500 asked a question How to send OpenCV object to liblept using ctypes in python

I am using OpenCV [python] to do some processing on the image. My final image is in a variable called imcv. I need to pass this image to leptonica. Instead of saving it as an image file on the disk, I'm wondering if there is a way to pass it to leptonica in memory and avoid I/O

Using ctypes in my code I have access to the leptonica API.

import cv2
import ctypes
imcv = cv2.imread('myimage.png')            
h, w, d = imcv.shape
leptonica = ctypes.cdll.LoadLibrary("/usr/local/lib/liblept.so")
# leptonica.pixReadStream(.....) #how can I pass in imcv here?

leptonica has a method called PIX* pixReadStream ( FILE * fp, l_int32 hint) but I'm unsure as to how I can pass imcv to it using ctypes?

Question

Is there a way to send imcv to leptonica using ctypes ?