//------------------------------------------------------------------------------------------------------- public CameraParameters(WebCamMode webCamMode) { m_HologramOpacity = 1.0f; m_PixelFormat = CapturePixelFormat.BGRA32; m_FrameRate = default(float); m_CameraResolutionWidth = default(int); m_CameraResolutionHeight = default(int); if (webCamMode == WebCamMode.PhotoMode) { Resolution photoCaptureCameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First(); m_CameraResolutionWidth = photoCaptureCameraResolution.width; m_CameraResolutionHeight = photoCaptureCameraResolution.height; } else if (webCamMode == WebCamMode.VideoMode) { Resolution videoCaptureCameraResolution = VideoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First(); float cameraFramerate = VideoCapture.GetSupportedFrameRatesForResolution(videoCaptureCameraResolution).OrderByDescending((fps) => fps).First(); m_CameraResolutionWidth = videoCaptureCameraResolution.width; m_CameraResolutionHeight = videoCaptureCameraResolution.height; m_FrameRate = cameraFramerate; } }
public void DoAsyn(NRPhotoCapture.OnCapturedToMemoryCallback oncapturedcallback) { if (!m_IsInit) { if (oncapturedcallback != null) { var result = new NRPhotoCapture.PhotoCaptureResult(); result.resultType = NRPhotoCapture.CaptureResultType.UnknownError; oncapturedcallback(result, null); } return; } var captureTask = new CaptureTask(); captureTask.Width = m_CameraParameters.cameraResolutionWidth; captureTask.Height = m_CameraParameters.cameraResolutionHeight; captureTask.BlendMode = m_CameraParameters.blendMode; captureTask.CaptureFormat = m_CameraParameters.pixelFormat == CapturePixelFormat.PNG ? PhotoCaptureFileOutputFormat.PNG : PhotoCaptureFileOutputFormat.JPG; captureTask.OnReceive += (task, data) => { if (oncapturedcallback != null) { var result = new NRPhotoCapture.PhotoCaptureResult(); result.resultType = NRPhotoCapture.CaptureResultType.Success; CapturePixelFormat format = task.CaptureFormat == PhotoCaptureFileOutputFormat.PNG ? CapturePixelFormat.PNG : CapturePixelFormat.JPEG; PhotoCaptureFrame frame = new PhotoCaptureFrame(format, data); oncapturedcallback(result, frame); } }; this.DoAsyn(captureTask); }
public CameraParameters(WebCamMode webCamMode) { this.m_HologramOpacity = 1f; this.m_PixelFormat = CapturePixelFormat.BGRA32; this.m_FrameRate = 0f; this.m_CameraResolutionWidth = 0; this.m_CameraResolutionHeight = 0; if (webCamMode == WebCamMode.PhotoMode) { Resolution resolution = (from res in PhotoCapture.SupportedResolutions orderby res.width * res.height descending select res).First <Resolution>(); this.m_CameraResolutionWidth = resolution.width; this.m_CameraResolutionHeight = resolution.height; } else if (webCamMode == WebCamMode.VideoMode) { Resolution resolution2 = (from res in VideoCapture.SupportedResolutions orderby res.width * res.height descending select res).First <Resolution>(); float frameRate = (from fps in VideoCapture.GetSupportedFrameRatesForResolution(resolution2) orderby fps descending select fps).First <float>(); this.m_CameraResolutionWidth = resolution2.width; this.m_CameraResolutionHeight = resolution2.height; this.m_FrameRate = frameRate; } }
internal PhotoCaptureFrame(IntPtr nativePtr) { this.m_NativePtr = nativePtr; this.dataLength = this.GetDataLength(); this.hasLocationData = this.GetHasLocationData(); this.pixelFormat = this.GetCapturePixelFormat(); GC.AddMemoryPressure((long)this.dataLength); }
public CameraParameters( CapturePixelFormat pixelFormat = CapturePixelFormat.BGRA32, int cameraResolutionHeight = 720, int cameraResolutionWidth = 1280, int frameRate = 30) { throw new NotImplementedException(); }
//----------------------------------------------------------------- internal PhotoCaptureFrame(IntPtr nativePtr) { m_NativePtr = nativePtr; dataLength = GetDataLength(); // Cache DataLength on managed side because it will be accessed frequently hasLocationData = GetHasLocationData(); pixelFormat = GetCapturePixelFormat(); GC.AddMemoryPressure(dataLength); }
public CameraParameters( CapturePixelFormat pixelFormat = CapturePixelFormat.BGRA32, int cameraResolutionHeight = 720, int cameraResolutionWidth = 1280, int frameRate = 30, bool rotateImage180Degrees = true) { throw new NotImplementedException(); }
public CameraParameters(WebCamMode webCamMode) { this.m_HologramOpacity = 1f; this.m_PixelFormat = CapturePixelFormat.BGRA32; this.m_FrameRate = 0f; this.m_CameraResolutionWidth = 0; this.m_CameraResolutionHeight = 0; if (webCamMode == WebCamMode.PhotoMode) { if (< > f__am$cache0 == null) {
public CameraParameters( CapturePixelFormat pixelFormat = CapturePixelFormat.BGRA32, int cameraResolutionHeight = 720, int cameraResolutionWidth = 1280, int frameRate = 30) { this.pixelFormat = pixelFormat; this.cameraResolutionHeight = cameraResolutionHeight; this.cameraResolutionWidth = cameraResolutionWidth; this.frameRate = frameRate; }
public CameraParameters(WebCamMode webCamMode) { this.m_HologramOpacity = 1f; this.m_PixelFormat = CapturePixelFormat.BGRA32; this.m_FrameRate = 0f; this.m_CameraResolutionWidth = 0; this.m_CameraResolutionHeight = 0; if (webCamMode == WebCamMode.PhotoMode) { if (<>f__am$cache0 == null) {
public CameraParameters( CapturePixelFormat pixelFormat = CapturePixelFormat.BGRA32, int cameraResolutionHeight = 720, int cameraResolutionWidth = 1280, int frameRate = 30, bool rotateImage180Degrees = true) { this.pixelFormat = pixelFormat; this.cameraResolutionHeight = cameraResolutionHeight; this.cameraResolutionWidth = cameraResolutionWidth; this.frameRate = frameRate; this.rotateImage180Degrees = rotateImage180Degrees; videoStabilizationBufferSize = 0; hologramOpacity = 0.0f; }
static string ConvertCapturePixelFormatToMediaEncodingSubtype(CapturePixelFormat format) { switch (format) { case CapturePixelFormat.BGRA32: return(MediaEncodingSubtypes.Bgra8); case CapturePixelFormat.NV12: return(MediaEncodingSubtypes.Nv12); case CapturePixelFormat.JPEG: return(MediaEncodingSubtypes.Jpeg); case CapturePixelFormat.PNG: return(MediaEncodingSubtypes.Png); default: return(MediaEncodingSubtypes.Bgra8); } }
/// <summary> /// Capture a image Asyn. if system supports AsyncGPUReadback, using AsyncGPUReadback to get the /// captured image, else getting the image by synchronization way. </summary> /// <param name="oncapturedcallback"> The oncapturedcallback.</param> public void DoAsyn(NRPhotoCapture.OnCapturedToMemoryCallback oncapturedcallback) { var captureTask = new CaptureTask(); var cameraParam = this.GetContext().RequestCameraParam(); captureTask.Width = cameraParam.cameraResolutionWidth; captureTask.Height = cameraParam.cameraResolutionHeight; captureTask.CaptureFormat = cameraParam.pixelFormat == CapturePixelFormat.PNG ? PhotoCaptureFileOutputFormat.PNG : PhotoCaptureFileOutputFormat.JPG; captureTask.OnReceive += (task, data) => { if (oncapturedcallback != null) { var result = new NRPhotoCapture.PhotoCaptureResult(); result.resultType = NRPhotoCapture.CaptureResultType.Success; CapturePixelFormat format = task.CaptureFormat == PhotoCaptureFileOutputFormat.PNG ? CapturePixelFormat.PNG : CapturePixelFormat.JPEG; PhotoCaptureFrame frame = new PhotoCaptureFrame(format, data); oncapturedcallback(result, frame); } }; this.DoAsyn(captureTask); }
public PhotoCaptureFrame(CapturePixelFormat format, byte[] data) { this.data = data; this.pixelFormat = format; }