本文整理汇总了C#中IImage类的典型用法代码示例。如果您正苦于以下问题:C# IImage类的具体用法?C# IImage怎么用?C# IImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IImage类属于命名空间,在下文中一共展示了IImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInput
public static ProcessorResult CreateInput(IProcessor pro, IImage src)
{
ProcessorResult r = new ProcessorResult();
r.Result = src == null ? null : src.ToBitmap();
r.Name = "输入图像";
return r;
}
示例2: ConvertIntToFloat
public static unsafe void ConvertIntToFloat(IImage src, IImage dest)
{
int nChannels = src.ColorInfo.NumberOfChannels;
int elemWidth = src.Width * nChannels;
int height = src.Height;
int srcStride = src.Stride;
int destStride = dest.Stride;
for (int channel = 0; channel < src.ColorInfo.NumberOfChannels; channel++)
{
int* srcPtr = (int*)src.ImageData + channel;
float* destPtr = (float*)dest.ImageData + channel;
for (int r = 0; r < height; r++)
{
for (int c = 0; c < elemWidth; c += nChannels)
{
destPtr[c] = srcPtr[c];
}
srcPtr += srcStride / sizeof(int);
destPtr += destStride / sizeof(float);
}
}
}
示例3: Show
/// <summary>
/// Display the histograms of the specific image
/// </summary>
/// <param name="image">The image to retrieve hostigram from</param>
/// <param name="numberOfBins">The numebr of bins in the histogram</param>
public static void Show(IImage image, int numberOfBins)
{
HistogramViewer viewer = new HistogramViewer();
viewer.HistogramCtrl.GenerateHistograms(image, numberOfBins);
viewer.HistogramCtrl.Refresh();
viewer.Show();
}
示例4: SavedTreeNode
public SavedTreeNode(IImage image, string fullname, string text)
: base(null)
{
base.IconImage = image;
FullName = fullname;
Text = text;
}
示例5: SetImage
public void SetImage(IImage image)
{
#region display the size of the image
Size size = image.Size;
widthTextbox.Text = size.Width.ToString();
heightTextBox.Text = size.Height.ToString();
#endregion
#region display the color type of the image
Type colorType = Reflection.ReflectIImage.GetTypeOfColor(image);
Object[] colorAttributes = colorType.GetCustomAttributes(typeof(ColorInfoAttribute), true);
if (colorAttributes.Length > 0)
{
ColorInfoAttribute info = (ColorInfoAttribute)colorAttributes[0];
typeOfColorTexbox.Text = info.ConversionCodename;
}
else
{
typeOfColorTexbox.Text = Properties.StringTable.Unknown;
}
Type colorDepth = Reflection.ReflectIImage.GetTypeOfDepth(image);
typeOfDepthTextBox.Text = colorDepth.Name;
#endregion
UpdateHistogram();
UpdateZoomScale();
}
示例6: Start
public override void Start()
{
base.Start();
IStack stack = Platform.Current.Create<IStack>();
ILabel lblLabel = Platform.Current.Create<ILabel>();
lblLabel.Text = "View an image from Url";
lblLabel.Height = 30;
stack.Children.Add(lblLabel);
IImageButton imgbtn = Platform.Current.Create<IImageButton>();
imgbtn.LoadFromUrl(new Uri("http://okhosting.com/wp-content/uploads/2016/02/okhosting-150x150.png"));
imgbtn.Height = 100;
imgbtn.Width = 100;
imgbtn.Click += CmdViewImage_Click;
stack.Children.Add(imgbtn);
imgPicture = Platform.Current.Create<IImage>();
imgPicture.LoadFromUrl(new Uri("http://www.patycantu.com/wp-content/uploads/2014/07/91.jpg"));
imgPicture.Height = 250;
imgPicture.Width = 600;
imgPicture.Visible = false;
stack.Children.Add(imgPicture);
IButton cmdClose = Platform.Current.Create<IButton>();
cmdClose.Text = "Close";
cmdClose.Click += CmdClose_Click;
stack.Children.Add(cmdClose);
Platform.Current.Page.Title = "Test label";
Platform.Current.Page.Content = stack;
}
示例7: HandleCore
protected override IImage HandleCore(IImage src)
{
throw new NotImplementedException();
//IImage dst = null;
//if (src.PixelFormat == System.Drawing.Imaging.PixelFormat.Format8bppIndexed)
//{
// m_filter = new HoughLineTransformation();
// if (StepsPerDegree > 10) StepsPerDegree = 10;
// else if (StepsPerDegree < 1) StepsPerDegree = 1;
// if (LocalPeakRadius > 10) LocalPeakRadius = 10;
// else if (LocalPeakRadius < 1) LocalPeakRadius = 1;
// m_filter.StepsPerDegree = this.StepsPerDegree;
// m_filter.LocalPeakRadius = this.LocalPeakRadius;
// m_filter.ProcessImage(src);
// WriteHoughLine();
// dst = m_filter.ToBitmap();
//}
//else
//{
// dst = src.Clone() as Bitmap;
//}
//IImage dst;
}
示例8: Save
public void Save(IImage image, IFile file)
{
var actual = ((ImageAdapter)image).Image;
using (var stream = file.Open(FileLockMode.ReadWrite, FileOpenMode.Recreate)) {
actual.Save(stream, this.codec, this.parameters);
}
}
示例9: Handle
public IImage Handle(IImage src)
{
m_cacheResults.Clear();
if (src == null) return null;
if (Enable == true)
{
try
{
this.m_inputImage = src;
this.m_cacheResults.Add(this.CreateInput(this.m_inputImage));
this.m_outputImage = this.HandleCore(src);
if (this.m_outputImage != null)
{
this.m_cacheResults.Add(this.CreateOutput(this.m_outputImage));
}
return this.m_outputImage;
}
catch (Exception ex)
{
this.m_cacheResults.Add(this.CreateExceptionResult(ex));
return this.m_outputImage;
}
finally
{
}
}
else return src;
}
示例10: HandleCore
protected override IImage HandleCore(IImage src)
{
// Bitmap dst = src.Clone(new Rectangle(0,0,src.Width,src.Height), src.PixelFormat) as Bitmap;
// m_filter.ApplyInPlace(dst);
// return dst;
throw new NotImplementedException();
}
示例11: ConvertByteToDouble
public static unsafe void ConvertByteToDouble(IImage src, IImage dest)
{
int nChannels = src.ColorInfo.NumberOfChannels;
int elemWidth = src.Width * nChannels;
int height = src.Height;
int srcStride = src.Stride;
int destStride = dest.Stride;
for (int channel = 0; channel < src.ColorInfo.NumberOfChannels; channel++)
{
byte* srcPtr = (byte*)src.ImageData + channel;
double* destPtr = (double*)dest.ImageData + channel;
for (int r = 0; r < height; r++)
{
for (int c = 0; c < elemWidth; c += nChannels)
{
destPtr[c] = srcPtr[c];
}
srcPtr += srcStride / sizeof(byte);
destPtr += destStride / sizeof(double);
}
}
}
示例12: Recognize
public int Recognize(IImage image)
{
var discretizedImage = discretizer.Discretize(image);
var activeNeuron = classifier.Classify(discretizedImage);
var cluster = mapper.Map(activeNeuron);
return cluster;
}
示例13: getDefaultSprite
private static ISprite getDefaultSprite(IImage image, IGraphicsFactory factory)
{
ISprite sprite = factory.GetSprite();
sprite.Image = image;
sprite.Location = AGSLocation.Empty();
return sprite;
}
示例14: CreateOutput
public static ProcessorResult CreateOutput(IProcessor pro, IImage output)
{
ProcessorResult r = new ProcessorResult();
r.Result = output == null ? null : output.ToBitmap();
r.Name = "输出图像";
return r;
}
示例15: DrawImage
public void DrawImage (IImage image, Rect frame, double alpha = 1.0)
{
var ch = GetChild (ChildType.Image);
var s = (Shapes.Rectangle)ch.Shape;
s.Width = frame.Width;
s.Height = frame.Height;
}