private Mat getFrame(int pingNum) { Mat m; if (_captureInProgress == false) { _captureInProgress = true; MagImage mg = getMagImage(pingNum); if (ping_num < pingCount && sonarType != "NET") { ping_num++; } ColorImage c = getColorImage(mg); m = getMatImage(c); //Colorimage needs to be disposed after being sent to screen //c.Dispose(); } else { //Do nothing if it is already processing? m = new Mat(); } return(m); }
public ColorImage getColorImage(MagImage mImg) { ColorMapper cmap = new ColorMapper(); ColorImage cimg = null; if (mImg != null) { cmap.Load(@"C:\jet.cmap"); cimg = cmap.MapImage(mImg); } cmap.Dispose(); mImg.Dispose(); return(cimg == null ? new ColorImage() : cimg); } //TODO: Examine different color maps, choose
public MagImage GetImageRTheta() { IntPtr img_ptr = new IntPtr(); if (_disposed) { throw new ObjectDisposedException("BVTPing"); } int error_code = NativeMethods.BVTPing_GetImageRTheta(_handle, ref img_ptr); GC.KeepAlive(this); if (0 != error_code) { throw new SdkException(error_code); } MagImage img = new MagImage(img_ptr); return(img); }
/// <summary> /// Apply a colormap to an intensity image to produce a ColorImage. /// </summary> /// <param name="input">Input magnitude image </param> /// <returns>Output color image </returns> public ColorImage MapImage(MagImage input) { IntPtr output_ptr = new IntPtr(); if (_disposed) { throw new ObjectDisposedException("BVTColorMapper"); } int error_code = NativeMethods.BVTColorMapper_MapImage(_handle, input.Handle, ref output_ptr); GC.KeepAlive(this); if (0 != error_code) { throw new SdkException(error_code); } ColorImage output = new ColorImage(output_ptr); return(output); }
public void saveMagImage(MagImage mImg, string filePath) { mImg.SavePGM(filePath); mImg.Dispose(); }