|
|
Thank you, that was a really interesting article.
Can´t figure out why I didn't find it when I searched
However, GDI as mentioned in the article is to slow and
according to the author (not tried it myself yet though),
directx is to slow as well ("GetFrontBufferData() is a
slow operation by design")
That leaves me with the WMEncoder solution which seems
great but it requires the Windows Media Encoder to be
distributed with the application, and I don't want to do
that.
Anyone seen another approach to this?
|
|
|
|
|
You can only do so much.
Reading from a display adapter is slow no matter what you do.
The best you could hope for is full read/write access directly to
video RAM, which you're not going to get in a generic way that works
on all machines.
Your frame rate is pretty much unrealistic - especially for full screen.
For example, just one of my screens at 30fps would require over 200MB of
pixel data to be copied per second, and that's just getting the raw data.
Then you probably need to do something with all that data. I've found GDI
to be the most efficient, and the capture time is pretty insignificant compared
with actually processing the data (compressing, saving, etc.).
Good luck
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Here is link http://www.assol.mipt.ru/isr/catalog_en.html . Here if u click on an photo, a new page will be opened with that photo enlarged, and there u can choose textile material, color for that photo, and new photo gained with selected colors, textile .
I just want u to show me the way, programming language(easy to write program analog to this),which programming section i should learn(image processing or something like this). I want to write program similar to this, but a desktop program,
Now i'm programming on C#.but have no idea,experience in image like programming
thanks in advance
|
|
|
|
|
when ever i try to run the installer i get an error message saying: 'this setup executable has not been packed with files and settings. Please use the packer tool to setup this executable. error code:S1001'
any idea what to do?
|
|
|
|
|
Sounds like it might have gotten corrupted when you downloaded it. Have you tried downloading it again?
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
I get this same error message. On Microsoft's website is says the download is about 435mb. After downloading it was only 183mb. What's bugging me is the fact that according to my browser, the download was completed. 100%. No errors.
Strange eh?
The really sad part is that I can't seem to find an alternative mirror for it, and Microsoft doesn't even seem to have technical support for it.
Would someone who has the file maybe upload it to a torrent site or something so we can get our greedy little mitts on it please?
Thanks and later!
Jack
|
|
|
|
|
Hi, I wasn't sure where to put this, but this seems the most appropriate place.
I'm trying to load an image from a 2 Dimensional array into the main screen DC, like so.
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
SetPixel(imgDC, x, y, RGB(imgarray[x][y], imgarray[x][y], imgarray[x][y]));
}
}
StretchBlt(hdc, 0,0, 640, 480, imgDC, 0, 0, width, height, SRCCOPY);
But this becomes too slow for my needs if the image if larger than about 256x256.
I have also tried using do while loops, which were a fraction faster.
Is there a better way to do this?
"Sir, I protest. I am NOT a merry man!"
|
|
|
|
|
There is an incredibly fast way of doing this... LockBits; the first time I needed to do something like this it took me a while to get the indexing right... but it pays off in the end.
The MSDN page on it...
http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx[^]
A good example...
http://blog.paranoidferret.com/index.php/2007/08/31/csharp-tutorial-convert-a-color-image-to-greyscale/[^]
Bitmap image = (Bitmap)oldimage.Clone();
BitmapData bmpData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
unsafe
{
byte* ptr = (byte*)bmpData.Scan0.ToPointer();
for (int Y = 0; Y < image.Height; Y++)
{
for (int X = 0; X < image.Width; X++)
{
*ptr++ = 0;
*ptr++ = 0;
*ptr++ = 0;
}
ptr += bmpData.Stride - image.Width * 3;
}
}
image.UnlockBits(bmpData);
*ptr++ is the current byte representing a 'sub-pixel' of the current pixel at image position [x, y]: the reason why the pointer is incremented three times.
Hope this helps.
Matthew Butler
|
|
|
|
|
Hi, thanks for your reply.
Is there a way to set the pixels of a DDB with this? I had thought it was DIB only?
"Sir, I protest. I am NOT a merry man!"
|
|
|
|
|
Naturality wrote: Is there a way to set the pixels of a DDB with this? I had thought it was DIB only?
LockBits is GDI+ and works great.
In addition to that...
With GDI, a DIBsection gives you a bitmap you can use like a DDB
but with a pointer to the pixel bits array. See CreateDIBSection().
A DIBSection (like a GDI+ Bitmap object) is also more flexible than
a DDB, since it can be created it with the same pixel format as your
data and still be selected into into a memory DC that is not the same
format as the screen.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, I've been looking into it and it seems like it's the answer for me
"Sir, I protest. I am NOT a merry man!"
|
|
|
|
|
Hello,
given the vertices's of initial and resultant plane.
I need to transform a plane(i.e. triangle) from one plane to other in which rotation, scaling and translation has to occur. I just need that transformation matrix if applied to the initial plane it will give resultant plane.
i am trying to
1> rotate the plane first to the normal of the resultant plane.
2> scale the matrix requred
3> translate the points...
dont know the approach is correct upto what extent? also it would be to know that can the rotation o the plane be replaced by transalation.
|
|
|
|
|
I've been experimenting with XNA a little. I have a CAD program I can draw models in with a lot of different formats you can export to but unforunately it doesn't have .fbx or .x. I was wondering can the content piplelines use any other formats? I wasn't able to find any list of acceptable 3d CAD file formats. Thanks.
|
|
|
|
|
Hi all,
I'm new to Direct3D programming, but made some simple examples.
I'm actually working on a WPF project in C#, but I'm exploring the new 3.5SP1 D3DImage imagesource to solve a performance issue.
I already have made a working example of some aplha-blended d3d projected on a WPF window, and it performs and antialiases very smooth.
The d3d code is Visual C++ , put in an unmanaged dll. I'd like to keep it that way, it's the method suggested for optimal performance.
What I want to can't be very hard - I want to draw about 200-300 rectangles on the 2D screen which size independantly of eachother. The rectangles are a simple top to bottom gradients. The rest of the rendered output is transparent.
- from here on I'd like your advice -
Do draw the rectangles, I'll use an array of four-vertices vertexarrays, stored on the d3ddevice memory. (Is that a good starting point?). I render them with trianglefan.
The rectangles get sized (scaled?) each 20 milliseconds, individually from oneanother (an array of floats is sent from the WPF app). What methods should I look for? Is it correct that matrices only apply to the whole scene, so I should do it differently?
It would be nice if I could "slow down" the sizing. For example, a rectangle goes from 0.1 to 0.9, and I want it to progress at a maximum speed of 1/500ms . Any ideas? Which part/methods of the DirectX documentation is good reading material for this?
Any help appreciated
|
|
|
|
|
Dear All,
I am developing an application to preview the video from a Capture device. I have developed the application and it is working fine, but the problem is that it is playing two times correctly but for the third time i got error while connecting with video renderer. Please help me. Code snippet is given below :
void DialogPlayer::OnBnClickedButton12()
{
bool x= CreateVideoGraph();
}
BOOL DialogPlayer::CreateVideoGraph()
{
hr = CoCreateInstance(CLSID_FilterGraph, NULL,CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&amp;pGraph);
if(FAILED(hr))
{
return FALSE;
}
if (SUCCEEDED(hr))
{
hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL,CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2,(void **)&amp;pBuilder);
if(FAILED(hr))
{
return FALSE;
}
if (SUCCEEDED(hr))
{
hr=pBuilder-&gt;SetFiltergraph(pGraph);
if(FAILED(hr))
{
return FALSE;
}
}
}
hr= pGraph-&gt;QueryInterface(IID_IMediaControl,(LPVOID *) &amp;(pControl));
hr=pGraph-&gt;QueryInterface(IID_IVideoWindow, (LPVOID *) &amp;(VideoWindow));
ICreateDevEnum *pSysDevEnum = NULL;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&amp;pSysDevEnum);
if(FAILED(hr))
{
return FALSE;
}
IEnumMoniker *pEnumCat = NULL;
hr = pSysDevEnum-&gt;CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &amp;pEnumCat, 0);
if (hr == S_OK)
{
IMoniker *pMoniker = NULL;
ULONG cFetched;
while(pEnumCat-&gt;Next(1, &amp;pMoniker, &amp;cFetched) == S_OK)
{
IPropertyBag *pPropBag;
hr = pMoniker-&gt;BindToStorage(0, 0, IID_IPropertyBag, (void **)&amp;pPropBag);
if (SUCCEEDED(hr))
{
VARIANT varName;
VariantInit(&amp;varName);
hr = pPropBag-&gt;Read(L"FriendlyName", &amp;varName, 0);
BSTR name2=varName.bstrVal;
if((wcscmp(name2, "Video Capture AV")==0))
{
hr=pMoniker-&gt;BindToObject(0,0,IID_IBaseFilter, (void**)&amp;(VideoSourceFilter));
hr=pGraph-&gt;AddFilter(VideoSourceFilter,L"Video Source");
check1=1;
}
if(check1==0)
{
return FALSE;
}
pPropBag-&gt;Release();
}
pMoniker-&gt;Release();
}
pEnumCat-&gt;Release();
}
else
{
return FALSE;
}
pSysDevEnum-&gt;Release();
hr = CoCreateInstance(CLSID_VideoRenderer, 0, CLSCTX_INPROC_SERVER,IID_IBaseFilter, (void**)(&amp;VideoRenderer));
IPin *outPin;
IPin *inPin;
hr = pBuilder-&gt;FindInterface(&amp;PIN_CATEGORY_CAPTURE, &amp;MEDIATYPE_Video, VideoSourceFilter,IID_IAMCrossbar, (void **)(&amp;CrossbarFilter));
hr = pBuilder-&gt;FindPin(VideoSourceFilter,PINDIR_OUTPUT,NULL,NULL,FALSE,0,&amp;outPin);
hr = pGraph-&gt;Render(outPin);
return TRUE;
}
|
|
|
|
|
You didn't say what kind of error you were getting. Is it possible that on one of your previous runs you aborted the program or took a path that didn't close everything? I had a problem with an OpenCV app I wrote that got very unhappy if I exited without properly releasing everything. COM is funny that way.
If you don't have the data, you're just another a**hole with an opinion.
|
|
|
|
|
Hi
are you releasing the reference count on the
CrossbarFilter
IPin *outPin;
these two interfaces when done.
|
|
|
|
|
I tried releasing everything and nothing happens. Finally I remove all the filters in the graph using IEnuFilters and this works for me. Thanks for your kindness and reply.
|
|
|
|
|
Does anybody know where I can get a control like the picture control in Microsoft Word or PhotoDraw? I am in need of that type of image control that floats above another image (using layers), rotates freely and is resizable.
|
|
|
|
|
|
When I run
'Icon k = Icon.FromHandle(WorkingImage.GetHicon());
MemoryStream s = new MemoryStream();
k.Save(s);
int s_length = (int)s.Length;
FileStream WriteFileFinaly = new FileStream(FileName, FileMode.Create);
byte[] b = new byte[s_length];
s.Read(b, 0, s_length);
WriteFileFinaly.Write(b, 0, s_length);
WriteFileFinaly.Flush();
WriteFileFinaly.Close();'
(FileName is a location and file name)
The file created is not working as an icon, when i try to use it in a icon using program it gives an error.
What should I do?
|
|
|
|
|
ThinkingCapProductions_MrFluffy wrote: s.Read(b, 0, s_length);
What would you expect this line to do...?
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
I am using 'b' "a byte[] array" to transfer the data from the MemoryStream 's' "which holds the Icon k" to a FileStream 'WriteFileFinaly'.
|
|
|
|
|
Then you might want to check the return value.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|