龚泽 | 29 Oct 17:51 2011
Picon

cvCreateCameraCapture can't work in a thread

win7-64,vs2010,opencv2.3.1


current code can work as what I want
but if 

capture = cvCreateCameraCapture(1);

move into ThreadFunc , cvCreateCameraCapture will return 0.



--
龚泽
13884465286

Attachment (mfctestDlg.cpp): text/x-c++src, 4822 bytes
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World™ now supports Android™ Apps 
for the BlackBerry® PlayBook™. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World™ now supports Android™ Apps 
for the BlackBerry® PlayBook™. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
Huan Nguyen Hoang | 21 Oct 13:36 2011
Picon

Problem when cross compile OpenCV 2.1 for ARM

hi. I'm Huan. I get a problem when i build OpenCV 2.1 version for
embedded system. I don't know how to disable lib jpeg in the output
binary. I want to capture image from webcam in YUV mode, thus, i need
to disable jpeg lib.
I'm tried the solution but have still unsuccess:
./configure CXX=/home/hoanghuan/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-g++
 CC=/home/hoanghuan/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc-4.4.3
--enable-shared --enable-static --without-gtk --host=arm-linux
--without-pic --disable-apps --without-imageio --without-libjpeg
..  configure: WARNING: unrecognized options: --without-libjpeg
So, i can't build this.
Can you help me ?
PS: toolschain arm-linux-gcc-4.4.3; OpenCV 2.1; embbed board is
Friendlyarm micro2440; linux embded ;
My english is poorly, you inogre, thank you ,?

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning <at> Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
Krishnan V | 21 Oct 07:44 2011
Picon

CMake does not find ffmpeg components

Hi,
CMake is unable to find the ffmpeg components:swscale, avformat avcodec. I have tried with Opencv versions 2.2.0, 2.3.0 and 2.3.1. Is this a problem with CMake(mine is 2.8.1) or CMakeLists.txt which comes with OpenCV? Currently, I solve this by editing the CMakeCache.txt, but I am looking for a better solution. Apologies if this is unrelated to OpenCV(i.e., problem with CMake).
Any help deeply appreciated.
thanks
krishnan

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning <at> Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning <at> Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
Arne Krüger | 11 Oct 08:31 2011
Picon

V4L2 interface for Camera Capture

Hi folks,

in order to get our Pinacle Dazzle device working under Ubuntu Linux I
rewrote most of the Video-For-Linux interface. I removed all V4L1
specific fall-back code, which works for our purposes but will make the
code fail for all V4L1 devices. I don't regard this as a major issue
since there is a compatibility lib for V4L1.

This should solve Ticket #764.

The code might need some cleaning, especially regarding includes and
some defines (I didn't touch those).

I hope this is useful for some and would appreciate comments/feedback.

Cheers,
Arne
/* This is the contributed code:

File:             cvcap_v4l.cpp
Current Location: ../opencv-0.9.6/otherlibs/highgui

Original Version: 2003-03-12  Magnus Lundin lundin@...
Original Comments:

ML:This set of files adds support for firevre and usb cameras.
First it tries to install a firewire camera,
if that fails it tries a v4l/USB camera
It has been tested with the motempl sample program

First Patch:  August 24, 2004 Travis Wood   TravisOCV@...
For Release:  OpenCV-Linux Beta4  opencv-0.9.6
Tested On:    LMLBT44 with 8 video inputs
Problems?     Post problems/fixes to OpenCV group on groups.yahoo.com
Patched Comments:

TW: The cv cam utils that came with the initial release of OpenCV for LINUX Beta4
were not working.  I have rewritten them so they work for me. At the same time, trying
to keep the original code as ML wrote it as unchanged as possible.  No one likes to debug
someone elses code, so I resisted changes as much as possible.  I have tried to keep the
same "ideas" where applicable, that is, where I could figure out what the previous author
intended. Some areas I just could not help myself and had to "spiffy-it-up" my way.

These drivers should work with other V4L frame capture cards other then my bttv
driven frame capture card.

Re Written driver for standard V4L mode. Tested using LMLBT44 video capture card.
Standard bttv drivers are on the LMLBT44 with up to 8 Inputs.

This utility was written with the help of the document:
http://pages.cpsc.ucalgary.ca/~sayles/VFL_HowTo
as a general guide for interfacing into the V4l standard.

Made the index value passed for icvOpenCAM_V4L(index) be the number of the
video device source in the /dev tree. The -1 uses original /dev/video.

Index  Device
  0    /dev/video0
  1    /dev/video1
  2    /dev/video2
  3    /dev/video3
  ...
  7    /dev/video7
with
  -1   /dev/video

TW: You can select any video source, but this package was limited from the start to only
ONE camera opened at any ONE time.
This is an original program limitation.
If you are interested, I will make my version available to other OpenCV users.  The big
difference in mine is you may pass the camera number as part of the cv argument, but this
convention is non standard for current OpenCV calls and the camera number is not currently
passed into the called routine.

Second Patch:   August 28, 2004 Sfuncia Fabio fiblan@...
For Release:  OpenCV-Linux Beta4 Opencv-0.9.6

FS: this patch fix not sequential index of device (unplugged device), and real numCameras.
    for -1 index (icvOpenCAM_V4L) i dont use /dev/video but real device available, because
    if /dev/video is a link to /dev/video0 and i unplugged device on /dev/video0, /dev/video
    is a bad link. I search the first available device with indexList.

Third Patch:   December 9, 2004 Frederic Devernay Frederic.Devernay@...
For Release:  OpenCV-Linux Beta4 Opencv-0.9.6

[FD] I modified the following:
 - handle YUV420P, YUV420, and YUV411P palettes (for many webcams) without using floating-point
 - cvGrabFrame should not wait for the end of the first frame, and should return quickly
   (see highgui doc)
 - cvRetrieveFrame should in turn wait for the end of frame capture, and should not
   trigger the capture of the next frame (the user choses when to do it using GrabFrame)
   To get the old behavior, re-call cvRetrieveFrame just after cvGrabFrame.
 - having global bufferIndex and FirstCapture variables makes the code non-reentrant
 (e.g. when using several cameras), put these in the CvCapture struct.
 - according to V4L HowTo, incrementing the buffer index must be done before VIDIOCMCAPTURE.
 - the VID_TYPE_SCALES stuff from V4L HowTo is wrong: image size can be changed
   even if the hardware does not support scaling (e.g. webcams can have several
   resolutions available). Just don't try to set the size at 640x480 if the hardware supports
   scaling: open with the default (probably best) image size, and let the user scale it
   using SetProperty.
 - image size can be changed by two subsequent calls to SetProperty (for width and height)
 - bug fix: if the image size changes, realloc the new image only when it is grabbed
 - issue errors only when necessary, fix error message formatting.

Fourth Patch: Sept 7, 2005 Csaba Kertesz sign@...
For Release:  OpenCV-Linux Beta5 OpenCV-0.9.7

I modified the following:
  - Additional Video4Linux2 support :)
  - Use mmap functions (v4l2)
  - New methods are internal:
    try_palette_v4l2 -> rewrite try_palette for v4l2
    mainloop_v4l2, read_image_v4l2 -> this methods are moved from official v4l2 capture.c example
    try_init_v4l -> device v4l initialisation
    try_init_v4l2 -> device v4l2 initialisation
    autosetup_capture_mode_v4l -> autodetect capture modes for v4l
    autosetup_capture_mode_v4l2 -> autodetect capture modes for v4l2
  - Modifications are according with Video4Linux old codes
  - Video4Linux handling is automatically if it does not recognize a Video4Linux2 device
  - Tested succesful with Logitech Quickcam Express (V4L), Creative Vista (V4L) and Genius VideoCam
Notebook (V4L2)
  - Correct source lines with compiler warning messages
  - Information message from v4l/v4l2 detection

Fifth Patch: Sept 7, 2005 Csaba Kertesz sign@...
For Release:  OpenCV-Linux Beta5 OpenCV-0.9.7

I modified the following:
  - SN9C10x chip based webcams support
  - New methods are internal:
    bayer2rgb24, sonix_decompress -> decoder routines for SN9C10x decoding from Takafumi Mizuno
<taka-qce@...> with his pleasure :)
  - Tested succesful with Genius VideoCam Notebook (V4L2)

Sixth Patch: Sept 10, 2005 Csaba Kertesz sign@...
For Release:  OpenCV-Linux Beta5 OpenCV-0.9.7

I added the following:
  - Add capture control support (hue, saturation, brightness, contrast, gain)
  - Get and change V4L capture controls (hue, saturation, brightness, contrast)
  - New method is internal:
    icvSetControl -> set capture controls
  - Tested succesful with Creative Vista (V4L)

Seventh Patch: Sept 10, 2005 Csaba Kertesz sign@...
For Release:  OpenCV-Linux Beta5 OpenCV-0.9.7

I added the following:
  - Detect, get and change V4L2 capture controls (hue, saturation, brightness, contrast, gain)
  - New methods are internal:
    v4l2_scan_controls_enumerate_menu, v4l2_scan_controls -> detect capture control intervals
  - Tested succesful with Genius VideoCam Notebook (V4L2)

8th patch: Jan 5, 2006, Olivier.Bornet@...
Add support of V4L2_PIX_FMT_YUYV and V4L2_PIX_FMT_MJPEG.
With this patch, new webcams of Logitech, like QuickCam Fusion works.
Note: For use these webcams, look at the UVC driver at
http://linux-uvc.berlios.de/

9th patch: Mar 4, 2006, Olivier.Bornet@...
- try V4L2 before V4L, because some devices are V4L2 by default,
  but they try to implement the V4L compatibility layer.
  So, I think this is better to support V4L2 before V4L.
- better separation between V4L2 and V4L initialization. (this was needed to support
  some drivers working, but not fully with V4L2. (so, we do not know when we
  need to switch from V4L2 to V4L.

10th patch: July 02, 2008, Mikhail Afanasyev fopencv@...
Fix reliability problems with high-resolution UVC cameras on linux
the symptoms were damaged image and 'Corrupt JPEG data: premature end of data segment' on stderr
- V4L_ABORT_BADJPEG detects JPEG warnings and turns them into errors, so bad images
  could be filtered out
- USE_TEMP_BUFFER fixes the main problem (improper buffer management) and
  prevents bad images in the first place

11th patch: Apr 13, 2010, Filipe Almeida filipe.almeida@...
- Tries to setup all properties first through v4l2_ioctl call.
- Allows seting up all Video4Linux properties through cvSetCaptureProperty instead of only
CV_CAP_PROP_BRIGHTNESS, CV_CAP_PROP_CONTRAST, CV_CAP_PROP_SATURATION, CV_CAP_PROP_HUE,
CV_CAP_PROP_GAIN and CV_CAP_PROP_EXPOSURE.

12th patch: Apr 16, 2010, Filipe Almeida filipe.almeida@...
- CvCaptureCAM_V4L structure cleanup (no longer needs <PROPERTY>_{min,max,} variables)
- Introduction of v4l2_ctrl_range - minimum and maximum allowed values for v4l controls
- Allows seting up all Video4Linux properties through cvSetCaptureProperty using input values between
0.0 and 1.0
- Gets v4l properties first through v4l2_ioctl call (ignores capture->is_v4l2_device)
- cvGetCaptureProperty adjusted to support the changes
- Returns device properties to initial values after device closes

13th patch: Apr 27, 2010, Filipe Almeida filipe.almeida@...
- Solved problem mmaping the device using uvcvideo driver (use o v4l2_mmap instead of mmap)
make & enjoy!

14th patch: May 10, 2010, Filipe Almeida filipe.almeida@...
- Bug #142: Solved/Workaround "setting frame width and height does not work"
  There was a problem setting up the size when the input is a v4l2 device
  The workaround closes the camera and reopens it with the new definition
  Planning for future rewrite of this whole library (July/August 2010)

15th patch: May 12, 2010, Filipe Almeida filipe.almeida@...
- Broken compile of library (include "_highgui.h")

16th patch: October 10, 2011, Arne Krueger arne.krueger@...
- almost complete rewrite using only V4L2. All V4L1 fallback-code removed.
- Pinacle Dazzle type devices should work now under Ubuntu (testet on 11.04)
- min/max values queried from driver each time properties are set/retrieved
- frame-rate property implemented for setting, but untested due to unavailable hardware

*/

/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                        Intel License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of Intel Corporation may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#include "highgui.h"
#include "precomp.hpp"

#if !defined WIN32 && defined HAVE_LIBV4L

#define CLEAR(x) memset (&(x), 0, sizeof (x))

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <string.h>
#include <stdlib.h>
#include <asm/types.h>          /* for videodev2.h */
#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>

#ifdef HAVE_CAMV4L
#include <linux/videodev.h>
#endif
#ifdef HAVE_CAMV4L2
#include <linux/videodev2.h>
#endif

#include <libv4l2.h>

// Default requested frame size. These will be changed by the driver
#define DEFAULT_V4L_WIDTH  800
#define DEFAULT_V4L_HEIGHT 600
#define DEFAULT_V4L_PIXFMT V4L2_PIX_FMT_BGR24

#define MAX_CAMERAS 8

// default and maximum number of V4L buffers, not including last, 'special' buffer
#define MAX_V4L_BUFFERS 10
#define DEFAULT_V4L_BUFFERS 4

// if enabled, copies data from the buffer. this uses a bit more memory,
//  but much more reliable for some UVC cameras
#define USE_TEMP_BUFFER

// maximum expected length of device names a.k.a /dev/videoX
#define MAX_DEVICE_DRIVER_NAME 80

// structure of user space buffers mapped from driver memory 
struct buffer
{
  void *  start;
  size_t  length;
};

typedef struct CvCaptureCAM_V4L
{
    char* deviceName;	// name, usually /dev/videoX of video source 
    int deviceHandle;	// a file handle to the device

    int firstCapture;	// flag indicating that capturing has not yet started
	int width;
	int height;
	
    IplImage frame;		// most recently captured frame

	unsigned int  bufferIndex;	// index of the currently used buffer
	unsigned int  bufferCount;	// holds the number of granted buffers

	// array of memory mapped buffers. Depending on how many buffers the device
	// granted, only some of those are acutally used.
	buffer buffers[MAX_V4L_BUFFERS];
} CvCaptureCAM_V4L;

static void icvBuildIndexList_V4L();
static int icvBeginCapture_V4L(CvCaptureCAM_V4L* capture);
static int icvEndCapture_V4L(CvCaptureCAM_V4L* capture);
static void icvCloseCAM_V4L(CvCaptureCAM_V4L* capture);

static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture);
static IplImage* icvRetrieveFrameCAM_V4L(CvCaptureCAM_V4L* capture, int);
CvCapture* cvCreateCameraCapture_V4L(int index);

static double icvGetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id);
static int    icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, double value);
static int icvSetVideoSize_V4L(CvCaptureCAM_V4L* capture);
static int icvSetFrameRate_V4L(CvCaptureCAM_V4L* capture, double fps);

/***********************   Implementations  ***************************************/

// IOCTL handling for V4L2
static int xioctl( int fd, int request, void *arg)
{
  int r;

  do r = v4l2_ioctl (fd, request, arg);
  while (-1 == r && EINTR == errno);

  return r;
}

static int numCameras = 0;		  // total number of valid camera devices
static int indexMap[MAX_CAMERAS]; // remapping form camera index to valid device

// This function looks for valid camera devices /dev/videoX where X goes up to
// MAX_CAMERAS. The number of valid devices is stored in static numCameras. 
// Furthermore, to accomodate for unplugged devices a remapping table in static 
// indexMap is build. This is used to map the camera index passed to the 
// public interface function onto a valid device name.
//
// Consider the following setup:
//
// 	\dev\video0		-- valid camera device
//	\dev\video1		-- unplugged and no longer valid
//	\dev\video2		-- valid camera device
//
// icvBuildIndexList_V4L() will recognize 2 valid devices and store the count in
// numCameras, which gives an easy way of telling wether any camera is present.
// indexMap will hold the value {0, 2, -1, -1, ... }.  
static void icvBuildIndexList_V4L() 
{
	
	int deviceHandle;
	int cameraNumber;
	int index;
	char deviceName[MAX_DEVICE_DRIVER_NAME];
	
	// initialize indexMap with all invalid values
	for(index=0; index<MAX_CAMERAS; ++index)
		indexMap[index]=-1;
	
	index = 0;	// first element in indexMap relates to first valid cameraNumber

	// iterate over device names up to \dev\video{MAX_CAMERAS}
	for(cameraNumber=0; cameraNumber < MAX_CAMERAS; ++cameraNumber) {
  		// build device name string
		snprintf(deviceName, MAX_DEVICE_DRIVER_NAME, "/dev/video%1d", cameraNumber);

  		// try opening device in read-only mode. This should not disturb any
		// other user of the device.
  		deviceHandle = v4l2_open(deviceName, O_RDONLY);
		// if device handle is valid the device is counted and the device number 
		// stored in the next remapping slot.
		if (deviceHandle != -1) {
			indexMap[index] = cameraNumber;
			index++;
			numCameras++;

			// now close our handle on the device again
			v4l2_close(deviceHandle);
		}
	}
};

// Allocates buffers and finally enables streaming on the device. 
// The function returns 0 on failure and 1 otherwise. If the capture device is
// already running nothing is done and 1 returned.
static int icvBeginCapture_V4L(CvCaptureCAM_V4L* capture)
{
	// Need a valid pointer to start with
	if(NULL == capture) return 0;
	
	// Nothing to do if stream is already running
	if(0 == capture->firstCapture) return 1;

	int width;			// width of frame provided by device 
	int height;			// height of frame provided by device
	int bufferCount;	// number of granted memory buffers
	buffer buffers[MAX_V4L_BUFFERS + 1]; // memory mapped buffers
	int index;
	
	{ // check pixelformat capability of device

		struct v4l2_format fmt; // holds pixel format requested and reported back
		CLEAR(fmt);

		// fill struct with requested pixel format
		fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        fmt.fmt.pix.width       = capture->width;
        fmt.fmt.pix.height      = capture->height;
        fmt.fmt.pix.pixelformat = DEFAULT_V4L_PIXFMT;
        fmt.fmt.pix.field       = V4L2_FIELD_ANY;

		// try to set pixel format. If this fails the driver does not support 
		// negotiation of the pixelformat at all, which is bad.
		if(xioctl(capture->deviceHandle, VIDIOC_S_FMT, &fmt) == -1) {
			fprintf(stderr, "HIGHGUI ERROR: unable to negotiate pixelformat.\n");

			return 0;
		}

		// the driver reported back, at least. Lets check the report
		if (fmt.fmt.pix.pixelformat != DEFAULT_V4L_PIXFMT) {
            fprintf(stderr, "HIGHGUI ERROR: pixelformat not supported.\n");

			return 0;
        }
	
		// keep frame size for later stages of initialization
		width = fmt.fmt.pix.width;
		height = fmt.fmt.pix.height;
		
	} // end of pixelformat capability checking

	{ // negotiate memory mapped buffers

		struct v4l2_requestbuffers req; // holds buffer request information 
		CLEAR(req);

		
		req.count = DEFAULT_V4L_BUFFERS;
	    req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	    req.memory = V4L2_MEMORY_MMAP;

	    // send request to device and get a potentially altered structure back
	    // which informs how many buffers were actually granted. If this call
		// fails the driver does not support memory mapped buffers
	    if(xioctl(capture->deviceHandle, VIDIOC_REQBUFS, &req) == -1) {
			fprintf(stderr, "HIGHGUI ERROR: memory mapped buffers not supported.\n");
	        
			return 0;
		}
		
		// the driver reported back. The number of available buffers may be
		// smaller than the requested DEFAULT_V4L_BUFFERS or even larger if the
		// driver requires so. 
		if(req.count == 0) {
			fprintf(stderr, "HIGHGUI ERROR: insufficient driver memory.\n");
	        
			return 0;
		}
		// make sure the granted number of buffers does not exceed out capacity
		if(req.count > MAX_V4L_BUFFERS) {
			fprintf(stderr, "HIGHGUI ERROR: insufficient buffer memory.\n");
	        
			return 0;
		}

		bufferCount = req.count;
		
	} // end of buffer negotiation 

	{ // allocate and enqueue buffers 

		struct v4l2_buffer buf;	// holds details about allocated buffer
		CLEAR(buffers);

		for(index=0; index<bufferCount; ++index) {
			CLEAR(buf);
			buf.type        = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            buf.memory      = V4L2_MEMORY_MMAP;
            buf.index       = index;

			// send request to driver. If this one fails we have to clean up by
			// deallocating already allocated buffers
			if(xioctl(capture->deviceHandle, VIDIOC_QUERYBUF, &buf)==-1) {
				fprintf(stderr, "HIGHGUI ERROR: querying buffer failed.\n");

				// unmap already mapped buffers by looping the index to zero
				for (--index ;index >= 0; --index)
                	v4l2_munmap(buffers[index].start, buffers[index].length);

				return 0;
			}

			// the driver reported back, now store results in our local buffers
			// array and perform acutal mapping of memory
			buffers[index].length = buf.length;
            buffers[index].start = v4l2_mmap( NULL 		 
											, buf.length 
											, PROT_READ | PROT_WRITE
											, MAP_SHARED
											, capture->deviceHandle
											, buf.m.offset);
			
			// make sure mapping was successful before proceeding. Note that
			// buffers[index].start holds the result of call v4l2_mmap()
			if(MAP_FAILED == buffers[index].start) {
				fprintf(stderr, "HIGHGUI ERROR: mapping memory failed.\n");

				// unmap already mapped buffers by looping the index to zero
				for (--index ;index >= 0; --index)
                	v4l2_munmap(buffers[index].start, buffers[index].length);

				return 0;
			}
		}
	
		// -- buffers allocated, now enqueue --
	
		// loop over all allocated buffers and enqueue them for capturing
		for(index=0; index < bufferCount; ++index)	{

			CLEAR (buf);

			buf.type        = V4L2_BUF_TYPE_VIDEO_CAPTURE;
			buf.memory      = V4L2_MEMORY_MMAP;
			buf.index       = index;

			// send request to device. There is generally no reason for this 
			// call to fail.
			if (xioctl(capture->deviceHandle, VIDIOC_QBUF, &buf) == -1) {
				fprintf(stderr, "HIGHGUI ERROR: VIDIOC_QBUF failed.\n");

				return 0;
			}
		}
	} // end buffer allocation and enqueueing
	
	{ // enable streaming
		enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		if(xioctl(capture->deviceHandle, VIDIOC_STREAMON, &type) == -1) {
			fprintf(stderr, "HIGHGUI ERROR: failed to enable stream.\n");

			return 0;
		}
	} // device is streaming now
	
	{ // allocate frame for display 
	
		// free image data allocated for frame struct if necessary
		if (capture->frame.imageData)
			cvFree(&capture->frame.imageData);

		// initialize frame and allocate buffer for it
		cvInitImageHeader(&capture->frame,
		              cvSize(width, height),
		              IPL_DEPTH_8U, 3, IPL_ORIGIN_TL, 4);
		capture->frame.imageData = (char*)cvAlloc(capture->frame.imageSize);
		// check if frame allocation was successful
		if(capture->frame.imageData == NULL) {
			fprintf(stderr, "HIGHGUI ERROR: insufficient memory for frame.\n");
		
			return 0;
		}
	} // end display frame allocation
	
	
	capture->width = width;
	capture->height = height;
	capture->bufferCount = bufferCount;
	for(index=0; index<bufferCount; ++index)	
		capture->buffers[index] = buffers[index];
	capture->firstCapture = 0;	
	
	return 1;
	
} /* End icvBeginCapture_V4L */

// Dequeue and unmap all buffers, stop capturing. Nothing is done when the 
// device has not been started.
static int icvEndCapture_V4L(CvCaptureCAM_V4L* capture)
{
	// Need a valid pointer to start with
	if(NULL == capture) return 0;
	
	// Nothing to do if stream is already running
	if(1 == capture->firstCapture) return 1;

	// request driver to stop capturing. If this succeeds all memory buffers
	// are unlocked, too and can be unmapped then.
	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	if(xioctl(capture->deviceHandle, VIDIOC_STREAMOFF, &type)==-1) {
		fprintf(stderr, "HIGHGUI ERROR: unable to disable stream.\n");
	}

	// unmap all memory buffers. This frees associated memory
	unsigned int index;
	for (index = 0; index < capture->bufferCount; ++index) {
		v4l2_munmap(capture->buffers[index].start, capture->buffers[index].length);
	}
	
	capture->firstCapture = 1;
	
	return 1;
} /* End icvEndCapture_V4L */

// Open a camera device by index number and return handle to it. In case no 
// camera is present or the requested index exceeds the number of cameras 
// present, NULL is returned. Passing -1 as index argument returns the next
// available camera, if any.
//
// To clarify consider the following setup:
//
// 	\dev\video0		-- valid camera device
//	\dev\video1		-- unplugged and no longer valid
//	\dev\video2		-- valid camera device
//
// Calling icvCaptureFromCAM(0) or icvCaptureFromCAM(-1) will open \dev\video0
// whereas icvOpenDeviceByIndex(1) will open \dev\video2., since \dev\video1 has 
// been unplugged and is thus invalid.
//
// Two subsequent calls of icvCaptureFromCAM(-1) will first give \dev\video0
// and second \dev\video2.
static CvCaptureCAM_V4L * icvCaptureFromCAM_V4L (int index)
{
	static int autoindex = 0;	// holds the next index for automatic indexing

	// the following variables hold temporary values used while initalizing
	// the device. Some of those are later copied to the CvCaptureCAM_V4L 
	// returned by the function.
	int cameraNumber;	// camera device number
	char deviceName[MAX_DEVICE_DRIVER_NAME];
	int deviceHandle;	// file handle to camera device
	

	// if no cameras are present, first try to recount and rebuild index list
	if(numCameras <= 0) icvBuildIndexList_V4L();

	// if after icvBuildIndexList_V4L() still no cameras have been found, 
	// then assume none are present and bail out
	if(numCameras <= 0) return NULL;

	// are we requested to automatically determine next index, or are given
	// a specific index number to open
	if(index < 0) {	

		// automatic index determination
		index = autoindex;
		
		// next call icvOpenDeviceByIndex_V4L(-1) will get next valid camera,
		// however make sure autoindex is always in valid range. In case of 
		// overflow restart at index 0.
		if(++autoindex >= MAX_CAMERAS) autoindex=0;
	}
	else {
		// specific index given. Check for valid range
		if(index >= numCameras) return NULL;
	}
	
	cameraNumber = indexMap[index]; // get camera number by index
	
	// check if we got a valid camera number at the given index position. Note
	// that index now may hold a automatically determined value. 
	if(cameraNumber < 0) return NULL;

	// build device name string by taking device number from mapping table
	snprintf(deviceName, MAX_DEVICE_DRIVER_NAME, "/dev/video%1d", cameraNumber);

	// try opening device. If this fails the device is not V4L2 capable and we
	// bail out. 
	deviceHandle = v4l2_open (deviceName, O_RDWR /* required */ | O_NONBLOCK, 0);
	if(deviceHandle <= 0)
		return NULL;

	{ // check for video capture capability of device

		struct v4l2_capability cap;	// holds capabilities reported by driver
		CLEAR (cap); // clear prior to use 

		// query driver for its capabilites. If this fails we dont have V4L2
		// device here. Close the handle and bail out.
		if(xioctl(deviceHandle, VIDIOC_QUERYCAP, &cap) == -1) {
			fprintf(stderr, "HIGHGUI ERROR: unable to ioctl VIDIOC_QUERYCAP. Not a v4l2 device.\n");
			
			v4l2_close(deviceHandle);
			return NULL;
		}

		// the driver reported back, now check if video capture is possible.
		if(!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
			fprintf(stderr, "HIGHGUI ERROR: device is not capture capable.\n");
			
			v4l2_close(deviceHandle);
			return NULL;
		}
	} // end of capture capability checking

	// -- following this point we assume a valid V4L2 capture device --

	// allocate camera handle structure
	CvCaptureCAM_V4L * capture = (CvCaptureCAM_V4L*)cvAlloc(sizeof(CvCaptureCAM_V4L));
	if (!capture) {
		fprintf( stderr, "HIGHGUI ERROR: V4L: Could not allocate memory for capture process.\n");
		return NULL;
	}
	// clear all memory in handle structure and fill with defaults and other
	// already known values
	memset(capture, 0, sizeof(CvCaptureCAM_V4L));
	capture->deviceName = strdup(deviceName);
	capture->deviceHandle = deviceHandle;
	capture->width = DEFAULT_V4L_WIDTH;
	capture->height = DEFAULT_V4L_HEIGHT;
	capture->frame.imageData = NULL;
	capture->firstCapture = 1;
	
	return capture;
}; /* End icvOpenCAM_V4L */

static int icvGrabFrameCAM_V4L(CvCaptureCAM_V4L* capture) 
{
	struct v4l2_buffer buf; // holds information about a memory buffer

	// before frames can be grabbed capturing should obviously be started first.
	if(icvBeginCapture_V4L(capture) == 0) {
		fprintf(stderr, "HIGHGUI ERROR: failed to start capturing.\n");
		return 0;
	}
	
	fd_set fds;			// file descriptor set; used by select()
    struct timeval tv;	// timeout
    int ret;

	// this infinite loop is only exited once a frame was grabbed
	for(;;) {

		// wait until a frame is available, but maximum 2 seconds
		do {
			FD_ZERO(&fds);
			FD_SET(capture->deviceHandle, &fds);

			/* Set timeout for each loop iteration */
			tv.tv_sec = 2;
			tv.tv_usec = 0;

			ret = select(capture->deviceHandle+1, &fds, NULL, NULL, &tv);
		} while ((ret == -1 && (errno = EINTR)));
		if(-1 == ret) {
		    fprintf(stderr, "HIGHGUI ERROR: select() failed.\n");
		    return 0;
		}
		if(0 == ret) {
			fprintf(stderr, "HIGHGUI ERROR: select() timeout occured.\n");
		    return 0;
		}

		// -- prepare to dequeue a buffer from the driver --

		CLEAR(buf);
	
		buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		buf.memory = V4L2_MEMORY_MMAP;

		// get buffer from driver. There should be one ready now, because select()
		// returned before.
		if(xioctl(capture->deviceHandle, VIDIOC_DQBUF, &buf)==-1) {
			// when error EAGAIN occured during xioctl() then do not leave the
			// infinite loop but try again
			if(errno == EAGAIN) continue;

			// otherwise break 
			fprintf(stderr, "HIGHGUI ERROR: VIDIOC_DQBUF failed.\n");
		    return 0;
		}

		// the driver reports back the buffer index; store it 
		capture->bufferIndex = buf.index;
	
		// enqueue buffer again
		if(xioctl (capture->deviceHandle, VIDIOC_QBUF, &buf)==-1) {
			fprintf(stderr, "HIGHGUI ERROR: VIDIOC_QBUF failed.\n");
		    return 0;
		}
		
		// once we reach this point and thus haven't restarted the loop due to
		// some condition (continue) or exited earlier, all is good.
		break;
	}

	return(1);
} /* End icvGrabFrameCAM_V4L */

static IplImage* icvRetrieveFrameCAM_V4L(CvCaptureCAM_V4L* capture, int) 
{
	// check if bufferIndex is inside valid range and the buffer is acutually
	// used, which is indicated by a non-NULL start pointer
	if((capture->bufferIndex < capture->bufferCount) && 
	   (capture->buffers[capture->bufferIndex].start) ) 
	{
		// copy contents of buffer to frame
		memcpy(
			(char*)capture->frame.imageData /* destination */,					 
			(char*)capture->buffers[capture->bufferIndex].start /* source */, 
			capture->frame.imageSize);
	}

	return(&capture->frame);
} /* End icvRetrieveFrameCAM_V4L */

static double icvGetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id) 
{
	struct v4l2_control ctrl; 	// holds the value of a requested property
	struct v4l2_queryctrl qctrl;// holds information about a requested property
	struct v4l2_format fmt;		// holds information on pixelformat
	char name[32];	   // holds plain-text name of property for error messages

	CLEAR(ctrl);
	CLEAR(qctrl);
	CLEAR(fmt);
	
	// depending on the requested property, setup id field of struct as well as
	// the plain-text name.
	//
	// frame size is handled a bit differently. We ask the driver for its
	// current pixelformat, which contains the frame size
	switch (property_id) {
	case CV_CAP_PROP_FRAME_WIDTH:	
	case CV_CAP_PROP_FRAME_HEIGHT:
		fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		
		// send format request so driver. If this fails the driver does not 
		// support the request. This is unlikely.
		if(xioctl(capture->deviceHandle, VIDIOC_G_FMT, &fmt) == -1) {
			fprintf(stderr, "HIGHGUI ERROR: failed to get frame size.\n");
			
			return -1;
		}
		
		// the driver reported back. Now struct fmt.pix contains the frame size
		return (property_id == CV_CAP_PROP_FRAME_WIDTH) ? fmt.fmt.pix.width : fmt.fmt.pix.height;
	
	case CV_CAP_PROP_BRIGHTNESS:
		snprintf(name, sizeof(name), "Brightness");
      	ctrl.id = qctrl.id = V4L2_CID_BRIGHTNESS;
      	break;
	case CV_CAP_PROP_CONTRAST:
	  	snprintf(name, sizeof(name), "Contrast");
      	ctrl.id = qctrl.id = V4L2_CID_CONTRAST;
      	break;
	case CV_CAP_PROP_SATURATION:
	  	snprintf(name, sizeof(name), "Saturation");
      	ctrl.id = qctrl.id = V4L2_CID_SATURATION;
      	break;
	case CV_CAP_PROP_HUE:
	  	snprintf(name, sizeof(name), "Hue");
      	ctrl.id = qctrl.id = V4L2_CID_HUE;
      	break;
	case CV_CAP_PROP_GAIN:
	  	snprintf(name, sizeof(name), "Gain");
      	ctrl.id = qctrl.id = V4L2_CID_GAIN;
      	break;
	case CV_CAP_PROP_EXPOSURE:
	  	snprintf(name, sizeof(name), "Exposure");
      	ctrl.id = qctrl.id = V4L2_CID_EXPOSURE;
      	break;
	default:
	  	snprintf(name, sizeof(name), "<Unknown>");
      	ctrl.id = qctrl.id = property_id;
	}
	
	// send property-get request to driver. If this call fails the driver either
	// doesn't know the property or is not a valid V4L2 driver.
	if(xioctl(capture->deviceHandle, VIDIOC_G_CTRL, &ctrl) == -1) {
		fprintf(stderr, "HIGHGUI ERROR: failed to get %s (%u).\n", name, property_id);
		
		return -1;
	}
	
	// now that we have the value, try to get it scaled by retreiving the min
	// and max values from the driver. 
	if(xioctl(capture->deviceHandle, VIDIOC_QUERYCTRL, &qctrl) == -1) {
		fprintf(stderr, "HIGHGUI ERROR: failed to scale %s (%u).\n", name, property_id);
		
		return -1;
	}
	
	// scale value to range 0...1 and return
	return (((double)ctrl.value - qctrl.minimum)/(qctrl.maximum - qctrl.minimum));
}

static int icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, double value)
{
	struct v4l2_control ctrl; 	// holds the value of a requested property
	struct v4l2_queryctrl qctrl;// holds information about a requested property
	char name[32];	   // holds plain-text name of property for error messages

	CLEAR(ctrl);
	CLEAR(qctrl);
	
	// depending on the requested property, setup id field of struct as well as
	// the plain-text name.
	//
	// frame size is set in two steps. First set either height/width, which 
	// possibly will fail, then set the respective other parameter. The second
	// might possibly succeed. Both calls require closing and reopending the
	// device, though.
	switch (property_id) {
	case CV_CAP_PROP_FRAME_WIDTH:
		capture->width = value;
		return icvSetVideoSize_V4L(capture);
	case CV_CAP_PROP_FRAME_HEIGHT:
		capture->height = value;
		return icvSetVideoSize_V4L(capture);
	case CV_CAP_PROP_BRIGHTNESS:
		snprintf(name, sizeof(name), "Brightness");
      	ctrl.id = qctrl.id = V4L2_CID_BRIGHTNESS;
      	break;
	case CV_CAP_PROP_CONTRAST:
	  	snprintf(name, sizeof(name), "Contrast");
      	ctrl.id = qctrl.id = V4L2_CID_CONTRAST;
      	break;
	case CV_CAP_PROP_SATURATION:
	  	snprintf(name, sizeof(name), "Saturation");
      	ctrl.id = qctrl.id = V4L2_CID_SATURATION;
      	break;
	case CV_CAP_PROP_HUE:
	  	snprintf(name, sizeof(name), "Hue");
      	ctrl.id = qctrl.id = V4L2_CID_HUE;
      	break;
	case CV_CAP_PROP_GAIN:
	  	snprintf(name, sizeof(name), "Gain");
      	ctrl.id = qctrl.id = V4L2_CID_GAIN;
      	break;
	case CV_CAP_PROP_EXPOSURE:
	  	snprintf(name, sizeof(name), "Exposure");
      	ctrl.id = qctrl.id = V4L2_CID_EXPOSURE;
      	break;
    case CV_CAP_PROP_FPS:
    	return icvSetFrameRate_V4L(capture, value);
	default:
	  	snprintf(name, sizeof(name), "<Unknown>");
      	ctrl.id = qctrl.id = property_id;
	}
	
	// try to get the upper and lower bound of the property to scale the value 
	if(xioctl(capture->deviceHandle, VIDIOC_QUERYCTRL, &qctrl) == -1) {
		fprintf(stderr, "HIGHGUI ERROR: failed to obtain scale %s (%u).\n", name, property_id);
		
		return 0;
	}
	
	// scale the input value
	ctrl.value = value*(qctrl.maximum - qctrl.minimum) + qctrl.minimum;
	// some sanity checking on the input value to clamp it into min/max range
	ctrl.value = (ctrl.value > qctrl.maximum) ? qctrl.maximum : ctrl.value;
	ctrl.value = (ctrl.value < qctrl.minimum) ? qctrl.minimum : ctrl.value;
	
	// send scaled property value to driver
	if(xioctl(capture->deviceHandle, VIDIOC_S_CTRL, &ctrl) == -1) {
		fprintf(stderr, "HIGHGUI ERROR: failed to set %s (%u).\n", name, property_id);
		
		return 0;
	}
	
	return 1;
}

// Set video size involves closing and reopening the device in case capturing
// has already started.
static int icvSetVideoSize_V4L(CvCaptureCAM_V4L* capture)
{
	// if capturing has already started, we need to close and later reopen the
	// device. Otherwise we do not need to take any further action because the
	// frame parameters are only applied once capturing starts.
	if(0 == capture->firstCapture) {
		icvCloseCAM_V4L(capture);

		// reopen device with name stored in capture struct
		capture->deviceHandle = v4l2_open(capture->deviceName, O_RDWR | O_NONBLOCK, 0);
		if(capture->deviceHandle <= 0) {
			fprintf(stderr, "HIGHGUI ERROR: failure reopening device.");
			
			return 0;
		}
		
		capture->firstCapture=1;
	}
	
	return 1;
}

// 
static int icvSetFrameRate_V4L(CvCaptureCAM_V4L* capture, double fps)
{
	struct v4l2_streamparm param;
	CLEAR(param);
	
	param.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	
	
	// get capture capabilities from device
	if(xioctl(capture->deviceHandle, VIDIOC_G_PARM, &param) == -1) {
		fprintf(stderr, "HIGHGUI ERROR: failed to get capture parameters.\n");
		
		return 0;
	}
	
	// the driver reported back. Check if it is capable of setting the frame
	// rate. If V4L2_CAP_TIMEPERFRAME is not set, this is not the case and we
	// can quit here.
	if((param.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) == 0) {
		fprintf(stderr, "HIGHGUI ERROR: device does not support changing frame rate.\n");
		
		return 0;
	}
	
	// the driver reported it supports setting the frame rate. Note that V4L
	// uses timer-per-frame	
	param.parm.capture.timeperframe.numerator = 1;
	param.parm.capture.timeperframe.denominator = fps;
	// send to driver..
	if(xioctl(capture->deviceHandle, VIDIOC_S_PARM, &param) == -1) {
		fprintf(stderr, "HIGHGUI ERROR: failed to set frame rate.\n");
		
		return 0;
	}
	
	return 1;
}

// free all allocated memory, unmap all buffers and close device handle. The 
// device handle is reset to value -1 to indicate the device being closed. 
static void icvCloseCAM_V4L(CvCaptureCAM_V4L* capture)
{
	// a very crude check if the passed pointer is valid
	if(capture) {
	
		// deallocate and unmap buffers
		icvEndCapture_V4L(capture);
		
		// close device handle
		if (capture->deviceHandle != -1) {
			v4l2_close(capture->deviceHandle);
			capture->deviceHandle = -1;
		}

		// free image data allocated for frame struct
		if (capture->frame.imageData)
			cvFree(&capture->frame.imageData);
	}
};

class CvCaptureCAM_V4L_CPP : CvCapture
{
public:
    CvCaptureCAM_V4L_CPP() { captureV4L = 0; }
    virtual ~CvCaptureCAM_V4L_CPP() { close(); }

    virtual bool open( int index );
    virtual void close();

    virtual double getProperty(int);
    virtual bool setProperty(int, double);
    virtual bool grabFrame();
    virtual IplImage* retrieveFrame(int);
protected:

    CvCaptureCAM_V4L* captureV4L;
};

bool CvCaptureCAM_V4L_CPP::open( int index )
{
    close();
    captureV4L = icvCaptureFromCAM_V4L(index);
    return captureV4L != 0;
}

void CvCaptureCAM_V4L_CPP::close()
{
    if( captureV4L )
    {
        icvCloseCAM_V4L( captureV4L );
        cvFree( &captureV4L );
    }
}

bool CvCaptureCAM_V4L_CPP::grabFrame()
{
    return captureV4L ? icvGrabFrameCAM_V4L( captureV4L ) != 0 : false;
}

IplImage* CvCaptureCAM_V4L_CPP::retrieveFrame(int)
{
    return captureV4L ? icvRetrieveFrameCAM_V4L( captureV4L, 0 ) : 0;
}

double CvCaptureCAM_V4L_CPP::getProperty( int propId )
{
    return captureV4L ? icvGetPropertyCAM_V4L( captureV4L, propId ) : 0.0;
}

bool CvCaptureCAM_V4L_CPP::setProperty( int propId, double value )
{
    return captureV4L ? icvSetPropertyCAM_V4L( captureV4L, propId, value ) != 0 : false;
}

CvCapture* cvCreateCameraCapture_V4L( int index )
{
    CvCaptureCAM_V4L_CPP* capture = new CvCaptureCAM_V4L_CPP;

    if( capture->open( index ))
        return (CvCapture*)capture;

    delete capture;
    return 0;
}

#endif // !defined WIN32 && defined HAVE_LIBV4L
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
Sergej Pupykin | 5 Oct 16:27 2011
Picon

Re: class True/False in flann

At Wed, 5 Oct 2011 15:44:52 +0200,
Stefan Walk <stefan.walk@...> wrote:
> 
> The class identifiers are not the problem (they are namespaced so
> they are not in the global namespace), the defines are - just #undef
> the defines before including the opencv header.

Thanks, I solve this by #undef and #define it back then.

True and False defined in X11/Xlib.h. May be it would be better to put
some workaround into opencv?

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
Sergej Pupykin | 5 Oct 15:13 2011
Picon

class True/False in flann


Hello,

I can not build http://gmic.sourceforge.net/ with opencv because of

/usr/include/opencv2/flann/dist.h

contains

class True
{
};

class False
{
};

True and False are defines in other header. How can I solve this?

It is strange using of common words as class identifiers.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
ale-ivan | 15 Sep 11:21 2011
Picon

Detection of heads from top-view camera


Hello,
I have a camera set up on a ceiling , capturing people standing in line. I
need to count the amount of people. Currently I do that with background
subtraction and Hough transform. The detector works well for contrast heads,
but if hear color is close to the cloth color, the performance is poor. Any
advices would be greatly appreciated. 
http://old.nabble.com/file/p32380283/1.png 1.png 
--

-- 
View this message in context: http://old.nabble.com/Detection-of-heads-from-top-view-camera-tp32380283p32380283.html
Sent from the opencvlibrary-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
Josh Bleecher Snyder | 2 Aug 01:21 2011
Picon

Explanation of constants in template matching

Hi,

I'm trying to understand the template matching implementation, and I
was hoping someone might be able to give me some hints about these two
constants:

    const double blockScale = 4.5;
    const int minBlockSize = 256;

There are no comments, and looking back through the svn history at
commit messages didn't yield anything. I understand well enough (I
think) what impact they have on the subsequent code, but I don't quite
understand where these particular values come from, nor what impact
changing them might have. Any insight would be appreciated.

Thanks,
Josh

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
Aric Ben Zvi | 1 Aug 18:59 2011
Picon

bug : Find_obj.c memory storage allocation

Hello,

 

I am new at this list.

 

I run the find_obj.cpp example located at: \OpenCV2.3\opencv\samples\c\ and found a bug in the memory storage allocation.

 

The allocation at line 227, allocate the default memory size of 64Kbytes.

    CvMemStorage* storage = cvCreateMemStorage(0);

 

Howver the size of the seqances (objectKeypoints, objectDescriptors, imageKeypoints, imageDescriptors) recived form the cvExtractSURF function is much larger.

(593*24+593*512+299*24+299*512+Sturctures+headers >  466Kbyte).

 

Therefore I suggest ot change the memory allocation in line 277 to:

    CvMemStorage* storage = cvCreateMemStorage(0x100000); //1MByte

 

 

Please update the example file.

Best Regards

 

Aric

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
Gary Bradski | 27 Jul 01:07 2011
Picon

I have temporarily suspended accounts on the OpenCV Wiki

I just cleaned up a ton of spam and so have temporarily suspended new accounts on the OpenCV wiki until we can put in an account approval system.

I've also been deleting spam accounts (you go to settings, switch user.  Then change their password.  Then go to preferences. Change their email, add some "ddd" in front of their user name to indicate its' been deleted and mark the check box to disable the account forever).

Who is yvopub ?  I accidently changed that password. It's now OpenCV

Gary

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
Nghia Ho | 17 Jul 02:23 2011
Picon

Build problems with 2.3.0 on Windows

When trying to build on Windows using MSVC2005 and MSVC200 (either 32 or 64bit) I get this:

i>------ Skipped Build: Project: uninstall, Configuration: Release Win32
------
1>Project not selected to build for this solution configuration
2>------ Skipped Build: Project: INSTALL, Configuration: Release Win32
------
2>Project not selected to build for this solution configuration
3>------ Skipped Build: Project: PACKAGE, Configuration: Release Win32
------
3>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 0 failed, 122 up-to-date, 3 skipped

On closer inspection all the lib/dll are built correctly. The problem is the INSTALL project looks for opencv_ffmpeg230d.dll (and possibly opencv_ffmpeg230d.lib), which are not suppose to exist? As a result, the build script does not finish and does not create the 'include' directory correctly, missing all the opencv/opencv2 headers. I got it working by downloading the Windows Superpack and manually copying the header files over.

There is another user on the OpenCV yahoo user group that reports this problem.

Nghia
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev

Gmane