[IGSTK-Users] Video frame spatial object
Fabian Torres
fabian.trobles at gmail.com
Mon Feb 17 14:27:00 EST 2014
Hi.
I´m trying to use the videoframespatialobject class, with an epiphan
dvi2usb card (http://www.epiphan.com/products/frame-grabbers/dvi2usb-3-0/)
I biuld a class that has igstk::videoimager as parent to configure my card,
I´m able to extract frames and save them in jpg, bmp and so on.
The problem come when I try to display the frame grabber video using
igstkVideoimager and igstkVideoImagerTool.
I´m gettin images in grayscale of 8 bits, so I configure my
VideoFrameObjectType like this
typedef igstk::VideoFrameSpatialObject<unsigned char, 1>
VideoFrameObjectType;
VideoFrameObjectType::Pointer m_VideoFrame = VideoFrameObjectType::New();
m_VideoFrame->SetWidth(640);
m_VideoFrame->SetHeight(480);
m_VideoFrame->SetPixelSizeX(1);
m_VideoFrame->SetPixelSizeY(1);
m_VideoFrame->SetNumberOfScalarComponents(1);
m_VideoFrame->Initialize();
and my videoimager and videoimagertool like this
typedef igstk::VideoFrameRepresentation<VideoFrameObjectType>
VideoFrameRepresentationType;
VideoFrameRepresentationType::Pointer m_VideoFrameRepresentation =
VideoFrameRepresentationType::New();
m_VideoFrameRepresentation->RequestSetVideoFrameSpatialObject(m_VideoFrame);
m_GUI->View->RequestAddObject(m_VideoFrameRepresentation);
igstk::EpiphanVideoImager::Pointer videoImager =
igstk::EpiphanVideoImager::New();
videoImager->RequestSetFrequency(VideoImager_DEFAULT_REFRESH_RATE);
videoImager->RequestOpen();
igstk::VideoImagerTool::Pointer videoImagerTool;
igstk::EpiphanVideoImagerTool::Pointer videoImagerEpiphanTool =
igstk::EpiphanVideoImagerTool::New();
unsigned int dims[3];
dims[0] = 640;
dims[1] = 480;
dims[2] = 1;
videoImagerEpiphanTool->SetFrameDimensions(dims);
videoImagerEpiphanTool->SetPixelDepth(8);
videoImagerEpiphanTool->RequestSetVideoImagerToolName("Frame grabber");
videoImagerEpiphanTool->RequestConfigure();
I´m able to see the image in an igstk scene, the prblem is I se a binary
image (black and white) instead of a gray scale image, I do not know what
is the problem.
In my igstk::EpihanVideoImager class there is a part that copy the grabbed
frame data to the igstk::VideoFrame, could I make a mistake here?
typedef igstk::Frame FrameType;
FrameType* frame = new FrameType();
frame = this->GetVideoImagerToolFrame(
imagerToolContainer[deviceItr->first]);
unsigned int frameDims[3];
imagerToolContainer[deviceItr->first]->GetFrameDimensions(frameDims);
EpiphanVideoImager::m_FrameBufferLock->Lock();
if( frameBuffer != NULL)
{
int numberOfBytesToSkip;
numberOfBytesToSkip = 0;
unsigned char* byteImageDataPtr=reinterpret_cast<unsigned
char*>(frameBuffer->pixbuf);
memcpy(frame->GetImagePtr(),
byteImageDataPtr,
frameDims[0]*frameDims[1]*frameDims[2]);
}
}
I hope someone could help me. Thanks
--
Fabián Torres Robles
Maestria en Ciencias en Ingeniería Electrónica
Ingeniería en Sistemas Electrónicos
tel. 58081280, 0445534661338
e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20140217/4fc8b57f/attachment.html>
More information about the IGSTK-Users
mailing list