Ask Your Question

thePhi's profile - activity

2018-07-11 06:02:27 -0500 received badge  Notable Question (source)
2017-07-19 08:14:46 -0500 received badge  Taxonomist
2017-03-10 10:35:48 -0500 received badge  Popular Question (source)
2016-11-16 09:24:01 -0500 received badge  Notable Question (source)
2015-06-20 22:27:26 -0500 received badge  Popular Question (source)
2014-08-31 08:30:47 -0500 asked a question A database of all computer-detectable objects?

I'm looking for a way to detect a specific object: my keyboard (it's a project of virtual reality with your keyboard displayed at the correct location in the virtual world).

Discovering the Traincascade module, I'm aware it's easy to detect faces but you have to train Opencv to detect any other thing. And the procedure is quite long, take some computer power, with a right choice of pictures...

During my research, I've already found xml files (the final product of the traincascade training) to detect cars.

Is there some way to find already-made xml files for any objects (as a keyboard for my problem)? Or a project of database of this kind?

2014-05-05 06:55:59 -0500 commented question Problem with imshow() to get live disparity map of 2 videos

Yes I corrected for the "imshow() can only show cv_8u file". Okay, I'm going on on this subject : so I' ve seen that we can do :

res = cv2.convertScaleAbs(disparity) and if you do : print(disparity.dtype) it shows : int16 and print(res.dtype) it shows : uint8. so the type of the image has changed.

2014-05-05 05:09:20 -0500 commented question Problem with imshow() to get live disparity map of 2 videos

I found a solution by modifying the format of the file returned by my function. Since imshow() can only have input of CV_8u file, I needed to convert to a compatible format. I can't yet answer to myself, but I post a solution on this question : http://answers.opencv.org/question/22102/windows-imshow-sometimes-showing-gray-image/

2014-05-05 03:51:27 -0500 answered a question Windows imshow sometimes showing gray image

I've got the same problem with cv2.imshow(). I found a solution by modifying the data type, and imshow() can now read the file :

import numpy as np
import cv2

imgL = cv2.imread('tsukuba_l.png', 0)
imgR = cv2.imread('tsukuba_r.png', 0)

stereo = cv2.createStereoBM(numDisparities=16, blockSize=15)
disparity = stereo.compute(imgL, imgR, cv2.CV_32F)

cv2.namedWindow("disparity_tsukuba", 0)
res = cv2.convertScaleAbs(disparity)
cv2.imshow('disparity_tsukuba', res)

cv2.waitKey(0)

The problem is indeed that imshow() works badly with files other than CV_8U file and can result in wrong image (like all gray images) when given 32F file, which are produced by some functions like StereoBM or other : doc. So we need to convert from a CV_32F to a readable format for imshow()

2014-05-04 15:43:02 -0500 asked a question Problem with imshow() to get live disparity map of 2 videos

I'm following the tutorial here, to get a disparity map from 2 pictures:

import numpy as np
import cv2
from matplotlib import pyplot as plt

imgL = cv2.imread('tsukuba_l.png',0)
imgR = cv2.imread('tsukuba_r.png',0)

stereo = cv2.createStereoBM(numDisparities=16, blockSize=15)
disparity = stereo.compute(imgL,imgR)
plt.imshow(disparity,'gray')
plt.show()

Now, I would like to do the same thing for live video. Unfortunately, cv2.imshow is not working : No error message but only a grey window. code used :

import numpy as np
import cv2

cap_left = cv2.VideoCapture(1)
cap_left = cv2.VideoCapture(2)


# create windows
cv2.namedWindow('left_Webcam', cv2.WINDOW_NORMAL)
cv2.namedWindow('right_Webcam', cv2.WINDOW_NORMAL)
cv2.namedWindow('disparity', cv2.WINDOW_NORMAL)

while(cv2.waitKey(1) & 0xFF != ord('q')):
    ret1, frame_left = cap_left.read()
    ret2, frame_right = cap_left.read()
    # our operations on the frame come here
    gray_left = cv2.cvtColor(frame_left, cv2.COLOR_BGR2GRAY)
    gray_left = cv2.cvtColor(frame_right, cv2.COLOR_BGR2GRAY)
    cv2.imshow('left_Webcam', gray_left)
    cv2.imshow('right_Webcam', gray_right)
    stereo = cv2.createStereoBM(numDisparities=16, blockSize=15)
    disparity = stereo.compute(gray_left, gray_right)
    cv2.imshow('disparity', disparity)
# When everything done, release the capture
cap1.release()
cap2.release()
cv2.destroyAllWindows()

So how can I get a live disparity map? By the way, if I used a fixed image from my webcams, using matplotlib as in the example of the tutorial, it's working (but it's a fixed image so...)

2014-05-03 09:47:22 -0500 received badge  Teacher (source)
2014-05-01 02:10:20 -0500 received badge  Self-Learner (source)
2014-04-30 11:32:42 -0500 answered a question OpenCV with Logitech Pro 4000 on the Raspberry Pi

For me,

import cv2.cv

is not working. Try :

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    #capture frame-by-frame
    ret = cap.set(3,160) #set Width 
    ret = cap.set(4, 120) #set Heigth
    #ret = cap.set(5, .0) NOT working on Logitech QuickCam: No FPS setting :(
    ret, frame = cap.read()

    #our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    #Display the resulting frame
    cv2.imshow('frame', gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
2014-04-30 10:59:22 -0500 answered a question cv2.imshow() not working ("function no implemented") (on Ubuntu) [SOLVED]

Thanks for your help. libgtk2.0-dev was installed but to no avail... But I solve the problem! I don't know why but the version of Python-OpenCV donwloaded was not the right one. Because I reinstall using the github version (using : sudo git clone https://github.com/Itseez/opencv.git ) and now everything is working! :)

2014-04-24 12:02:33 -0500 received badge  Editor (source)
2014-04-24 12:01:33 -0500 asked a question cv2.imshow() not working ("function no implemented") (on Ubuntu) [SOLVED]

Hi, I'm on Ubuntu 14.04. I'm trying to install OpenCV 2.49 with Python 3.4 binding.

sudo cmake -D WITH_QT=ON -D WITH_OPENEXR=OFF -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D BUILD_EXAMPLES=ON -D PYTHON_EXECUTABLE=/usr/bin/python3.4 ..

(I've disabled OpenEXR dependency since CMAKE wasn't working with it...) cmake is working apparently without error:

    -- General configuration for OpenCV 2.4.9 =====================================
--   Version control:               unknown
-- 
--   Platform:
--     Host:                        Linux 3.13.0-24-generic x86_64
--     CMake:                       2.8.12.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               Release
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.8.2)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera dynamicuda java python viz
-- 
--   GUI: 
--     QT 5.x:                      YES (ver 5.2.1)
--     QT OpenGL support:           YES (Qt5::OpenGL 5.2.1)
--     OpenGL support:              YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so)
--     VTK support:                 NO
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.50)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.3)
--     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
--     OpenEXR:                     NO
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.1)
--     FFMPEG:                      YES
--       codec:                     YES (ver 54.35.0)
--       format:                    YES (ver 54.20.3)
--       util:                      YES (ver 52.3.0)
--       swscale:                   YES (ver 2.1.1)
--       gentoo-style:              YES
--     GStreamer:                   
--       base:                      YES (ver 0.10.36)
--       app:                       YES (ver 0.10.36)
--       video:                     YES (ver 0.10.36)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l (ver 1.0.1)
--     XIMEA:                       NO
--     Xine:                        YES (ver 1 ...
(more)