<div dir="ltr">Hi. <div><br></div><div>I´m trying to use the videoframespatialobject class, with an epiphan dvi2usb card (<a href="http://www.epiphan.com/products/frame-grabbers/dvi2usb-3-0/">http://www.epiphan.com/products/frame-grabbers/dvi2usb-3-0/</a>)</div>
<div><br></div><div>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.</div><div><br></div><div>The problem come when I try to display the frame grabber video using igstkVideoimager and igstkVideoImagerTool.</div>
<div><br></div><div>I´m gettin images in grayscale of 8 bits, so I configure my VideoFrameObjectType like this</div><div><br></div><div><div>typedef igstk::VideoFrameSpatialObject<unsigned char, 1> </div><div><span class="" style="white-space:pre"> </span>VideoFrameObjectType;</div>
</div><div><br></div><div> VideoFrameObjectType::Pointer m_VideoFrame = VideoFrameObjectType::New();</div><div> m_VideoFrame->SetWidth(640);</div><div> m_VideoFrame->SetHeight(480);</div><div> m_VideoFrame->SetPixelSizeX(1);</div>
<div> m_VideoFrame->SetPixelSizeY(1);</div><div> m_VideoFrame->SetNumberOfScalarComponents(1);</div><div> m_VideoFrame->Initialize(); </div><div><br></div><div>and my videoimager and videoimagertool like this</div>
<div><br></div><div><div> typedef igstk::VideoFrameRepresentation<VideoFrameObjectType></div><div><span class="" style="white-space:pre"> </span>VideoFrameRepresentationType;</div><div><br></div><div> VideoFrameRepresentationType::Pointer m_VideoFrameRepresentation = VideoFrameRepresentationType::New();</div>
<div> m_VideoFrameRepresentation->RequestSetVideoFrameSpatialObject(m_VideoFrame);</div><div><br></div><div> m_GUI->View->RequestAddObject(m_VideoFrameRepresentation);</div><div><br></div><div> igstk::EpiphanVideoImager::Pointer videoImager = igstk::EpiphanVideoImager::New();</div>
<div> videoImager->RequestSetFrequency(VideoImager_DEFAULT_REFRESH_RATE);</div><div> videoImager->RequestOpen();</div><div><br></div><div> igstk::VideoImagerTool::Pointer videoImagerTool;</div><div> igstk::EpiphanVideoImagerTool::Pointer videoImagerEpiphanTool = igstk::EpiphanVideoImagerTool::New();</div>
<div><br></div><div> unsigned int dims[3];</div><div> dims[0] = 640;</div><div> dims[1] = 480;</div><div> dims[2] = 1;</div><div><br></div><div> videoImagerEpiphanTool->SetFrameDimensions(dims);</div><div> videoImagerEpiphanTool->SetPixelDepth(8);</div>
<div> videoImagerEpiphanTool->RequestSetVideoImagerToolName("Frame grabber");</div><div> videoImagerEpiphanTool->RequestConfigure();</div></div><div><br></div><div><br></div><div>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.</div>
<div>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?<br></div><div><br></div><div>typedef igstk::Frame FrameType;<br></div><div>
<div> FrameType* frame = new FrameType();</div><div> frame = this->GetVideoImagerToolFrame(</div><div> imagerToolContainer[deviceItr->first]);</div><div><br></div><div> unsigned int frameDims[3];</div>
<div> imagerToolContainer[deviceItr->first]->GetFrameDimensions(frameDims);</div><div> </div><div> EpiphanVideoImager::m_FrameBufferLock->Lock();</div><div><span class="" style="white-space:pre"> </span> </div>
<div><span class="" style="white-space:pre"> </span> if( frameBuffer != NULL)</div><div> {</div><div><span class="" style="white-space:pre"> </span> int numberOfBytesToSkip;</div><div><span class="" style="white-space:pre"> </span> numberOfBytesToSkip = 0;</div>
<div><br></div><div><span class="" style="white-space:pre"> </span> unsigned char* byteImageDataPtr=reinterpret_cast<unsigned char*>(frameBuffer->pixbuf);</div><div><span class="" style="white-space:pre"> </span></div>
<div> memcpy(frame->GetImagePtr(),</div><div><span class="" style="white-space:pre"> </span>byteImageDataPtr,</div><div> frameDims[0]*frameDims[1]*frameDims[2]);</div><div><br></div><div><span class="" style="white-space:pre"> </span>}</div>
<div> }</div></div><div><br></div><div><br></div><div>I hope someone could help me. Thanks<br clear="all"><div><br></div>-- <br>Fabián Torres Robles<br>Maestria en Ciencias en Ingeniería Electrónica<br>Ingeniería en Sistemas Electrónicos<br>
tel. 58081280, 0445534661338<br>e-mail <a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@gmail.com</a>, <a href="mailto:dae.wong@gmail.com" target="_blank">dae.wong@gmail.com</a> <div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%"></div>
</div></div>