eac123 | 31 May 04:08 2012
Picon

poor quality stereocalibrate

I am using OpenCV 2.3.1 with python 2.6.8. My goal is to calibrate stereo cameras with 640x480 sensors and
3.5mm lenses. I capture images of the asymmetric circle grid, find the circle centers, calibrate each
camera, then stereo calibrate. With this method, I get very accurate individual camera calibrations
(around .2 rms error), but very bad stereo calibration (around 10 rms error). I am trying to figure out why
the stereo calibration is so poor. 

I have tried: many different sets of calibration images, running this is OpenCV 2.4, using the chessboard
pattern, many different flags for each function, and none seem to make any difference. The code is linked
and pasted below. I would really appreciate any guidance on how to get a better stereo calibration.

Thank you,
Emily

Here is a link to a zip archive containing the full code and calibration images:
http://dl.dropbox.com/u/31708259/stereoexample.zip
run: python stereo_calibration_circles.py

Here is a shortened example of the code, which finds the circle centers, calibrates cameras, then stereo calibrates:

	# identify image points
	num_pts = dims[0] * dims[1] # Number of points in circle grid
	nimg = 0 #counter for number of images with found circles
	iptsF1 = [] #image point arrays to fill up
	iptsF2 = []
	for n in range(nimages):
		filename1 = check_img_folder + 'cam1_frame_'+str(n+1)+'.bmp'
		filename2 = check_img_folder + 'cam2_frame_'+str(n+1)+'.bmp'
		if os.path.exists(filename1) and os.path.exists(filename2):
			img1 = cv2.imread(filename1,0)
			img2 = cv2.imread(filename2,0)
(Continue reading)

roccor | 31 May 00:35 2012
Picon

OpenCV with PGR Flycapture cameras

I have three firewire (http://www.ptgrey.com/products/flea3/flea3_firewire_camera.asp)Flea3 PGR
cameras disposed like a trinocular system on my pc with Windows 7 and I'd like to capture images, save them
on my hard drive and display them at the same time in a wiandow with a single C/C++ program.

Since [b]these cameras are able to automatically sinchronize when they are on the same bus, I just have to
save the captured frames and to show them in a window; I'd like to divide the window in three parts in order to
show frames from each single cameras at the same time.

I'm using a
(http://www.ptgrey.com/products/pgrflycapture/examples/MultipleCameraWriteToDisk.html)PGR
example which shows how to capture images from the three cameras and save them in the hard disk; it works
very well but I need also to display frames from these three cameras during the acquisition and I'm trying
to do this with OpenCV libraries.

(The example I'm using starts creating a temp file for each detected camera to store image buffer and then it
read each file to split images and save them in the hard drive; I'm trying to display images while it creates
the temp files)

The problem is that I do not know how to convert the PGR Flycapture image to make it compatible with OpenCV
images in order to use showImage() or imshow() functions and moreover [b]I do not know how to display the
three acquired frames at the same time in the same window.

Can you help me, please?

The file attached is the current source file I'm using and this is the code where I try to do the convertion
from PGR to OpenCV (I know it's not correct since the program crash).
(I added the openCV code from line 78 to 92)

[code]int doGrabLoop()
{
(Continue reading)

mstevens1186 | 30 May 17:42 2012
Picon

gpu HSV to RGB Color Conversion Use

I am trying to perform color conversion on the gpu and have run into some problems. In order to debug I have
made the following application which read an image on the CPU converts RGB->HSV->RGB and does the same for
the GPU. Unfortunately the outputs are not the same. Everything looks identical until this call.

cv::gpu::cvtColor(HsvMatGpu, RgbOutputGpu, CV_HSV2RGB).

I am currently using OpenCV 2.3.1 on windows.

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main(int argc, char** argv)
{

  cv::Mat RgbMatCpu(cv::imread("C:\\DataLocal\\Images\\Koala.jpg"));
  cv::gpu::GpuMat RgbMatGpu(cv::imread("C:\\DataLocal\\Images\\Koala.jpg"));

  cv::namedWindow("InputCpu", 0);
  cv::namedWindow("OutputCpu", 0);

  cv::namedWindow("InputGpu", 0);
  cv::namedWindow("OutputGpu", 0);

  cv::Mat HsvMatCpu;
  cv::Mat RgbOutputCpu;

  cv::gpu::GpuMat HsvMatGpu;
  cv::gpu::GpuMat RgbOutputGpu;

  cv::cvtColor(RgbMatCpu, HsvMatCpu, CV_RGB2HSV);
  cv::cvtColor(HsvMatCpu, RgbOutputCpu, CV_HSV2RGB);
(Continue reading)

nunovgato | 30 May 16:07 2012
Picon

Memory leak when using python QueryFrame



Hi,

I want to make some realtime face detection to then be sent to face.com to be identified

I started by having only one CaptureFromCAM and then inside a loop I was calling QueryFrame but as what I wanted is real time, this gave me a lot of delay maybe due to some camera buffer, so what I did was for every time I want to take a photo I create a new CaptureFromCAM and then get the frame.

This works great as I have a instant photo from the camera, the problem is that there is some kind of memory leak as everytime the "QueryFrame" is called it adds arround 30MB to the used memory. In less than one minute my script dies due to too much used memory.

Any suggestion?

Here is my code

#!/usr/bin/python

import sys
import cv2.cv as cv
from optparse import OptionParser
from ftplib import FTP

if __name__ == '__main__':

    parser = OptionParser(usage = "usage: %prog [options] [filename|camera_index]")
    parser.add_option("-c", "--cascade", action="store", dest="cascade", type="str", help="Haar cascade file, default %default", default = "../../data/haarcascades/haarcascade_frontalface_alt.xml")
    (options, args) = parser.parse_args()

    cascade = cv.Load(options.cascade)
    
    input_name = args[0]

    while True:
        capture = cv.CaptureFromCAM(int(input_name))

        cv.SetCaptureProperty( capture, 3, 1600)
   & nbsp;    cv.SetCaptureProperty( capture, 4, 900)

        frame = cv.CreateImage((1600, 900), cv.IPL_DEPTH_8U, 3)
        frame = cv.QueryFrame(capture)

        frame_copy = cv.CreateImageHeader(cv.GetSize(frame), frame.depth, frame.channels)
        cv.SetData(frame, frame_copy)

        del capture
        del frame
        del frame_copy

        #detect_and_upload(frame_copy, cascade, lock).start()
    
        if cv.WaitKey(10) >= 0:
            break




__._,_.___

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
paulal7489 | 30 May 15:25 2012

OpenCV: using MatchTemplate,Canny and HoughLineTransform

Hey everybody,

I'm quite new to OpenCV and I need to write a code with the following functions: MatchTemplate, Canny and
Hough Line Transform.
I already have all of them separetely. But when I try to connect them in different ways, it's not working.
Could you please help me? Maybe an example?

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com
rubi faith | 31 May 07:59 2012
Picon

saving video of single channel image



Hello guys,

i am trying to save single channel video while using cvWriteFrame(), needs images with depth = IPL_DEPTH_8U and nChannels = 3 . 
So Could any one please tell me that how can i save single channel video ? 
if any one can help me then please. 
Thanks 


__._,_.___

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
mgb | 30 May 22:43 2012

gpu opencv2.4 opengl interop with Qt

I'm trying to get gpuMat to work with openGL and Qt, based on the window_QT.cpp code and using QGlBuffer

The cv::gpu::Mat is created and upload()  by the calling thread, cudaSetDevice(0) is called in that thread.

The QGlWidget derived display class has:

void GlWidget::initializeGL()
{
    cudaGLSetGLDevice(0);

    glbuffer = QGLBuffer(QGLBuffer::PixelUnpackBuffer);
    glbuffer.setUsagePattern(QGLBuffer::DynamicCopy);
    glbuffer.create();
    glbuffer.bind();
    glbuffer.allocate(width*height*4);		
    glbuffer.release();
		
    glEnable(GL_TEXTURE_2D);
    glGenTextures(1,&texture);
        			
    glBindTexture(GL_TEXTURE_2D,_texture);		
    glTexImage2D(GL_TEXTURE_2D, 0, glFormat, width,height, 0, glFormat, glType, NULL );	

    glDisable(GL_TEXTURE_2D);		

    cudaGraphicsGLRegisterBuffer(&resource, glbuffer.bufferId(), cudaGraphicsMapFlagsNone) ;   	
}

// A new gpuMat is uploaded by the calling thread and then this is called to display it:
void GlWidget::updateImage(const cv::gpu::GpuMat &mat) 
{
    cudaGraphicsMapResources(1, &_resource, 0) ;

    void* dst_ptr;
    size_t num_bytes;
    cudaGraphicsResourceGetMappedPointer(&dst_ptr, &num_bytes, _resource) ;

    const void* src_ptr = mat.ptr();
    size_t widthBytes = mat.cols * mat.elemSize();
    cudaMemcpy2D(dst_ptr, widthBytes, src_ptr, mat.step, widthBytes, mat.rows,
cudaMemcpyDeviceToDevice) ;

    cudaGraphicsUnmapResources(1, &resource, 0);

    repaint();		
}

void GlWidget::paintGL() 
{
    glClear (GL_COLOR_BUFFER_BIT);   	
    glDisable(GL_DEPTH_TEST);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();        
		
    glOrtho(0,_win.width(),0,_win.height(),-1,1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();        
		
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D,_texture);
		
    glBegin(GL_QUADS);
    glTexCoord2i(0,0); glVertex2i(0,0);
    glTexCoord2i(1,0); glVertex2i(width,0);
    glTexCoord2i(1,1); glVertex2i(width,height);
    glTexCoord2i(0,1); glVertex2i(0,height);
    glEnd();	         
						
    glDisable(GL_TEXTURE_2D);
}

All I get is a blank screen? Any ideas?

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com
Nicole | 30 May 18:16 2012
Picon

Face detection speed when no face is detected

Hi,

I have a question regarding cvHaarDetectObjects for face detection. If a face is detected, my code for face
detection runs fast; however, when there's no face detected, the code runs slow. My code is as simple as the
one in the sample code. Is this normal? Since the function is having a hard time detecting the face, causing
the code to run slowly?

Thank you very much!

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com
Reza Adhitya Saputra | 28 May 20:32 2012
Picon

[ask] StereoVar



Hi,
right now i'm doing 3d reconstruction using stereo images. i know OpenCv already implemented some stereo algorithms (GC, BM, and GCBM). Somehow those algorithms don't give me satisfying result and i want to try the experimental algorithm StereoVar.

I did implement the example code of StereoVar in stereo_match.cpp. Then i try to get the disparity map from pair of 480x320 images. but somehow the resulted disparity is only black(no data).

Here's the result:

and here's my code

int numberOfDisparities = 0;
StereoVar var;

IplImage* srcLeft = cvLoadImage(lImgFile);
IplImage* srcRight = cvLoadImage(rImgFile);

loadCalibrationMatrix();

if(srcLeft->width != srcRight->width || srcLeft->height != srcRight->height)
{
cout << "Pair of stereo images have different size\n";
exit(-1);
} div>

int imgWidth = srcLeft->width;
int imgHeight = srcLeft->height;

IplImage* gsImgLeft = cvCreateImage(cvSize(imgWidth, imgHeight), IPL_DEPTH_8U, 1); // grayscale left image
IplImage* gsImgRight = cvCreateImage(cvSize(imgWidth, imgHeight), IPL_DEPTH_8U, 1); // grayscale right image

CvMat* remappedLeft = cvCreateMat(imgHeight, imgWidth, CV_8U); // remapped left image
CvMat* remappedRight = cvCreateMat(imgHeight, imgWidth, CV_8U); // remapped right image

cvCvtColor(srcLeft, gsImgLeft, CV_BGR2GRAY);
cvCvtColor(srcRight, gsImgRight, CV_BGR2GRAY);

cvRemap(gsImgLeft, remappedLeft, mxl, myl);
cvRemap(gsImgRight, remappedRight, mxr, myr);

div>
numberOfDisparities = numberOfDisparities > 0 ? numberOfDisparities : ((imgWidth) + 15) & -16;

var.levels = 3; // ignored with USE_AUTO_PARAMS
var.pyrScale = 0.5; // ignored with USE_AUTO_PARAMS
var.nIt = 25;
var.minDisp = -numberOfDisparities;
var.maxDisp = 0;
var.poly_n = 3;
var.poly_sigma = 0.0;
var.fi = 15.0f;
var.lambda = 0.03f;
var.penalization = var.PENALIZATION_TICHONOV; // ignored with USE_AUTO_PARAMS
var.cycle = var.CYCLE_V; // ignored with USE_AUTO_PARAMS
var.flags = var.USE_SMART_ID | var.USE_AUTO_PARAMS | var.USE_INITIAL_DISPARITY | var.USE_MEDIAN_FILTERING ;

Mat di sp1, disp2;
Mat img1(remappedLeft);
Mat img2(remappedRight);

var(img1, img2, disp1);

disp1.convertTo(disp2, CV_8U, 255/(numberOfDisparities*16.));
//disp1.convertTo(disp2, CV_8U);
namedWindow("Left", 0);
imshow("Left", img1);

namedWindow("Right", 0);
imshow("Right", img2);

namedWindow("Disparity", 0);
imshow("Disparity", disp2);

/*CvMat dispResult = disp2;
cvNamedWindow("Disparity", 0);
cvShowImage("Disparity", &dispResult);*/

cvWaitKey(0);


__._,_.___


Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
pengyanbing83 | 30 May 10:34 2012
Picon

Use OpenCV on a ARM processor with Windows CE system,Help please.

Hi there,

I'm new to OpenCV 2.4, trying to use this library for the first time. I have a Overo Fire COM(OMAP3530 ARM
processor) running Windows CE6.0 system. I'm writing a object-detecting application(Win32 Smart
Device Project) for the CE6 system using Visual Studio 2005.

I include following header files in my project,

#include<windows.h>
#include "OpenCV_WinCE.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
.........

I got this error: 
"opencv_core240.lib(opencv_core240.dll) : fatal error LNK1112: module machine type 'X86' conflicts
with target machine type 'THUMB"

Looks like the problem is that OpenCV library I got is for intel processor and conflict with ARM processor. 

Can anyone give me some suggestions on how to overcome this problem please. Thanks a lot.

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com
Witek Czajewski - Czajnik | 30 May 13:20 2012
Picon
Picon

How to limit the number of threads in prebuilt complilation?

Hi All

Is there a quick way to limit the number of tbb threads used in some optimized functions (like surf) in the
prebuilt version of the OpenCV 2.4?
I know it seems kind of stupid to actually lower the performance and I think it is great that the prebuilt
library supports tbb without the need of installing and linking anything, but I case I wanted to use just
one thread, can I do that?

Witek

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
   Get Emails (get all posts)
   Daily Digest (one summary email per day)
   Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe <at> yahoogroups.com

Gmane