- Quick start
- Download
- Online manual
- Introduction
- Start Onvif programming
- C# Onvif.IP.Camera.Viewer
- C# Onvif IP Camera Viewer Git repository
- IP video camera viewer
- PTZ IP camera motion control
- Onvif network video recorder
- Motion detection and alarms
- IP camera to SIP video call
- Configure Onvif IP cam remotely
- Onvif IP camera video server
- Video stream on website
- Onvif Network Video Analytics
- Onvif IP Camera Manager
- Computer Vision Technology
- Motion recognition and analysis
- Object detection
- Object categorization
- Image Manipulation
- Introduction
- Brightness filter
- Channel filtering
- Contrast correction
- Gamma correction
- Greyscale effect
- Histogram equalization
- Rotate filter
- Invert colors
- Jitter
- Mirror effect
- Pixellate
- Rotate channels
- Hue modifier
- Salt and pepper noise
- Saturation correction
- Sepia effect
- Sharpen
- Simple posterization
- Water wave
- YCbCr
- Ozeki SDK for Linux
- Community
- Contact
- Product
- Search
- Commercial information
Get started
- Download the SDK
- Copy the C# code example into Visual Studio
- Build your IP Camera project
Did you know?
Did you know, that this SDK was used to build Ozeki Camera Recorder?
If you don't want to write code, it could be just what you need. Download it now from the follolwing page: Download Ozeki Camera Recorder.
Simple posterization
Posterization is a very common method used in creating and printing posters or increasing the focus on smaller objects in front of a background which is almost homogeneous in color. The method splits color planes into adjacent areas of the specific size essentialy creating a new image with less but more distinct colors. With OZEKI Camera SDK you can create your own posterized images even in real time.
Important: you should study this article in order to find out how to setup your Windows Forms Application correctly.
Properties
Filling type
With this option we can set simple posterization to three different levels, which are the following:
- Minimum - almost no posterization
- Average - the usual level, ideal for looking for smaller but more distinct objects on the image e.g. pale fonts on an older newspaper
- Maximum - highly posterized image, ideal for focusing on small and less distinct, e.g. spores on a flower closeup
Figure 1 - Original image
Figure 2 - Modified image with simple posterization - average setting
Windows Form |
MainForm.cs
using System; using System.Windows.Forms; using Ozeki.Camera; using Ozeki.Media; namespace ImageManipulation_WF { public partial class MainForm : Form { private ICamera _camera; private DrawingImageProvider _imageProvider; private MediaConnector _connector; private ImageManipulation _manipulation; private OzSimplePostarization _filter; public MainForm() { InitializeComponent(); _connector = new MediaConnector(); _imageProvider = new DrawingImageProvider(); // Create video viewer UI control // Bind the camera image to the UI control videoViewer.SetImageProvider(_imageProvider); _manipulation = new ImageManipulation(); _manipulation.Start(); _filter = new OzSimplePostarization(); postarizationCombo.DataSource = Enum.GetValues(typeof(PosterizationFillingType)); } private void btn_Connect_Click(object sender, EventArgs e) { _camera = new WebCamera(); if (_camera == null) return; _connector.Connect(_camera.VideoChannel, _manipulation); _connector.Connect(_manipulation, _imageProvider); _camera.Start(); videoViewer.Start(); } private void btn_Add_Click(object sender, EventArgs e) { _manipulation.Add(_filter); } private void btn_Remove_Click(object sender, EventArgs e) { _manipulation.Remove(_filter); } private void postarizationCombo_SelectedIndexChanged(object sender, EventArgs e) { var comboBox = sender as ComboBox; var type = (PosterizationFillingType)comboBox.SelectedItem; _filter.FillingType = type; } } }
Code 1 Simple posterization in C#
GUI
MainForm.Designer.cs
namespace ImageManipulation_WF { partial class MainForm { ////// Required designer variable. /// private System.ComponentModel.IContainer components = null; ////// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code ////// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.videoViewer = new Ozeki.Media.VideoViewerWF(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.postarizationCombo = new System.Windows.Forms.ComboBox(); this.btn_Remove = new System.Windows.Forms.Button(); this.btn_Add = new System.Windows.Forms.Button(); this.btn_Connect = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // videoViewer // this.videoViewer.BackColor = System.Drawing.Color.Black; this.videoViewer.FlipMode = Ozeki.Media.FlipMode.None; this.videoViewer.FrameStretch = Ozeki.Media.FrameStretch.Uniform; this.videoViewer.FullScreenEnabled = true; this.videoViewer.Location = new System.Drawing.Point(12, 44); this.videoViewer.Name = "videoViewer"; this.videoViewer.RotateAngle = 0; this.videoViewer.Size = new System.Drawing.Size(471, 334); this.videoViewer.TabIndex = 0; this.videoViewer.Text = "videoViewerWF1"; // // groupBox1 // this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.postarizationCombo); this.groupBox1.Controls.Add(this.btn_Remove); this.groupBox1.Controls.Add(this.btn_Add); this.groupBox1.Location = new System.Drawing.Point(489, 44); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(214, 110); this.groupBox1.TabIndex = 13; this.groupBox1.TabStop = false; this.groupBox1.Text = "Simple postarization settings"; // // postarizationCombo // this.postarizationCombo.FormattingEnabled = true; this.postarizationCombo.Items.AddRange(new object[] { "Minimum", "Maximum", "Average"}); this.postarizationCombo.Location = new System.Drawing.Point(57, 80); this.postarizationCombo.Name = "postarizationCombo"; this.postarizationCombo.Size = new System.Drawing.Size(121, 21); this.postarizationCombo.TabIndex = 16; this.postarizationCombo.SelectedIndexChanged += new System.EventHandler(this.postarizationCombo_SelectedIndexChanged); // // btn_Remove // this.btn_Remove.Location = new System.Drawing.Point(103, 32); this.btn_Remove.Name = "btn_Remove"; this.btn_Remove.Size = new System.Drawing.Size(75, 23); this.btn_Remove.TabIndex = 1; this.btn_Remove.Text = "Remove"; this.btn_Remove.UseVisualStyleBackColor = true; this.btn_Remove.Click += new System.EventHandler(this.btn_Remove_Click); // // btn_Add // this.btn_Add.Location = new System.Drawing.Point(6, 32); this.btn_Add.Name = "btn_Add"; this.btn_Add.Size = new System.Drawing.Size(75, 23); this.btn_Add.TabIndex = 0; this.btn_Add.Text = "Add"; this.btn_Add.UseVisualStyleBackColor = true; this.btn_Add.Click += new System.EventHandler(this.btn_Add_Click); // // btn_Connect // this.btn_Connect.Location = new System.Drawing.Point(12, 12); this.btn_Connect.Name = "btn_Connect"; this.btn_Connect.Size = new System.Drawing.Size(152, 26); this.btn_Connect.TabIndex = 14; this.btn_Connect.Text = "Connect to WebCamera"; this.btn_Connect.UseVisualStyleBackColor = true; this.btn_Connect.Click += new System.EventHandler(this.btn_Connect_Click); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 83); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(37, 13); this.label1.TabIndex = 17; this.label1.Text = "Filters:"; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(722, 398); this.Controls.Add(this.btn_Connect); this.Controls.Add(this.groupBox1); this.Controls.Add(this.videoViewer); this.Name = "MainForm"; this.Text = "Simple postarization"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); } #endregion private Ozeki.Media.VideoViewerWF videoViewer; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button btn_Remove; private System.Windows.Forms.Button btn_Add; private System.Windows.Forms.Button btn_Connect; private System.Windows.Forms.ComboBox postarizationCombo; private System.Windows.Forms.Label label1; } }
Code 2 Simple posterization GUI in C#
Conclusion
With the help of this lecture you can successfully implement simple posterization with your C# camera application using the Ozeki Camera SDK.
Related Pages
FAQ
Below you can find the answers for the most frequently asked questions related to this topic:
-
What kind of developer environment is needed?
- Microsoft Visual Studio 2010
- Microsoft .Net Framework 4.0
- Internet connection
-
How can I get the URL of the camera?
You can get the URL from the producer of the camera.
-
I have not managed to build the solution. How to solve it?
- Please set the Target framework property of the project to .NET 4.0.
- You should add the OzekiSDK.dll to the references of the solution.
- Please import the missing classes.
Home > Online manual > Image Manipulation > Simple posterization
Legal |
Privacy |
Terms of use |
6801 3.239.192.241 | 87.229.102.173 | Login |