I need help in creating a waterfall display of my image data stored in a buffer. The stream of image data needs to be displayed scrolling down the screen as its being acquired from the camera.
I am using visual studio c++ windows forms.
Can someone please help me to figure out how to achieve this display?
Thanks in advance
I think the info you provide is to minimal to suggest anything worthwhile.
For making custom graphical effects, the usual suggested route is to make a DIB bitmap, which gives you access to the raw bytes. Alter the bytes anyway you see fit (adding the stream of raw image bytes from your camera) and then blit it to the windows HDC in a timely fashion.
Related
I need to capture a snapshots/screenshots of the specific window (HWND) that is using HW acceleration and record them to a video stream.
While using BitBlt or PrintWindow I'm able to capture image data only if this window is not HW accelerated, else I'm getting a black texture.
Tried using User32.dll's undocumented DwmGetDxSharedSurface to get the DirectX surface handle. But it fails with an error:
ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED - desktop windowing
management subsystem is off
(Edit: Fails for certain applications, i.e. "calculator.exe")
Tried using Dwmapi.dll's undocumented functions DwmpDxUpdateWindowSharedSurface and DwmpDxGetWindowSharedSurface. I've managed to retrieve what looks like a valid DirectX surface handle. (it's d3dFormat, width and height information was valid) Dx's OpenSharedResource was not complaining and managed to create a valid ID3D11Texture2D. Problem is.. all bytes are zeros (getting a black texture). I might be doing something wrong here or.. undocumented DWM functionas does not work anymore on Windows 10...
Edit: I'm able to get image data for some applications like Windows
explorer, Paint, etc, but for some like i.e. Slack i get all
zeros/black image.
Edit: When capturing i.e. VLC, I get this:
Question:
Is there any other way to capture image data of the HW accelerated window?
Note: I don't want to capture the entire desktop.
You can use PrintWindow with nFlags=2
Or use Magnification API (exclude windows)
Or try to hack dwm.exe.
I am having some memory issues with our android app when handling bitmaps (duh!).
We are having multiple activities loading images from a server, this could be a background image for the activity.
This background image could be the same for multiple activities, and right now each activity is loading its own background image.
This means if the flow is ac1->ac2->ac3->ac4 the same image will be loaded 4 times and using 4x memory.
How do I optimize imagehandling for this scenario? Do I create an image cache where the image is stored and then each activity ask the cache first for images. If this is the case, how do I know when to garbage collect the image from the cache?
Any suggestions, link to good tutorials or similar is highly appreciated.
Regards
EDIT:
When downloading images for the device the exact sizes is used, meaning that if the ui element needs an 100x100 pixel image it gets that size and therefore no need for scaling. So i am not sure about downscaling the image when loading it into the memory. Maybe it is needed to unload images in the activity when moving on the the next and then reload when going back.
One thing you might want to try is scaling down your bitmaps (make a thumbnail) to a size that is more appropriate to your device. It's pretty easy to quickly use up all the RAM on an Android device with a bitmap if you don't scale it down. This recipe shows how to do so on the fly. You could adapt this to save the images to disk.
You could also create your own implementation of the LRUCache to cache the images for your app.
After ready your update I will give you an other tip then.
I can still post the patch too if people want that..
What you need to do with those bitmaps is call them with a using block. That way Android will unload the bitmap as soon as that block is executed.
Example:
using(Bitmap usedBitmap = new Bitmap()){
//Do stuff with the Bitmap here
//You can call usedBitmap.Dispose() but it's not really needed
}
With this code your app shouldn't keep all the used bitmaps in memory.
Paint.net dies opening this image, and MS paint as well.I don't know how to open this file for editing.Actually, I set out to break this image (its a map of my area) and load it to my phone (moto rokr e6),which does not have a GPS at the moment.
TileMage is giving up the splitting as well, throwing out of memory exception !.
I know photoshop could do it, but I don't have the licence for it. Any freeware application to do this.
Can GIMP do it ?
Please advise.
Thanks,
ImageMagick should be able to handle an image this large. convert is what you'd use. Just don't expect it to happen particularly quickly.
You can use imagemagick's stream command instead of convert. It uses only little RAM no matter how large the image is: https://stackoverflow.com/a/8756798/1034454
I'm not a VB6 developer so excuse me if I'm not making any sense.
If I have a VARIANT array of bytes containing an RGB array of image data, is it possible to get that data to be displayed in a PictureBox? The PictureBox documentation suggests that the only acceptable sources are files.
Additionally, the image size and other image information is known.
The PictureBox documentation lies. But unfortunately, it’s not pretty to create an IPictureDisp in memory. The following link may help you – unfortunately, it’s in German:
How to create a picture from data in memory
There may be a better (i.e. faster) method, but you should look in to the PSet method of a picture box control.
PSet method of picture box control
hi i created a dialogbox using MFC dialog..
using below url i displayed a bitmap picture in a dialog box.
http://www.functionx.com/visualc/applications/displaybitmap.htm
i have not write any code for that.i just added the bitmap Picture into import picture dialog box and used picture control and followed the tutorial...
when i run my application it displays image...
now i would like to know is it possible to do pixel manipulation using this image...
why i ask this means i have not write any code for the display of image...
pls clarify me in this regard....
Thanks a bunch
GetDIBits() and consorts is what you're after. Quite frankly, win32 image and DC manipulation is a rather advanced subject and you'll need to put in a lot more work than following a tutorial for getting it right. Start by reading the msdn docs for GetDIBits() and related functions, then read the relevant sections in the Petzold, then read all articles that mention GetDIBits() on codeproject.com. That should teach you enough to do low level bitmap manipulation.
Alternatively, phrase your question better (i.e., explain your problem and what you want to achieve) and maybe there's a quick and dirty fix that someone can offer you.
There is I recall a Win32 API to load and decode bitmaps.
Once you have the bitmap in memory an as RGB buffer, you can modify it. You will then need to emit the modified buffer as a new bitmap, which again the API will do for you.
Be aware of course that having a bitmap in memory where you then wish for example to increase the dimensions of the image will require appropriate buffer manipulation - there is no Win32 API for generalized bitmap editing.