开发者

Large bitmap images memory allocation in blob detectin, C# .Net

开发者 https://www.devze.com 2023-02-20 15:06 出处:网络
I have bitmap images like 14000x18000(~30MB ) height and width. I am trying to process them with different image processing libraries (OpenCV (using the wrapper OpenCvSharp), Aforge.NET..) in order to

I have bitmap images like 14000x18000(~30MB ) height and width. I am trying to process them with different image processing libraries (OpenCV (using the wrapper OpenCvSharp), Aforge.NET..) in order to do blob detection. However, labeling the bitmap image causes memory allocation problems. The libraries tri开发者_如何学编程es to map the labeled image to 32bit image.

Is there a way to da the labeling operation with a less amount of memory? (Cropping the image is not a solution)

For example labeling the bitmap image to a 8bit image instead of 32?


In case there isn't an answer for the 8-bit thing... and even if there is...

For speed and memory purposes, I would highly recommend resizing the image down (not cropping). Use high-quality interpolation like this sample does, only just resize to 50%, not thumbnail (7.5MB im memory).

You didn't mention that you don't want to do this, and I am assuming you probably don't want to try it, thinking the library will do better blob detection at full resolution. Before you pooh-pooh the idea you need to test it with a full-resolution subsection of a sample image, of a size that the library will handle, compared to the same subsection at 50%.

Unless you've actually done this, you can't know. You can also figure a maximum amount of memory that the picture can use, compute a resize factor to target that number (reduce it for safety - you'll figure this out when things blow up in testing). If you care where the stuff is in the original image, scale it back up by the factor.


This may not solve your particular problem (or it might), but have you considered splitting / segmenting the frame into a 2x2 (or 3x3) matrix and try to work on each of them separately. Then based on where you find the blobs in the 4 (or 9) frames, correlate and coalesce the adjoining blobs to make single blob. Of course, this high level blob coalescing would have to be your own logic.

PS> Admittedly, working off highly superficial knowledge of Aforge. No hands-on experience what-so-ever.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号