Ejemplo n.º 1
0
 /// <summary>
 /// Graphcut of a flow network (32bit signed integer edge capacities). The
 /// function computes the minimal cut (graphcut) of a 2D regular 4-connected
 /// graph. <para/>
 /// The inputs are the capacities of the horizontal (in transposed form),
 /// vertical and terminal (source and sink) edges. The capacities to source and
 /// sink
 /// are stored as capacity differences in the terminals array
 /// ( terminals(x) = source(x) - sink(x) ). The implementation assumes that the
 /// edge capacities
 /// for boundary edges that would connect to nodes outside the specified domain
 /// are set to 0 (for example left(0,*) == 0). If this is not fulfilled the
 /// computed labeling may be wrong!<para/>
 /// The computed binary labeling is encoded as unsigned 8bit values (0 and >0).
 /// </summary>
 /// <param name="Terminals">Pointer to differences of terminal edge capacities</param>
 /// <param name="LeftTransposed">Pointer to transposed left edge capacities</param>
 /// <param name="RightTransposed">Pointer to transposed right edge capacities</param>
 /// <param name="Top">Pointer to top edge capacities (top(*,0) must be 0)</param>
 /// <param name="Bottom">Pointer to bottom edge capacities (bottom(*,height-1)</param>
 /// <param name="Label">Pointer to destination label image </param>
 /// <returns></returns>
 public void GraphCut(NPPImage_32sC1 Terminals, NPPImage_32sC1 LeftTransposed, NPPImage_32sC1 RightTransposed,
                      NPPImage_32sC1 Top, NPPImage_32sC1 Bottom, NPPImage_8uC1 Label)
 {
     status = NPPNativeMethods.NPPi.ImageLabeling.nppiGraphcut_32s8u(Terminals.DevicePointer, LeftTransposed.DevicePointer,
                                                                     RightTransposed.DevicePointer, Top.DevicePointer, Bottom.DevicePointer, Terminals.Pitch, LeftTransposed.Pitch, _size,
                                                                     Label.DevicePointer, Label.Pitch, _state);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiGraphcut_32s8u", status));
     NPPException.CheckNppStatus(status, this);
 }
 /// <summary>
 /// 32-bit unsigned to 32-bit signed conversion.
 /// </summary>
 /// <param name="dst">Destination image</param>
 /// <param name="roundMode">Round mode</param>
 /// <param name="scaleFactor">scaling factor</param>
 public void Convert(NPPImage_32sC1 dst, NppRoundMode roundMode, int scaleFactor)
 {
     status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32u32s_C1RSfs(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, roundMode, scaleFactor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32u32s_C1RSfs", status));
     NPPException.CheckNppStatus(status, this);
 }