- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Sir
I'm beginner.
I got the color-stream by SR300 , then the image do Bi-level image and algorithm.
when i display the image about 5 min ,the error message show out "memory overload".
Could you give me some suggestion about program method ?
thanks.
edison.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make sure you're calling https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?releaseframe_pxcsensemanager.html ReleaseFrame after QuerySample, https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?dispose_pxcmbase.html Dispose after any CreateX methods (eg, CreateProjection, CreateColorImageMappedToDepth etc - not immediately after, but when you're finished with the result for this frame), and https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?releaseaccess_pxcimage.html ReleaseAccess after AcquireAccess to avoid memory building up. If you're just doing simple streaming, your code should look something like this:
PXCMCapture.Sample photo = pSenseManager.QuerySample();
PXCMImage image = photo.color;
pSenseManager.ReleaseFrame();
PXCMImage.ImageData data;
image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB24, out data);
form.DisplayBitmap(data.ToBitmap(0, image.info.width, image.info.height));
image.ReleaseAccess(data);
image.Dispose();
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say "memory overload", do you mean the "out of memory" error in Visual Studio 2015?
If you are using the instruction CreateColorImageMappedToDepth or CreateColorImageMappedToColor, these instructions have a known issue with a 'memory leak' that uses up memory over time whilst the program is running until the program crashes. The only solution is to use a different instruction that does not have the leak.
I recommend using the QueryVertices instruction instead to calculate vertices from the depth image.
https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/queryvertices_pxcprojection.html QueryVertices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, MartyG
yes, it's "out of memory" error .
I try to only read RGB stream to display, but it's still show "out of memory" message.
no calculate no algorithm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you give more details please about the RealSense script that you are using with Visual Studio 2015, and post it in your message or link to it if it is listed on a website? Is it the 'Rawstreams' sample? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make sure you're calling https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?releaseframe_pxcsensemanager.html ReleaseFrame after QuerySample, https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?dispose_pxcmbase.html Dispose after any CreateX methods (eg, CreateProjection, CreateColorImageMappedToDepth etc - not immediately after, but when you're finished with the result for this frame), and https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?releaseaccess_pxcimage.html ReleaseAccess after AcquireAccess to avoid memory building up. If you're just doing simple streaming, your code should look something like this:
PXCMCapture.Sample photo = pSenseManager.QuerySample();
PXCMImage image = photo.color;
pSenseManager.ReleaseFrame();
PXCMImage.ImageData data;
image.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB24, out data);
form.DisplayBitmap(data.ToBitmap(0, image.info.width, image.info.height));
image.ReleaseAccess(data);
image.Dispose();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Edison_Wu
Do you still need assistance with this thread?
We'll be waiting for your response.
-Sergio A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, jb455 & MartyG
thanks for your reply .
I think that it's problem about thread .
when I comment the "thread.start" ,and running application . the memory isn't increases.
and then i un-comment "thread.start" and comment most of code, the memory is increases.
it's my testing code below ,i will try it form jb455.
Thanks for everyone Help.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace SR300_study
{
public partial class Form1 : Form
{
public int WIDTH = 640;
public int HEIGHT = 480;
public PXCMSession g_session;
public Form1()
{
Form1.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
}
private void button1_Click(object sender, EventArgs e)
{
System.Threading.Thread thread = new System.Threading.Thread(RGB_DoRecognition);
thread.Start();
//System.Threading.Thread.Sleep(1000);
}
public void RGB_DoRecognition()
{
PXCMSenseManager sm = PXCMSenseManager.CreateInstance();
if (sm == null)
{
MessageBox.Show("sm is null");
}
sm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR, WIDTH, HEIGHT, 30);
sm.Init();
while (sm.AcquireFrame(true).IsSuccessful())
{
PXCMCapture.Sample sample = sm.QuerySample();
PXCMImage.ImageData data= null;
pxcmStatus ret = sample.color.AcquireAccess(PXCMImage.Access.ACCESS_READ, PXCMImage.PixelFormat.PIXEL_FORMAT_RGB24, out data);
if (ret == pxcmStatus.PXCM_STATUS_NO_ERROR)
{
//delete most of the code
}
sm.ReleaseFrame();
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks so much for sharing this with the community, Edison_Wu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?acquireframe_pxcsensemanager.html docs for AcquireFrame recommend calling ReleaseFrame as soon as possible, without much processing going on in between. I'd suggest, like in my snippet above, taking a copy of the image(s) you need from the sample and calling ReleaseFrame immediately after that. Also be sure to call colourImage.ReleaseAccess(data), and also colourImage.Dispose(), when you are finished with the image data and the image itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Edison_Wu,
It's great to hear you managed to resolve this issue. Feel free to contact us again if help is needed.
@MartyG and @jb455. Thanks so much for helping out!
Regards,
-Sergio A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page