Download Showcase 3 Program clicking here
Visit and download this project on GitHub
This software is a DEMO, intended to demonstrates MY SKILLS in this subjects:
[table id=3 /]
Abstract
Showcase 3 is a MFC / DirectShow program, focused in handling video camera preview, capturing a frame, create a composition with a static image (a crown) and save it to file. Prepare yourself with a computer camera and a funny smile.
Instructions
- first download software using this link
- unpack contents in a empty folder
- Double click and run Showcase3.exe
- You must see first about dialog, just click OK and continue next screen.
Then you must see camera program screen:
Then, follow instructions in text box on right-bottom corner:
- Move crown: just press mouse’s left button over the crown and move it
- Resize crown: press CTRL button (AND HOLDS) on keyboard and use mouse’s left button again in order to resize crown
- Save image composition: save to file in bmp format
You must get a image like this:
Code Snippet
BOOL CShowcase3Dlg::BuildPreviewGraph() { // we have one already if (fPreviewGraphBuilt) return TRUE; // No rebuilding while we're running if (fPreviewing) return FALSE; if (!pVCap.IsValid()) return FALSE; hids::vmr9::Renderer vmrRenderer; vmrRenderer.CreateInstance(); auto fc = vmrRenderer.GetFilterConfig(); fc.NumberOfStreams = 1; fc.SetRenderingMode(VMR9Mode_Windowless); wc = vmrRenderer.GetWindowlessControl(); wc.SetVideoClippingWindow(ghwndApp); pFg.AddFilter(vmrRenderer, L"Video Mixer Renderer"); if(!pBuilder.RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pVCap, nullptr, &vmrRenderer)) return false; hids::AMStreamConfig pVSC; pVSC = pBuilder.FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, pVCap, IID_IAMStreamConfig).Cast<hids::AMStreamConfig>(); if (!pVSC) pVSC = pBuilder.FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVCap, IID_IAMStreamConfig).Cast<hids::AMStreamConfig>(); hids::AmMediaTypeHolder media; pVSC.GetFormat(media); VIDEOINFOHEADER* vih = media.GetVideoInfoHeader(); RECT s, d, rc; ::GetClientRect(ghwndApp, &rc); rc.bottom -= VIDEO_MARGIN; float factor = (float)rc.bottom / (float)vih->bmiHeader.biHeight; rc.right = (long)((float)vih->bmiHeader.biWidth * factor); SetRect(&s, 0, 0, vih->bmiHeader.biWidth, vih->bmiHeader.biHeight); SetRect(&d, VIDEO_MARGIN, VIDEO_MARGIN, rc.right, rc.bottom); wc.SetVideoPosition(s, d); VMR9AlphaBitmap x; memset(&x, 0, sizeof(x)); LoadCrownBitmap(); x.hdc = crownDC; SetRect(&x.rSrc, 0, 0, CROWN_WIDTH, CROWN_HEIGHT); paintRect.right = rc.right; paintRect.bottom = rc.bottom; crownXpos = 0; crownYpos = 0; scale_factor = 1.0f; x.rDest.left = (float)crownXpos / (float)paintRect.right; x.rDest.top = (float)crownYpos / (float)paintRect.bottom; x.rDest.right = x.rDest.left + (float)(CROWN_WIDTH) * scale_factor / (float)paintRect.right; x.rDest.bottom = x.rDest.top + (float)(CROWN_HEIGHT)* scale_factor / (float)paintRect.bottom; x.fAlpha = 1.0f; x.dwFlags = VMR9AlphaBitmap_hDC | VMR9AlphaBitmap_SrcColorKey; isShowingCrown = true; MixerBitmap = vmrRenderer.GetMixerBitmap(); MixerBitmap.SetAlphaBitmap(x); fPreviewGraphBuilt = TRUE; return TRUE; }