Note that there are some explanatory texts on larger screens.

plurals
  1. POWorking with real-time data, bypassing CvloadImage
    primarykey
    data
    text
    <p>This is how we display and process an Image using Opencv: </p> <pre><code>int _tmain(int argc, _TCHAR* argv[]) { IplImage* img = cvLoadImage( "MGC.jpg" ); cvThreshold( img, img, 200, 255, CV_THRESH_BINARY ); cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE ); cvShowImage("Example1", img); cvWaitKey(0); cvReleaseImage( &amp;img ); cvDestroyWindow( "Example1" ); return 0; } </code></pre> <p>Now can you help me to achieve my goal as outlined below: </p> <pre><code>int _tmain(int argc, _TCHAR* argv[]) { Some code here (using some API other than OpenCv).... // Captures a frame and   //streams the data into a buffer Buf Buffer B= Buf; // B contain binary image data i.e 16 bit pixel values cvThreshold( B, B,  200, 255, CV_THRESH_BINARY );//Notice I am putting B and not an                                                  //Image(legal?) cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE ); cvShowImage("Example1", B); //Notice I am putting B and not an Image(legal?)    cvWaitKey(0); cvReleaseImage( &amp;B ); cvDestroyWindow( "Example1" ); return 0; } </code></pre> <p>Notice that I have not used any hard-disk read/write operation in the second code snippet, such as the following: </p> <pre><code> IplImage* img = cvLoadImage( "MGC.jpg" ); </code></pre> <p>Basically I am working with real-time scenario thus I am bypassing the time consuming <code>cvLoadImage</code>. Obviously not saving the data into hard-disk, my entire data is still in the <code>Buffer B</code>. This save my time which is critical for my application. </p> <p><strong>Note:</strong> The fact is I will be doing more processing on the <code>Buffer B</code>, such as applying <code>cvminmaxloc</code> etc. <em>But all these functions require an Image loaded from disk, not a buffer such in my case.</em> </p> <p>Can some point me to right direction to achieve my goal of working on Buffers instead of Images stored in the hard-disk? Am I committing some mistake in understanding the openCV functions? </p> <p><strong>Update:</strong></p> <p>A suggested below I can use <code>imdecode</code> for reading images from buffer. As explained above actually I will be doing processing on the image using OpenCv functions, for example <code>CVMinMaxLoc</code> and </p> <pre><code> cvThreshold( src, src, 200, 255, CV_THRESH_BINARY ); </code></pre> <p>Now can I put <code>Buffer</code> as the first argument instead of Image in <code>cvThreshold( )</code>? If not then what is the alternative to dealing with <code>Buffers</code> (containing pixel values) with openCv functions? If there is no direct method to work with buffers, then what is the indirect method to achieve this goal? What is the work around? </p> <p>In short I do not want to bring the data to hard disk before doing any processing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload