![]() Stop zooming by releasing the mouse button. Zoom your video by pressing the left mouse button. But if you like to highlight the zoom area, you might use the effect frame without any filtering: myFrameClone.MFOverlayRect(myEffectFrame, null, ref newRect, eMFOverlayFlags.eMFOF_Crop, 1, "", "") Sample applicationįor your reference, a sample application that illustrates this logic is attached below: Technically, it is enough for the proper zooming of the video. The overlay with the filter mask: myFrameClone.MFOverlayRect(cutFrame, myMaskFrame, ref newRect, eMFOverlayFlags.eMFOF_Crop, 1, "", "") The x and y point to the center of the rectangle, so there are " -250" in calculations. The bigger rectangle of 500x500: MF_RECT newRect = new MF_RECT() So, you should use the mask frame to create a round overlay. If there is no mask then the result looks like a square overlay. If the rectangle is bigger then there is a zoom effect. ![]() You should specify a new rectangle to place the cut frame. So, the target rectangle of 200x200 should have the following parameters: tagRECT rect = new tagRECT()Īnd, finally, you should cut the rectangle from the source frame: myFrameClone.MFCut(0, ref rect, out cutFrame) Zoom and Mask Where the panelPreview is your actual preview control, and the m_nMousePosX and the m_nMousePosY are the X and Y coordinates of a mouse pointer over your preview. Int y = Math.Abs( * m_nMousePosY / panelPreview.Height) Im not sure if this is a p5.js specific issue of. Im trying to create a 'video scrubbing' example and am running into some issues. Int x = Math.Abs( * m_nMousePosX / panelPreview.Width) Im trying again from 1019 (heres some advice to myself - read the reference before filing an issue). Now, you should calculate a relative mouse pointer position: MFFrame cutFrame To calculate proper parameters, you should get video properties of the processed frame: myFrameClone.MFAVPropsGet(out M_AV_PROPS myProps, out int samples) The main idea is to cut a square from the original frame, filter it with the mask and overlay it over the source frame. Once a source frame has been received, you should clone it to avoid any memory access issues: mSourceFrame.MFClone(out MFFrame myFrameClone, eMFrameClone.eMFC_Full, eMFCC.eMFCC_Default) MFFactor圜lass myFactory = new out MFFrame myEffectFrame, out myMaskFrame, "") Frame processing You should use both images to generate new frames: MFFrame myMaskFrame You should use full black for full transparent parts. The mask uses white color to filter the video, and it uses other colors as transparent. Just like this.įor the effect, we need an image of the shadow effect and a mask: ![]() This article implements frame overlay, generation new frames from local files, and some other frame processing features.Ī feature to zoom a selected part of a video under a mouse pointer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |