I am trying to capture stero images from Point Grey Bumblebee2 camera using libdc1394. Can some one share sample program for stereo images. I already seen the examples from libdc1394 to grab a simple images.
Hello Shah,
-----------------------------------------------------------------
// header
void create3D();
void set3D();
IDirect3D9 *_d3d;
IDirect3DDevice9 *_d3ddev;
QSize _size; // full screen size
IDirect3DSurface9 *_imageBuf; //Source stereo image
IDirect3DSurface9 *_backBuf;
--------------------------------------------------------
// the code
#include
#pragma comment (lib, "d3d9.lib")
#define NVSTEREO_IMAGE_SIGNATURE 0x4433564e //NV3D
typedef struct _Nv_Stereo_Image_Header
{
unsigned int dwSignature;
unsigned int dwWidth;
unsigned int dwHeight;
unsigned int dwBPP;
unsigned int dwFlags;
} NVSTEREOIMAGEHEADER, *LPNVSTEREOIMAGEHEADER;
// ORedflags in the dwFlagsfielsof the _Nv_Stereo_Image_Headerstructure above
#define SIH_SWAP_EYES 0x00000001
#define SIH_SCALE_TO_FIT 0x00000002
// call at start to set things up
void DisplayWidget::create3D()
_size = QSize(1680,1050); //resolution of my Samsung 2233z
_d3d = Direct3DCreate9(D3D_SDK_VERSION); // create the Direct3D interface
D3DPRESENT_PARAMETERS d3dpp; // create a struct to hold various device information
ZeroMemory(&d3dpp, sizeof(d3dpp)); // clear out the struct for use
d3dpp.Windowed = FALSE; // program fullscreen
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // discard old frames
d3dpp.hDeviceWindow = winId(); // set the window to be used by Direct3D
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; // set the back buffer format to 32 bit // or D3DFMT_R8G8B8
d3dpp.BackBufferWidth = _size.width();
d3dpp.BackBufferHeight = _size.height();
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
d3dpp.BackBufferCount = 1;
// create a device class using this information and information from the d3dpp stuct
_d3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
winId(),
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&_d3ddev);
//3D VISION uses a single surface 2x images wide and image high
// create the surface
_d3ddev->CreateOffscreenPlainSurface(_size.width()*2, _size.height(), D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &_imageBuf, NULL);
set3D();
}
// call to put 3d signature in image
void DisplayWidget::set3D()
// Lock the stereo image
D3DLOCKED_RECT lock;
_imageBuf->LockRect(&lock,NULL,0);
// write stereo signature in the last raw of the stereo image
LPNVSTEREOIMAGEHEADER pSIH = (LPNVSTEREOIMAGEHEADER)(((unsigned char *) lock.pBits) + (lock.Pitch * (_size.height()-1)));
// Update the signature header values
pSIH->dwSignature = NVSTEREO_IMAGE_SIGNATURE;
pSIH->dwBPP = 32;
//pSIH->dwFlags = SIH_SWAP_EYES; // Src image has left on left and right on right, thats why this flag is not needed.
pSIH->dwFlags = SIH_SCALE_TO_FIT;
pSIH->dwWidth = _size.width() *2;
pSIH->dwHeight = _size.height();
// Unlock surface
_imageBuf->UnlockRect();
// call in display loop
void DisplayWidget::paintEvent()
// clear the window to a deep blue
//_d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);
_d3ddev->BeginScene(); // begins the 3D scene
// do 3D rendering on the back buffer here
RECT destRect;
destRect.left = 0;
destRect.top = 0;
destRect.bottom = _size.height();
destRect.right = _size.width();
// Get the Backbuffer then Stretch the Surface on it.
_d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &_backBuf);
_d3ddev->StretchRect(_imageBuf, NULL, _backBuf, &destRect, D3DTEXF_NONE);
_backBuf->Release();
_d3ddev->EndScene(); // ends the 3D scene
_d3ddev->Present(NULL, NULL, NULL, NULL); // displays the created frame
// my images come from a camera
// _left and _right are QImages but it should be obvious what the functions do
void DisplayWidget::getImages()
RECT srcRect;
srcRect.left = 0;
srcRect.top = 0;
srcRect.bottom = _size.height();
srcRect.right = _size.width();
if ( isOdd() ) {
destRect.left = _size.width();
destRect.right = _size.width()*2;
// get camera data for _left here, code not shown
D3DXLoadSurfaceFromMemory(_imageBuf, NULL, &destRect,_right.bits(),D3DFMT_A8R8G8B8,_right.bytesPerLine(),NULL,&srcRect,D3DX_DEFAULT,0);
} else {
// get camera data for _right here, code not shown
D3DXLoadSurfaceFromMemory(_imageBuf, NULL, &destRect,_left.bits(),D3DFMT_A8R8G8B8,_left.bytesPerLine(),NULL,&srcRect,D3DX_DEFAULT,0);
set3D(); // add NVidia signature
DisplayWidget::~DisplayWidget()
_d3ddev->Release(); // close and release the 3D device
_d3d->Release(); // close and release Direct3D
http://sourceforge.net/projects/libnvstusb/
Thank you for the answer. I will check if it works.
Enclosed text files may give another idea. All the best.
Hiiiii everyone! I have an enquiry on statistical analysis. I was looking for many forum and it's still cannot solve my problem. I want to compare means of two groups of data but only with two...
03 March 2021 8,796 3 View
I would like to create a small guide containing the meanings of the names .. Thanks to everyone who cooperates with me in achieving it.
03 March 2021 5,266 4 View
02 March 2021 932 1 View
Is There Any Feasible Method To Test The Efficiency Of Fluorescent Compounds Other Than UV Spectrometers ? Suggestions Would Be Appreciated !
02 March 2021 5,785 3 View
How to do Piezoelectric coupling in ANSYS-APDL or COMSOL between tapered substrate and rectangular piezoelectric patch? Piezoelectric coupling between the rectangular substrate and rectangular...
02 March 2021 9,833 3 View
I am going to have 3 different probes in my qPCR work that I am going to do. But I realized that the machine we have in the lab is a Rotor-Gene Q 2plex HRM Platform, saying it has green, yellow,...
01 March 2021 8,544 1 View
Is the electropolymerisation of polyaniline coating over stainless steel (SS) via Cyclic voltammetry technique is really adherant? Else how to improve the adhesion of the coating, whether any...
01 March 2021 8,220 2 View
I have created an Ice 1h crystalline structure and an Aluminium substrate structure and equilibrated both at 250K. Now I need to bring them together in a way that an adhesive bond is created....
01 March 2021 3,325 2 View
Does anyone have the experience of using Taq Man probes in the QIAGEN Rotar- Gene qPCR machine?
01 March 2021 5,311 1 View
01 March 2021 7,254 3 View
I have selected brain tumor images ...but now found that already lots of research done n this topic.
03 March 2021 5,774 3 View
i am try to classify the x-ray images. During classification , can i block unwanted images (except x-ray image).
03 March 2021 7,100 1 View
Need to image mesoporous silica nanoparticles using the TEM. Also, need high resolution TEM images to see the mesoporous structure. Kindly suggest what kind of grids to use. Thanks, Shatadru
02 March 2021 1,787 2 View
Dear Colleagues, After running Western blot on PVDF membrane and detection using ECL, I would like to stain my PVDF with colloidal gold to be able to allign the ECL image with total proteins on...
02 March 2021 7,829 3 View
I would like to research on MR images (0.5T and 3T). Can you please suggest some websites that I can download dataset including both 0.5T and 3T MR images? Thank you.
02 March 2021 7,735 3 View
Hello, I have classified 10 S3 OLCI images from the same area (althouth not the same size and/or quadrant) and I would like to do a final image using the mode of the pixel of these 10 images. I...
01 March 2021 9,874 3 View
Hi everyone, I am using Fiji to determine the percentage of the image covered by leaves, branches, or trunk, but i've encountered some difficulty when the sun hits parts of my image like the one...
27 February 2021 1,194 3 View
Hello. I have a problem with the charting in google earth engine. I created an image collection by combining 5 image collections of five parameters and using ee.Join.inner ( ) and .apply ( )...
26 February 2021 7,084 2 View
Hi, We culture neural progenitor cells in T175 culture flasks coated with PLO-Laminin. We have successfully grown these cells with our protocol for months. Recently, we observed large sheets...
25 February 2021 3,443 4 View
24 February 2021 3,348 2 View