Software by Default - Open Source using Microsoft C#.net

Are you over 18 and want to see adult content?

6

More Annotations

NIT Durgapur

NIT Durgapur

nitdgp.ac.in
Profile Image
Bella Mccoy
2020-03-12 19:54:16
NIT Durgapur

NIT Durgapur

nitdgp.ac.in

Are you over 18 and want to see adult content?

Turnkey Dropshipping Stores - Dropshipping Made Simple

Turnkey Dropshipping Stores - Dropshipping Made Simple

dropshippingincome.com
Profile Image
Bella Mccoy
2020-03-12 19:54:41
Turnkey Dropshipping Stores - Dropshipping Made Simple

Turnkey Dropshipping Stores - Dropshipping Made Simple

dropshippingincome.com

Are you over 18 and want to see adult content?

LINTAS GAYO – Media Online Dataran Tinggi GAYO

LINTAS GAYO – Media Online Dataran Tinggi GAYO

lintasgayo.co
Profile Image
Bella Mccoy
2020-03-12 19:55:07
LINTAS GAYO – Media Online Dataran Tinggi GAYO

LINTAS GAYO – Media Online Dataran Tinggi GAYO

lintasgayo.co

Are you over 18 and want to see adult content?

Chinesisch-Lernen.org - Chinesisch lernen und China entdecken

Chinesisch-Lernen.org - Chinesisch lernen und China entdecken

chinesisch-lernen.org
Profile Image
Bella Mccoy
2020-03-12 19:55:19
Chinesisch-Lernen.org - Chinesisch lernen und China entdecken

Chinesisch-Lernen.org - Chinesisch lernen und China entdecken

chinesisch-lernen.org

Are you over 18 and want to see adult content?

Trường Đại học Tây Nguyên

Trường Đại học Tây Nguyên

ttn.edu.vn
Profile Image
Bella Mccoy
2020-03-12 19:55:44
Trường Đại học Tây Nguyên

Trường Đại học Tây Nguyên

ttn.edu.vn

Are you over 18 and want to see adult content?

On Think Tanks - Independent research, ideas and advice

On Think Tanks - Independent research, ideas and advice

onthinktanks.org
Profile Image
Bella Mccoy
2020-03-12 19:56:19
On Think Tanks - Independent research, ideas and advice

On Think Tanks - Independent research, ideas and advice

onthinktanks.org

Are you over 18 and want to see adult content?

3
Poematrix - Poemas, Poetas & Comunidad

Poematrix - Poemas, Poetas & Comunidad

poematrix.com
Profile Image
Bella Mccoy
2020-03-12 19:56:30
Poematrix - Poemas, Poetas & Comunidad

Poematrix - Poemas, Poetas & Comunidad

poematrix.com

Are you over 18 and want to see adult content?

Arsalan.us

Arsalan.us

arsalan.us
Profile Image
Bella Mccoy
2020-03-12 19:56:37
Arsalan.us

Arsalan.us

arsalan.us

Are you over 18 and want to see adult content?

flynas - nasholiday

flynas - nasholiday

nasholiday.com
Profile Image
Bella Mccoy
2020-03-12 19:59:11
flynas - nasholiday

flynas - nasholiday

nasholiday.com

Are you over 18 and want to see adult content?

Lucky's Market -

Lucky's Market -

luckysmarket.com
Profile Image
Bella Mccoy
2020-03-12 19:59:26
Lucky's Market -

Lucky's Market -

luckysmarket.com

Are you over 18 and want to see adult content?

pancocojams

pancocojams

pancocojams.blogspot.com
Profile Image
Bella Mccoy
2020-03-12 19:59:48
pancocojams

pancocojams

pancocojams.blogspot.com

Are you over 18 and want to see adult content?

Perfect Teen Asses - Young Butts Pics

Perfect Teen Asses - Young Butts Pics

youngbutts.pics
Profile Image
Bella Mccoy
2020-03-12 19:59:59
Perfect Teen Asses - Young Butts Pics

Perfect Teen Asses - Young Butts Pics

youngbutts.pics

Are you over 18 and want to see adult content?

2

Favourite Annotations

Mazzaroppi - DVDRip XVID - Completo - NovelaDowns

Mazzaroppi - DVDRip XVID - Completo - NovelaDowns

https://noveladowns.blogspot.com/2016/02/mazzaroppi-dvdrip-xvid-completo.html
Profile Image
Bella Mccoy
2021-03-16 18:26:05
Mazzaroppi - DVDRip XVID - Completo - NovelaDowns

Mazzaroppi - DVDRip XVID - Completo - NovelaDowns

https://noveladowns.blogspot.com/2016/02/mazzaroppi-dvdrip-xvid-completo.html

Are you over 18 and want to see adult content?

When It Comes to Gorillas, Google Photos Remains Blind - WIRED

When It Comes to Gorillas, Google Photos Remains Blind - WIRED

https://www.wired.com/story/when-it-comes-to-gorillas-google-photos-remains-blind/
Profile Image
Bella Mccoy
2021-03-16 18:26:07
When It Comes to Gorillas, Google Photos Remains Blind - WIRED

When It Comes to Gorillas, Google Photos Remains Blind - WIRED

https://www.wired.com/story/when-it-comes-to-gorillas-google-photos-remains-blind/

Are you over 18 and want to see adult content?

No.925 MEI-素人ハメ撮りHimeMix

No.925 MEI-素人ハメ撮りHimeMix

https://himemix.com/teigaku/model/no/2366
Profile Image
Bella Mccoy
2021-03-16 18:26:08
No.925 MEI-素人ハメ撮りHimeMix

No.925 MEI-素人ハメ撮りHimeMix

https://himemix.com/teigaku/model/no/2366

Are you over 18 and want to see adult content?

Armageddon Record Shop

Armageddon Record Shop

http://armageddonshop.com/
Profile Image
Bella Mccoy
2021-03-16 18:26:08
Armageddon Record Shop

Armageddon Record Shop

http://armageddonshop.com/

Are you over 18 and want to see adult content?

Watch Soft sex Jules and guest girl late fun,Jan 23 - Naked people with Jules in Bedroom - The biggest Voyeur Videos gallery

Watch Soft sex Jules and guest girl late fun,Jan 23 - Naked people with Jules in Bedroom - The biggest Voyeur Videos gallery

https://voyeur-house.tv/moments/realm52/cam16/jules-and-guest-girl-late-funjan-23
Profile Image
Bella Mccoy
2021-03-16 18:26:09
Watch Soft sex Jules and guest girl late fun,Jan 23 - Naked people with Jules in Bedroom - The biggest Voyeur Videos gallery

Watch Soft sex Jules and guest girl late fun,Jan 23 - Naked people with Jules in Bedroom - The biggest Voyeur Videos gallery

https://voyeur-house.tv/moments/realm52/cam16/jules-and-guest-girl-late-funjan-23

Are you over 18 and want to see adult content?

115网盘json格式提取导入工具,模拟雷达功能 - 第2页 - 综合讨论区 - 98堂[原色花堂] - Powered by Discuz!

115网盘json格式提取导入工具,模拟雷达功能 - 第2页 - 综合讨论区 - 98堂[原色花堂] - Powered by Discuz!

https://www.sehuatang.net/thread-478658-2-1.html
Profile Image
Bella Mccoy
2021-03-16 18:26:11
115网盘json格式提取导入工具,模拟雷达功能 - 第2页 - 综合讨论区 - 98堂[原色花堂] - Powered by Discuz!

115网盘json格式提取导入工具,模拟雷达功能 - 第2页 - 综合讨论区 - 98堂[原色花堂] - Powered by Discuz!

https://www.sehuatang.net/thread-478658-2-1.html

Are you over 18 and want to see adult content?

6
The Enigma of Sara Kana and her many Paths.

The Enigma of Sara Kana and her many Paths.

https://sarakana.com/post/8710946599
Profile Image
Bella Mccoy
2021-03-16 18:26:16
The Enigma of Sara Kana and her many Paths.

The Enigma of Sara Kana and her many Paths.

https://sarakana.com/post/8710946599

Are you over 18 and want to see adult content?

025 کد کدام شهر است -- کد و پیش شماره شهرهای ایران و کشورها

025 کد کدام شهر است -- کد و پیش شماره شهرهای ایران و کشورها

http://tci-code.blog.ir/tag/025 کد کدام شهر است
Profile Image
Bella Mccoy
2021-03-16 18:26:17
025 کد کدام شهر است -- کد و پیش شماره شهرهای ایران و کشورها

025 کد کدام شهر است -- کد و پیش شماره شهرهای ایران و کشورها

http://tci-code.blog.ir/tag/025 کد کدام شهر است

Are you over 18 and want to see adult content?

FREE Biomes Coloring Pages for Kids

FREE Biomes Coloring Pages for Kids

https://www.kindergartenworksheetsandgames.com/2020/03/biomes-coloring-pages.html
Profile Image
Bella Mccoy
2021-03-16 18:26:17
FREE Biomes Coloring Pages for Kids

FREE Biomes Coloring Pages for Kids

https://www.kindergartenworksheetsandgames.com/2020/03/biomes-coloring-pages.html

Are you over 18 and want to see adult content?

6 Best AR Interior Design and Decorating Apps for Android

6 Best AR Interior Design and Decorating Apps for Android

https://www.makeuseof.com/ar-interior-design-apps-for-android/
Profile Image
Bella Mccoy
2021-03-16 18:26:17
6 Best AR Interior Design and Decorating Apps for Android

6 Best AR Interior Design and Decorating Apps for Android

https://www.makeuseof.com/ar-interior-design-apps-for-android/

Are you over 18 and want to see adult content?

Pemenuhan 17 Standarisasi LPSE Wujud Eksistensi LPSE Kalimantan Timur – Info LPSE

Pemenuhan 17 Standarisasi LPSE Wujud Eksistensi LPSE Kalimantan Timur – Info LPSE

http://infolpse.kaltimprov.go.id/2018/09/12/pemenuhan-17-standarisasi-lpse-wujud-eksistensi-lpse-kalimantan-timur/
Profile Image
Bella Mccoy
2021-03-16 18:26:20
Pemenuhan 17 Standarisasi LPSE Wujud Eksistensi LPSE Kalimantan Timur – Info LPSE

Pemenuhan 17 Standarisasi LPSE Wujud Eksistensi LPSE Kalimantan Timur – Info LPSE

http://infolpse.kaltimprov.go.id/2018/09/12/pemenuhan-17-standarisasi-lpse-wujud-eksistensi-lpse-kalimantan-timur/

Are you over 18 and want to see adult content?

Andi James Moms Boys - Upornia.com

Andi James Moms Boys - Upornia.com

https://upornia.com/videos/3771705/andi-james-moms-boys/
Profile Image
Bella Mccoy
2021-03-16 18:26:21
Andi James Moms Boys - Upornia.com

Andi James Moms Boys - Upornia.com

https://upornia.com/videos/3771705/andi-james-moms-boys/

Are you over 18 and want to see adult content?

2

Text

SOFTWARE BY DEFAULT

The StandardDeviationEdgeDetection method accepts 3 parameters, the first Bitmap parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: filterSize determines the pixel neighbourhood size.Note that the parameter is expected to reflect the pixel neighbourhood width/height. C# HOW TO: IMAGE EDGE DETECTION C# HOW TO: GENERATING ICONS FROM IMAGES Article Purpose This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying Sample Source Code implements a Windows Forms application, allowing for easily testing the icon generation process. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download BATTOEXE | SOFTWARE BY DEFAULT 3 Responses to “BatToExe”. Thanks, I’ve been trying to find a good programme like this for awhile. Awesome program. Thanks! If ever you continue to work on it, It would be usefull to be able to use this program at command line level with 5 parameters (input file / Output file / Icon File / invisible (or not) / run in admin mode or not) C# HOW TO: DEEP COPY OBJECTS USING BINARY SERIALIZATIONSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE FILTERING IMPLEMENTED USING A COLORMATRIXSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE CONTRAST C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: CALCULATING GAUSSIAN KERNELS C# HOW TO: IMAGE UNSHARP MASK

SOFTWARE BY DEFAULT

The StandardDeviationEdgeDetection method accepts 3 parameters, the first Bitmap parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: filterSize determines the pixel neighbourhood size.Note that the parameter is expected to reflect the pixel neighbourhood width/height. C# HOW TO: IMAGE EDGE DETECTION C# HOW TO: GENERATING ICONS FROM IMAGES Article Purpose This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying Sample Source Code implements a Windows Forms application, allowing for easily testing the icon generation process. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download BATTOEXE | SOFTWARE BY DEFAULT 3 Responses to “BatToExe”. Thanks, I’ve been trying to find a good programme like this for awhile. Awesome program. Thanks! If ever you continue to work on it, It would be usefull to be able to use this program at command line level with 5 parameters (input file / Output file / Icon File / invisible (or not) / run in admin mode or not) C# HOW TO: DEEP COPY OBJECTS USING BINARY SERIALIZATIONSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE FILTERING IMPLEMENTED USING A COLORMATRIXSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE CONTRAST C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: CALCULATING GAUSSIAN KERNELS C# HOW TO: IMAGE UNSHARP MASK C# HOW TO: IMAGE EDGE DETECTION Article Purpose The objective of this article is to explore various edge detection algorithms. The types of edge detection discussed are: Laplacian, Laplacian of Gaussian, Sobel, Prewitt and Kirsch. All instances are implemented by means of Image Convolution. Sample source code This article is accompanied by a sample source code Visual Studio

project which is

OPEN SOURCE PROJECTS BatToExe - A no frills Windows forms application capable of converting batch files (*.bat) to executable files (*.exe) BatToExe Project

Homepage

C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: GENERATE A WEB SERVICE FROM WSDL Article purpose Web Service Definition Language (WSDL) is an Xml based schema that exactly details the custom data types and web service methods exposed by a web service. Developers usually generate web service client proxy code in order to call into web services. Since WSDL is an exact description of a web service it is C# HOW TO: CHANGING A FILE’S READ ONLY ATTRIBUTE The third method, shown in the code snippet above, updates the value of the FileInfo class’ FileInfo.Attributes property, which is an enumeration of type System.IO.FileAttributes.The FileAttributes enumeration as part of its declaration implements .. When an enumeration’s declaration includes the attribute FlagsAttribute, it is an indication that the enumeration is to be C# HOW TO: CHECK IF A TCP PORT IS IN USE Article purpose This article features a short illustration of how to determine if a network port is already in use. Introduction When creating a TCP/IP server connection on a Windows based platform you can specify a port number ranging from 1000 to 65535. It would seem unlikely that two applications executing at the same time C# HOW TO: ENCODING BASE64 THUMBNAILS Article purpose This article details how to read Image files from the file system, create thumbnails and then encoding thumbnails images to Base64 strings. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download here. Images as Base64 strings From Wikipedia: Base64 is a

group

C# HOW TO: IMAGE UNSHARP MASK A good definition of Image Unsharp Masking can be found on Wikipedia: Unsharp masking (USM) is an image manipulation technique, often available in digital image processing software. The "unsharp" of the name derives from the fact that the technique uses a blurred, or "unsharp", positive image to create a "mask" of the original image. C# HOW TO: BITMAP COLOUR BALANCE The sample application is implemented as a Windows Forms application. The Bitmap Colour Balance application enables the user to load an input image file from the local file system. The user interface provides three trackbar controls representing the colour components Blue, Green and Red. Possible values range from 0 to 255 inclusive. C# HOW TO: IMAGE TRANSFORM SHEAR Image Shear Transformations can be applied to either X or Y, or both X and Y pixel coordinates. When using the sample application the user has option of adjusting Shear factors, as indicated on the user interface by the numeric up/down controls labelled Shear X and Shear Y. The following image is a screenshot of the Image Transform Shear

Sample

SOFTWARE BY DEFAULT

The StandardDeviationEdgeDetection method accepts 3 parameters, the first Bitmap parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: filterSize determines the pixel neighbourhood size.Note that the parameter is expected to reflect the pixel neighbourhood width/height. C# HOW TO: IMAGE EDGE DETECTION C# HOW TO: GENERATING ICONS FROM IMAGES Article Purpose This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying Sample Source Code implements a Windows Forms application, allowing for easily testing the icon generation process. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download BATTOEXE | SOFTWARE BY DEFAULT 3 Responses to “BatToExe”. Thanks, I’ve been trying to find a good programme like this for awhile. Awesome program. Thanks! If ever you continue to work on it, It would be usefull to be able to use this program at command line level with 5 parameters (input file / Output file / Icon File / invisible (or not) / run in admin mode or not) C# HOW TO: DEEP COPY OBJECTS USING BINARY SERIALIZATIONSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE FILTERING IMPLEMENTED USING A COLORMATRIXSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE CONTRAST C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: CALCULATING GAUSSIAN KERNELS C# HOW TO: IMAGE UNSHARP MASK

SOFTWARE BY DEFAULT

The StandardDeviationEdgeDetection method accepts 3 parameters, the first Bitmap parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: filterSize determines the pixel neighbourhood size.Note that the parameter is expected to reflect the pixel neighbourhood width/height. C# HOW TO: IMAGE EDGE DETECTION C# HOW TO: GENERATING ICONS FROM IMAGES Article Purpose This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying Sample Source Code implements a Windows Forms application, allowing for easily testing the icon generation process. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download BATTOEXE | SOFTWARE BY DEFAULT 3 Responses to “BatToExe”. Thanks, I’ve been trying to find a good programme like this for awhile. Awesome program. Thanks! If ever you continue to work on it, It would be usefull to be able to use this program at command line level with 5 parameters (input file / Output file / Icon File / invisible (or not) / run in admin mode or not) C# HOW TO: DEEP COPY OBJECTS USING BINARY SERIALIZATIONSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE FILTERING IMPLEMENTED USING A COLORMATRIXSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE CONTRAST C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: CALCULATING GAUSSIAN KERNELS C# HOW TO: IMAGE UNSHARP MASK C# HOW TO: IMAGE EDGE DETECTION Article Purpose The objective of this article is to explore various edge detection algorithms. The types of edge detection discussed are: Laplacian, Laplacian of Gaussian, Sobel, Prewitt and Kirsch. All instances are implemented by means of Image Convolution. Sample source code This article is accompanied by a sample source code Visual Studio

project which is

OPEN SOURCE PROJECTS BatToExe - A no frills Windows forms application capable of converting batch files (*.bat) to executable files (*.exe) BatToExe Project

Homepage

C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: GENERATE A WEB SERVICE FROM WSDL Article purpose Web Service Definition Language (WSDL) is an Xml based schema that exactly details the custom data types and web service methods exposed by a web service. Developers usually generate web service client proxy code in order to call into web services. Since WSDL is an exact description of a web service it is C# HOW TO: CHANGING A FILE’S READ ONLY ATTRIBUTE The third method, shown in the code snippet above, updates the value of the FileInfo class’ FileInfo.Attributes property, which is an enumeration of type System.IO.FileAttributes.The FileAttributes enumeration as part of its declaration implements .. When an enumeration’s declaration includes the attribute FlagsAttribute, it is an indication that the enumeration is to be C# HOW TO: CHECK IF A TCP PORT IS IN USE Article purpose This article features a short illustration of how to determine if a network port is already in use. Introduction When creating a TCP/IP server connection on a Windows based platform you can specify a port number ranging from 1000 to 65535. It would seem unlikely that two applications executing at the same time C# HOW TO: ENCODING BASE64 THUMBNAILS Article purpose This article details how to read Image files from the file system, create thumbnails and then encoding thumbnails images to Base64 strings. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download here. Images as Base64 strings From Wikipedia: Base64 is a

group

C# HOW TO: IMAGE UNSHARP MASK A good definition of Image Unsharp Masking can be found on Wikipedia: Unsharp masking (USM) is an image manipulation technique, often available in digital image processing software. The "unsharp" of the name derives from the fact that the technique uses a blurred, or "unsharp", positive image to create a "mask" of the original image. C# HOW TO: BITMAP COLOUR BALANCE The sample application is implemented as a Windows Forms application. The Bitmap Colour Balance application enables the user to load an input image file from the local file system. The user interface provides three trackbar controls representing the colour components Blue, Green and Red. Possible values range from 0 to 255 inclusive. C# HOW TO: IMAGE TRANSFORM SHEAR Image Shear Transformations can be applied to either X or Y, or both X and Y pixel coordinates. When using the sample application the user has option of adjusting Shear factors, as indicated on the user interface by the numeric up/down controls labelled Shear X and Shear Y. The following image is a screenshot of the Image Transform Shear

Sample

SOFTWARE BY DEFAULT

The StandardDeviationEdgeDetection method accepts 3 parameters, the first Bitmap parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: filterSize determines the pixel neighbourhood size.Note that the parameter is expected to reflect the pixel neighbourhood width/height. C# HOW TO: IMAGE EDGE DETECTION C# HOW TO: GENERATING ICONS FROM IMAGES Article Purpose This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying Sample Source Code implements a Windows Forms application, allowing for easily testing the icon generation process. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download BATTOEXE | SOFTWARE BY DEFAULT 3 Responses to “BatToExe”. Thanks, I’ve been trying to find a good programme like this for awhile. Awesome program. Thanks! If ever you continue to work on it, It would be usefull to be able to use this program at command line level with 5 parameters (input file / Output file / Icon File / invisible (or not) / run in admin mode or not) C# HOW TO: DEEP COPY OBJECTS USING BINARY SERIALIZATIONSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE FILTERING IMPLEMENTED USING A COLORMATRIXSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE CONTRAST C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: CALCULATING GAUSSIAN KERNELS C# HOW TO: IMAGE UNSHARP MASK

SOFTWARE BY DEFAULT

The StandardDeviationEdgeDetection method accepts 3 parameters, the first Bitmap parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: filterSize determines the pixel neighbourhood size.Note that the parameter is expected to reflect the pixel neighbourhood width/height. C# HOW TO: IMAGE EDGE DETECTION C# HOW TO: GENERATING ICONS FROM IMAGES Article Purpose This article illustrates the process of generating icon files (*.ico) from user specified input images. The accompanying Sample Source Code implements a Windows Forms application, allowing for easily testing the icon generation process. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download BATTOEXE | SOFTWARE BY DEFAULT 3 Responses to “BatToExe”. Thanks, I’ve been trying to find a good programme like this for awhile. Awesome program. Thanks! If ever you continue to work on it, It would be usefull to be able to use this program at command line level with 5 parameters (input file / Output file / Icon File / invisible (or not) / run in admin mode or not) C# HOW TO: DEEP COPY OBJECTS USING BINARY SERIALIZATIONSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE FILTERING IMPLEMENTED USING A COLORMATRIXSEE MORE ON SOFTWAREBYDEFAULT.COM C# HOW TO: IMAGE CONTRAST C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: CALCULATING GAUSSIAN KERNELS C# HOW TO: IMAGE UNSHARP MASK C# HOW TO: IMAGE EDGE DETECTION Article Purpose The objective of this article is to explore various edge detection algorithms. The types of edge detection discussed are: Laplacian, Laplacian of Gaussian, Sobel, Prewitt and Kirsch. All instances are implemented by means of Image Convolution. Sample source code This article is accompanied by a sample source code Visual Studio

project which is

OPEN SOURCE PROJECTS BatToExe - A no frills Windows forms application capable of converting batch files (*.bat) to executable files (*.exe) BatToExe Project

Homepage

C# HOW TO: SWAPPING BITMAP ARGB COLOUR CHANNELS Article Purpose The intention of this article is to explain and illustrate the various possible combinations that can be implemented when swapping the underlying colour channels related to a Bitmap image. The concepts explained can easily be replicated by making use of the included sample application. Sample source code This article is

accompanied by a

C# HOW TO: GENERATE A WEB SERVICE FROM WSDL Article purpose Web Service Definition Language (WSDL) is an Xml based schema that exactly details the custom data types and web service methods exposed by a web service. Developers usually generate web service client proxy code in order to call into web services. Since WSDL is an exact description of a web service it is C# HOW TO: CHANGING A FILE’S READ ONLY ATTRIBUTE The third method, shown in the code snippet above, updates the value of the FileInfo class’ FileInfo.Attributes property, which is an enumeration of type System.IO.FileAttributes.The FileAttributes enumeration as part of its declaration implements .. When an enumeration’s declaration includes the attribute FlagsAttribute, it is an indication that the enumeration is to be C# HOW TO: CHECK IF A TCP PORT IS IN USE Article purpose This article features a short illustration of how to determine if a network port is already in use. Introduction When creating a TCP/IP server connection on a Windows based platform you can specify a port number ranging from 1000 to 65535. It would seem unlikely that two applications executing at the same time C# HOW TO: ENCODING BASE64 THUMBNAILS Article purpose This article details how to read Image files from the file system, create thumbnails and then encoding thumbnails images to Base64 strings. Sample source code This article is accompanied by a sample source code Visual Studio project which is available for download here. Images as Base64 strings From Wikipedia: Base64 is a

group

C# HOW TO: IMAGE UNSHARP MASK A good definition of Image Unsharp Masking can be found on Wikipedia: Unsharp masking (USM) is an image manipulation technique, often available in digital image processing software. The "unsharp" of the name derives from the fact that the technique uses a blurred, or "unsharp", positive image to create a "mask" of the original image. C# HOW TO: BITMAP COLOUR BALANCE The sample application is implemented as a Windows Forms application. The Bitmap Colour Balance application enables the user to load an input image file from the local file system. The user interface provides three trackbar controls representing the colour components Blue, Green and Red. Possible values range from 0 to 255 inclusive. C# HOW TO: IMAGE TRANSFORM SHEAR Image Shear Transformations can be applied to either X or Y, or both X and Y pixel coordinates. When using the sample application the user has option of adjusting Shear factors, as indicated on the user interface by the numeric up/down controls labelled Shear X and Shear Y. The following image is a screenshot of the Image Transform Shear

Sample

SOFTWARE BY DEFAULT

Open Source using Microsoft C#.net

* Blog

* Code Samples

* Image Filters

* Open Source Projects

* Widgets

* About

------------------------- C# HOW TO: MIN/MAX EDGE DETECTION Published August 9, 2015 Augmented Reality

, C#

, Code

Samples , Edge

Detection

, Extension Methods

, Graphic Filters

, Graphics , How to

, Image

Arithmetic

, Image Filtering

, Image

Filters

,

Image Processing

, Image Transform

, Opensource

Leave a Comment

Tags: Alpha Red Green Blue

, Augmented

Reality , Binary

Image , Bitmap ARGB

, Bitmap Filters

, Bitmap.LockBits

, BitmapData

, Blur

, C#

, Code Sample

, Color Filters

, Computer vision

, Converting

Images , Edge

Detection ,

Extension Methods

, Graphic

Filters , How to

, Image

, Image Intensity

, Image

Manipulation ,

Image noise reduction

, Image

processing ,

Image Transform ,

Machine vision ,

Median Filter ,

Pixel Filters ,

Pixel Neighbourhood Max

, Pixel

Neighbourhood Min

ARTICLE PURPOSE

This article serves as a detailed discussion on implementing image edge detection  through

pixel neighbourhood

maximum and

minimum value subtraction. Additional concepts illustrated in this article include implementing a median filter

and RGB grayscale

conversion.

_FROG FILTER 3×3 SMOOTHED_

SAMPLE SOURCE CODE

This article is accompanied by a sample source code Visual Studio project which is available for download here . USING THE SAMPLE APPLICATION This article’s accompanying sample source code includes a Windows

Forms based

sample application. The sample application provides an implementation of the concepts explored by this article. Concepts discussed can be easily replicated and tested by using the sample application.

Source/input image

files can be specified from the local file

system

when clicking the _LOAD IMAGE_ button. Additionally users also have the option to save resulting filtered images

by

clicking the _SAVE IMAGE_ button. The sample application user interface enables the user  to specify three filter configuration values. These values serve as input parameters to the _MIN/MAX EDGE DETECTION FILTER_ and can be described

as follows:

* _FILTER SIZE – _Determines the number of surrounding pixels to consider when calculating the minimum and maximum pixel values. This value equates to the size of a pixel’s neighbourhood of pixels. When gradient edges expressed in a source image requires a higher or lower level of expression in result images the filter size value should be adjusted. Higher _FILTER SIZE_ values result in gradient edges being expressed at greater intensity levels in resulting images. Inversely, lower _FILTER SIZE_ values delivers the opposite result of gradient edges being expressed at lesser

intensity levels.

* _SMOOTH NOISE – _Image noise when present in source images, can to varying degrees affect the _MIN/MAX EDGE DETECTION FILTER’S_ accuracy in calculating gradient edges. In order to reduce the negative affects of source image noise an image smoothing filter may be implemented. Smoothing out image noise requires additional filter processing and therefore requires additional computation time. If source images reflect minor or no image noise, additional image smoothing may be excluded to reduce filter processing duration. * _GRAYSCALE – _When required, result images can be expressed in grayscale through configuring

this value.

The following image represents a screenshot of the _MIN/MAX EDGE DETECTION SAMPLE APPLICATION_ in action. MIN/MAX EDGE DETECTION The method of edge detection

illustrated in this

article can be classified as a variation of commonly implemented edge detection methods. Image edges

expressed within a

source image

can be determined through the presence of sudden and significant changes in gradient levels that occur within a small/limited

perimeter.

As a means to determine gradient level changes the _MIN/MAX EDGE DETECTION ALGORITHM_ performs pixel neighbourhood

inspection,

comparing maximum and minimum colour channel values. Should the difference between maximum and minimum colour values be significant, it would be an indication of a significant change in gradient level within the pixel neighbourhood

being

inspected.

Image noise represents interference in relation to regular gradient level expression. Image noise does not signal the presence of an image edge

, although could

potentially result in incorrectly determining image edge presence. Image noise and the negative impact thereof can be significantly reduced when applying image smoothing, also sometimes referred to as image blur

. The _MIN/MAX EDGE

DETECTION ALGORITHM_ makes provision for optional image smoothing implemented in the form of a median

filter.

The following sections provide more detail regarding the concepts introduced in this section, pixel neighbourhood and median

filter.

_FROG FILTER 3×3 SMOOTHED_

PIXEL NEIGHBOURHOOD

A pixel neighbourhood

refers to a

set of pixels, all of which are related through pixel location coordinates. The width and height of a pixel neighbourhood

must be

equal, in other words, a pixel neighbourhood can only be square. Additionally, the width/height of a pixel neighbourhood must be an uneven value. When inspecting a pixel’s neighbouring pixels, the pixel being inspected will always be located at the exact center of the pixel neighbourhood

. Only when

a pixel neighbourhood’s width/height are an uneven value can such a

pixel neighbourhood

have an

exact center pixel. Each pixel represented in an image has a different set of neighbours, some neighbours overlap, but no two pixels have the exact same neighbours. A pixel’s neighbouring pixels can be determined when considering the pixel to be at the center of a block of pixels, extending half the neighbourhood size less one in horizontal, vertical and diagonal directions.

MEDIAN FILTER

In context of this article and the _MIN/MAX EDGE DETECTION FILTER, _median filtering has been implemented as a means to reduce source image noise. From the Median Wikipedia page we gain the following quote: > In statistics  and > probability theory > , the MEDIAN is > the number separating the higher half of a data sample

> , a population

> , or a

> probability distribution

> , from the

> lower half. The _median_ of a finite list of numbers can be found by > arranging all the observations from lowest value to highest value > and picking the middle one (e.g., the median of {3, 3, 5, 9, 11} is

> 5).

_FROG FILTER 3×3 SMOOTHED_ The application of a median filter is based in the concept of pixel neighbourhood

as

discussed earlier. The implementation steps required when applying a median filter can be described as follows: * _ITERATE EVERY PIXEL_. The pixel neighbourhood

of each

pixel in a source image needs to be determined and inspected. * _ORDER/SORT PIXEL NEIGHBOURHOOD VALUES_. Once a pixel neighbourhood for a specific pixel has been determined the values expressed by all the pixels in that neighbourhood needs to be sorted or ordered according to value. * _DETERMINE MIDPOINT VALUE. _In relation to the sorted pixel

neighbourhood

values, the

value positioned exactly halfway between first and last value needs to be determined. As an example, if a pixel neighbourhood contains a total of nine pixels, the midpoint would be at position number five, which is four positions from the first and last value inclusive. The midpoint value in a sorted range of neighbourhood pixel values, is the median value of that pixel neighbourhood’s values. The median filter should not be confused with the mean filter . A median will always be a midpoint value from a sorted value range, whereas a mean value is equal to the calculated average of a value range. The median filter has the characteristic of reducing image noise whilst still preserving image edges . The mean filter will also reduce image noise, but will do so through generalized image blurring , also referred to as box blur , which does not preserve

image edges .

_NOTE _that when applying a median filter to _RGB COLOUR IMAGES_ median values need to be determined per individual colour channel. _FROG FILTER 3×3 SMOOTHED_ MIN/MAX EDGE DETECTION ALGORITHM Image edge detection based in a min/max approach requires relatively few steps, which can be combined in source code implementations to be more efficient from a computational/processing perspective. A higher level logical definition of the steps required can be described as follows: * _IMAGE NOISE REDUCTION_ – If image noise reduction

is required apply a

median filter to the source

image.

* _ITERATE THROUGH ALL OF THE PIXELS_ contained within an image

.

* For each pixel being iterated, _DETERMINE THE NEIGHBOURING PIXELS_. The pixel neighbourhood

size will

be determined by the specified filter size. * _DETERMINE THE MINIMUM AND MAXIMUM _pixel value expressed within the pixel neighbourhood. * _SUBTRACT THE MINIMUM FROM THE MAXIMUM_ value and assign the result to the pixel currently being iterated. * _APPLY GRAYSCALE CONVERSION_ to the pixel currently being iterated, only if grayscale conversion had been configured. IMPLEMENTING A MIN/MAX EDGE DETECTION FILTER The source code implementation of the _MIN/MAX EDGE DETECTION FILTER_ declares two methods, a median filter method and an edge detection method. A median filter and edge detection filter cannot be processed simultaneously. When applying a median filter, the median value of a pixel neighbourhood determined from a source image should be expressed in a separate result image. The original source image should not be altered whilst inspecting pixel neighbourhoods and calculating median values. Only once all pixel values in the result image has been set, can the result image serve as a source image to an edge detection filter

method.

The following code snippet provides the source code definition of the _MEDIANFILTER_ method. private static byte MedianFilter(this byte pixelBuffer,

int imageWidth,

int imageHeight,

int filterSize)

{

byte resultBuffer = new byte; int filterOffset = (filterSize - 1) / 2; int calcOffset = 0; int stride = imageWidth * pixelByteCount; int byteOffset = 0; var neighbourCount = filterSize * filterSize; int medianIndex = neighbourCount / 2; var blueNeighbours = new byte; var greenNeighbours = new byte; var redNeighbours = new byte; for (int offsetY = filterOffset; offsetY < imageHeight - filterOffset; offsetY++)

{

for (int offsetX = filterOffset; offsetX < imageWidth - filterOffset; offsetX++)

{

byteOffset = offsetY *

stride +

offsetX * pixelByteCount; for (int filterY = -filterOffset, neighbour = 0; filterY <= filterOffset; filterY++)

{

for (int filterX = -filterOffset; filterX <= filterOffset; filterX++, neighbour++)

{

calcOffset = byteOffset + (filterX * pixelByteCount) + (filterY * stride); blueNeighbours = pixelBuffer; greenNeighbours = pixelBuffer; redNeighbours = pixelBuffer;

}

}

Array.Sort(blueNeighbours); Array.Sort(greenNeighbours); Array.Sort(redNeighbours); resultBuffer = blueNeighbours; resultBuffer = greenNeighbours; resultBuffer = redNeighbours; resultBuffer = maxByteValue;

}

}

return resultBuffer;

}

Notice the definition of three separate byte

arrays, each

intended to represent a pixel neighbourhood

’s pixel

values related to a specific colour channel. Each neighbourhood colour channel byte array needs to be sorted according to value. The value located at the array index exactly halfway from the start and the end of the array represents the median value. When a median value has been determined, the result buffer pixel related to the source buffer pixel in terms of _XY LOCATION_ needs to be set. _FROG FILTER 3×3 SMOOTHED_ The sample source code defines two overloaded versions of an edge detection method. The first version is defined as an extension method targeting the Bitmap class. A _FILTERSIZE _parameter is the only required parameter, intended to specify pixel neighbourhood width/height. In addition, when invoking this method  optional parameters may be specified. When image noise reduction should be implemented the _SMOOTHNOISE_ parameter should be defined as _TRUE. _If resulting images are required in grayscale the last parameter, grayscale , should reflect true. The following code snippet provides the definition of the _MINMAXEDGEDETECTION_ method. public static Bitmap MinMaxEdgeDetection(this Bitmap sourceBitmap,

int filterSize,

bool smoothNoise = false, bool grayscale = false)

{

return sourceBitmap.ToPixelBuffer() .MinMaxEdgeDetection(sourceBitmap.Width, sourceBitmap.Height,

filterSize,

smoothNoise,

grayscale)

.ToBitmap(sourceBitmap.Width, sourceBitmap.Height);

}

The _MINMAXEDGEDETECTION_ method as expressed above essentially acts as a wrapper method, invoking the overloaded version of this method, performing mapping between Bitmap objects and byte array pixel buffers. An overloaded version of the _MINMAXEDGEDETECTION_ method performs all of the tasks required in edge detection through means of minimum maximum pixel neighbourhood

value

subtraction. The method definition as provided by the following code

snippet.

private static byte MinMaxEdgeDetection(this byte sourceBuffer,

int imageWidth,

int imageHeight,

int filterSize,

bool smoothNoise = false, bool grayscale = false)

{

byte pixelBuffer = sourceBuffer;

if (smoothNoise)

{

pixelBuffer = sourceBuffer.MedianFilter(imageWidth,

imageHeight,

filterSize);

}

byte resultBuffer = new byte; int filterOffset = (filterSize - 1) / 2; int calcOffset = 0; int stride = imageWidth * pixelByteCount; int byteOffset = 0; byte minBlue = 0, minGreen = 0, minRed = 0; byte maxBlue = 0, maxGreen = 0, maxRed = 0; for (int offsetY = filterOffset; offsetY < imageHeight - filterOffset; offsetY++)

{

for (int offsetX = filterOffset; offsetX < imageWidth - filterOffset; offsetX++)

{

byteOffset = offsetY *

stride +

offsetX * pixelByteCount; minBlue = maxByteValue; minGreen = maxByteValue; minRed = maxByteValue; maxBlue = minByteValue; maxGreen = minByteValue; maxRed = minByteValue; for (int filterY = -filterOffset; filterY <= filterOffset; filterY++)

{

for (int filterX = -filterOffset; filterX <= filterOffset; filterX++)

{

calcOffset = byteOffset + (filterX * pixelByteCount) + (filterY * stride); minBlue = Math.Min(pixelBuffer, minBlue); maxBlue = Math.Max(pixelBuffer, maxBlue); minGreen = Math.Min(pixelBuffer, minGreen); maxGreen = Math.Max(pixelBuffer, maxGreen); minRed = Math.Min(pixelBuffer, minRed); maxRed = Math.Max(pixelBuffer, maxRed);

}

}

if (grayscale)

{

resultBuffer = ByteVal((maxBlue - minBlue) * 0.114 + (maxGreen - minGreen) * 0.587 + (maxRed - minRed) * 0.299); resultBuffer = resultBuffer; resultBuffer = resultBuffer; resultBuffer = maxByteValue;

}

else

{

resultBuffer = (byte)(maxBlue - minBlue); resultBuffer = (byte)(maxGreen - minGreen); resultBuffer = (byte)(maxRed - minRed); resultBuffer = maxByteValue;

}

}

}

return resultBuffer;

}

As discussed earlier, image noise reduction if required should be the first task performed. Based on parameter value the method applies a median filter to the source

image buffer.

When iterating a pixel neighbourhood

a

comparison is performed between the currently iterated neighbouring pixel’s value and the previously determined minimum and maximum

values.

When the grayscale method parameter reflects _TRUE_, a grayscale algorithm is applied to the difference between the determined maximum and minimum pixel

neighbourhood

values.

Should the grayscale method parameter reflect _FALSE, _grayscale algorithm logic will not execute. Instead, the result obtained from subtracting the determined minimum and maximum values are assigned to the relevant pixel and colour channel on the result buffer image. _FROG FILTER 3×3 SMOOTHED_

SAMPLE IMAGES

This article features several sample images provided as examples. All sample images were created using the sample application. All of the original source images used in generating sample images have been licensed by their respective authors to allow for reproduction here. The following section lists each original source image and related license and copyright details.

Red-eyed Tree Frog

(_Agalychnis callidryas

_), photographed

near Playa Jaco in Costa Rica © 2007 Careyjamesbalboa

(Carey James

Balboa)_ _has been released into the PUBLIC DOMAIN

by the author.

Yellow-Banded Poison Dart Frog

2013 H. Krisp

_ __ _is used here under a Creative Commons

Attribution 3.0

Unported

license.

Green and Black Poison Dart Frog

2011 H. Krisp

_ __ _is used here under a Creative Commons

Attribution 3.0

Unported

license.

Atelopus certus calling male 2010 Brian Gratwicke _ __ _is used here under

a Creative Commons

Attribution 2.0 Generic

license.

Tyler’s Tree Frog (Litoria tyleri)

2006

LiquidGhoul

_ __ _has been

released into the PUBLIC DOMAIN

by the author.

_Dendropsophus microcephalus

_

2010 Brian Gratwicke _ __ _is used here under

a Creative Commons

Attribution 2.0 Generic

license.

RELATED ARTICLES AND FEEDBACK Feedback and questions are always encouraged. If you know of an alternative implementation or have ideas on a more efficient implementation please share in the comments section. _DEWALD ESTERHUIZEN _ I’ve published a number of articles related to imaging and images of which you can find URL links here: * C# How to: Image filtering by directly manipulating Pixel ARGB

values

* C# How to: Image filtering implemented using a ColorMatrix * C# How to: Blending Bitmap images using colour filters * C# How to: Bitmap Colour Substitution implementing thresholds * C# How to: Generating Icons from Images * C# How to: Swapping Bitmap ARGB Colour Channels * C# How to: Bitmap Pixel manipulation using LINQ Queries * C# How to: Linq to Bitmaps – Partial Colour Inversion * C# How to: Bitmap Colour Balance * C# How to: Bi-tonal Bitmaps * C# How to: Bitmap Colour Tint * C# How to: Bitmap Colour Shading * C# How to: Image Solarise * C# How to: Image Contrast * C# How to: Bitwise Bitmap Blending * C# How to: Image Arithmetic * C# How to: Image Convolution * C# How to: Image Edge Detection * C# How to: Difference Of Gaussians * C# How to: Image Median Filter * C# How to: Image Unsharp Mask * C# How to: Image Colour Average * C# How to: Image Erosion and Dilation * C# How to: Morphological Edge Detection * C# How to: Boolean Edge Detection * C# How to: Gradient Based Edge Detection * C# How to: Sharpen Edge Detection * C# How to: Image Cartoon Effect * C# How to: Calculating Gaussian Kernels * C# How to: Image Blur * C# How to: Image Transform Rotate * C# How to: Image Transform Shear * C# How to: Compass Edge Detection * C# How to: Oil Painting and Cartoon Filter * C# How to: Stained Glass Image Filter * C# How to: Image ASCII Art * C# How to: Weighted Difference of Gaussians * C# How to: Image Boundary Extraction * C# How to: Image Abstract Colours Filter * C# How to: Fuzzy Blur Filter

RATE THIS:

i

14 Votes

SHARE THIS:

* Twitter

* Facebook

* Reddit

* LinkedIn

* Tumblr

* Pinterest

* Pocket

* Email

* Print

*

LIKE THIS:

Like Loading...

C# HOW TO: STANDARD DEVIATION EDGE DETECTION Published August 8, 2015 C#

, Code

Samples , Edge

Detection

, Extension Methods

, Graphic Filters

, Graphics , How to

, Image

Arithmetic

, Image Filtering

, Image

Filters

,

Image Processing

, Opensource

Leave a Comment

Tags: Alpha Red Green Blue

, Augmented

Reality , Binary

Image , Bitmap ARGB

, Bitmap Filters

, Bitmap.LockBits

, BitmapData

, Blur

, C#

, Code Sample

, Color Filters

, Computer vision

, Converting

Images , Edge

Detection ,

Extension Methods

, Graphic

Filters , How to

, Image

, Image Intensity

, Image

Manipulation ,

Image processing

, Image Transform

, Machine vision

, Median Filter

, Pixel Filters

, Standard Deviation

ARTICLE PURPOSE

This article explores image edge detection implemented through computing pixel neighbourhood standard deviation

on RGB colour

images

.

The main sections of this article consists of a detailed explanation of the concepts related to the _STANDARD DEVIATION EDGE DETECTION ALGORITHM_ and an in-depth discussion and a practical implementation through source code. _BUTTERFLY FILTER 3×3 FACTOR 5.0_

SAMPLE SOURCE CODE

This article is accompanied by a sample source code Visual Studio project which is available for download here . USING THE SAMPLE APPLICATION This article’s accompanying sample source code includes a Windows

Forms based

sample application. The sample application provides an implementation of the concepts explored by this article. Concepts discussed can be easily replicated and tested by using the sample application.

Source/input image

files can be specified from the local file

system

when clicking the _LOAD IMAGE_ button. Additionally users also have the option to save resulting filtered images

by

clicking the _SAVE IMAGE_ button. The sample application user interface exposes three filter configuration values to the end user in the form of predefined filter size values, a grayscale output flag and a variance factor. End users can configure whether filtered result images should

express image edges

using source image

colour values or in grayscale . The filter size value specified by the user determines the number of pixels included when calculating

standard deviation

values.

Filter size has a direct correlation to the extend at which gradient edges will be represented in resulting images. Faint edge values require larger filter size values in order to be expressed in a resulting output image

.

Larger filter size values require additional computation and would thus have a longer completion time when compared to smaller filter

size values.

The following screenshot captures the _STANDARD DEVIATION EDGE DETECTION _sample application in action. STANDARD DEVIATION EDGE DETECTION Image edge detection can be achieved through a variety of methods, each associated with particular benefits and trade offs. This article is focussed on image edge detection through implementing standard deviation

calculations on a

pixel neighbourhood.

PIXEL NEIGHBOURHOOD

A pixel neighbourhood refers to a set of pixels, all of which are related through pixel location coordinates. The width and height of a pixel neighbourhood must be equal, in other words, a pixel neighbourhood can only be square. Additionally, the width/height of a pixel neighbourhood must be an uneven value. When inspecting a pixel’s neighbouring pixels, the pixel being inspected will always be located at the exact center of the pixel neighbourhood. Only when a pixel neighbourhood’s width/height are an uneven value can such a pixel neighbourhood have an exact center pixel. Each pixel represented in an image has a different set of neighbours, some neighbours overlap, but no two pixels have the exact same neighbours. A pixel’s neighbouring pixels can be determined when considering the pixel to be at the center of a block of pixels, extending half the neighbourhood size less one in horizontal, vertical and diagonal directions. _BUTTERFLY FILTER 3×3 FACTOR 5_ PIXEL NEIGHBOURHOOD MEAN VALUE Mean value calculation forms a core part in calculating standard deviation

. The mean value

from a set of values could be considered equivalent to the value set’s average value. The average of a set of  values can be calculated as the sum total of all the values in a set, divided by the number of values in the set.

STANDARD DEVIATION

From the Standard Deviation

Wikipedia

page we gain the following

quote:

> In statistics , the > STANDARD DEVIATION (SD, also represented by the Greek letter sigma, > Σ  for the population standard > deviation or S for the sample standard deviation) is a measure that > is used to quantify the amount of variation or dispersion

>  of a set of

> data values. A standard deviation close to 0 indicates that the data > points tend to be very close to the mean >  (also called the expected > value) of the set, while a high standard deviation indicates that > the data points are spread out over a wider range of values A pixel neighbourhood’s standard deviation

can indicate

whether a significant change in image gradient is present in a pixel neighbourhood. A large standard

deviation value is

an indication that the neighbourhood’s pixel values could be spread far from the calculated mean . Inversely, a small standard deviation

will indicate that

the neighbourhood’s pixel values are closer to the calculated mean . A sudden change in image gradient will equate to a large standard deviation. Steps required in calculating standard deviation

can be described as

follows:

* Calculate the _MEAN_ value. Calculate the sum of all pixels in a pixel neighbourhood then divide the sum total using the number of pixels contained in a neighbourhood. In essence calculating the mean value should be seen as calculating the average of all the pixels in a

neighbourhood.

* Calculate combined _VARIANCE_ using Mean value. Subtract the mean value from each pixel in the neighbourhood, the result should be squared and added to a sum total. Variance should then be calculated as the calculated mean subtracted squared pixel value divided using the number of pixels in a neighbourhood. * Calculate standard deviation

as the _VARIANCE

SQUARE ROOT._

_BUTTERFLY FILTER 3×3 FACTOR 5_ STANDARD DEVIATION EDGE DETECTION ALGORITHM The _STANDARD DEVIATION EDGE DETECTION ALGORITHM_ is based in the concept of standard deviation

, providing

additional capabilities. The algorithm allows for a more prominent expression of variance through means of a  _VARIANCE FACTOR_. Calculated variance values can be increased or decreased when implementing a variance factor. When variances are less significant, resulting images will express gradient edges at faint/low intensity levels. Providing a variance factor will result in output images expressing gradient edges at a higher intensity. Variance factor and filter size should not be confused. When source gradient edges are expressed at low intensities, higher filter sizes would result in those low intensity source edges to be expressed in resulting images. In a scenario where high intensity gradient edges from a source image are expressed in resulting images at low intensities, a higher variance factor would increase resulting image gradient

edge intensity.

The following list provides a summary of the steps required  to implement the standard deviation

edge detection

algorithm:

* _ITERATE THROUGH ALL OF THE PIXELS_ contained within an image

.

* For each pixel being iterated, _DETERMINE THE NEIGHBOURING PIXELS_. The pixel neighbourhood size will be determined by the specified filter size. * _CALCULATE THE_ _MEAN_ value of the current pixel neighbourhood. * _CALCULATE THE_ _VARIANCE. _Subtract the Mean value from each neighbourhood pixel, the result should be squared and summed to a variance total value. Finally, the variance total value should be divided by the number of pixels that make up the pixel  neighbourhood. If a variance factor had been specified, the calculated variance value should be multiplied against it and the result assigned as the new calculated variance

value.

* _CALCULATE THE STANDARD DEVIATION. _Once the variance has been calculated the

standard deviation

can be expressed as the square root of the calculated variance value. The standard deviation

value should be

assigned to the result buffer pixel relating to the source buffer pixel currently being iterated. It is _IMPORTANT TO NOTE_ that the steps as described above should be applied per individual colour channel, _RED_, _GREEN_ and _BLUE_. _BUTTERFLY FILTER 3×3 FACTOR 4.5_ IMPLEMENTING A STANDARD DEVIATION EDGE DETECTION FILTER The sample source code that accompanies this article provides a public

extension method

targeting the Bitmap class. A private overloaded implementation of the _STANDARDDEVIATIONEDGEDETECTION_ method performs the bulk of the required functionality. The following code snippet illustrates the public overloaded version of the _STANDARDDEVIATIONEDGEDETECTION_

method:

public static Bitmap StandardDeviationEdgeDetection(this Bitmap sourceBuffer,

int filterSize,

float varianceFactor = 1.0f, bool grayscaleOutput = true)

{

return sourceBuffer.ToPixelBuffer() .StandardDeviationEdgeDetection(sourceBuffer.Width, sourceBuffer.Height,

filterSize,

varianceFactor,

grayscaleOutput)

.ToBitmap(sourceBuffer.Width, sourceBuffer.Height);

}

The _STANDARDDEVIATIONEDGEDETECTION_ method accepts 3 parameters, the

first Bitmap

parameter serves to signal that the method is an extension method targeting the Bitmap class. A brief description of the other parameters as follows: * _FILTERSIZE _determines the pixel neighbourhood size. Note that the parameter is expected to reflect the pixel neighbourhood width/height. As an example, a _FILTERSIZE_  parameter value provided as 3 would equate to a pixel neighbourhood consisting of 9 pixels, as would a _FILTERSIZE_ of 5 indicate a neighbourhood of 25 pixels. * _VARIANCEFACTOR _signifies the factor value applied to a calculated variance. * _GRAYSCALE _being a boolean value indicates whether the resulting

image

should be represented in grayscale , or in the original colour values from the source image

.

_BUTTERFLY FILTER 3×3 FACTOR 4_ The following code snippet relates the private implementation of the _STANDARDDEVIATIONEDGEDETECTION _method, which performs all of the tasks required to implement the _STANDARD DEVIATION EDGE DETECTION

ALGORITHM_.

private static byte StandardDeviationEdgeDetection(this byte pixelBuffer,

int imageWidth,

int imageHeight,

int filterSize,

float varianceFactor = 1.0f, bool grayscaleOutput = true)

{

byte resultBuffer = new byte; int filterOffset = (filterSize - 1) / 2; int calcOffset = 0; int stride = imageWidth * pixelByteCount; int byteOffset = 0; var neighbourCount = filterSize * filterSize; var blueNeighbours = new int; var greenNeighbours = new int; var redNeighbours = new int; double resetValue = 0; double meanBlue = 0, meanGreen = 0, meanRed = 0; double varianceBlue = 0, varianceGreen = 0, varianceRed = 0; varianceFactor = varianceFactor * varianceFactor; for (int offsetY = filterOffset; offsetY < imageHeight - filterOffset; offsetY++)

{

for (int offsetX = filterOffset; offsetX < imageWidth - filterOffset; offsetX++)

{

byteOffset = offsetY *

stride +

offsetX * pixelByteCount; meanBlue = resetValue; meanGreen = resetValue; meanRed = resetValue; varianceBlue = resetValue; varianceGreen = resetValue; varianceRed = resetValue; for (int filterY = -filterOffset, neighbour = 0; filterY <= filterOffset; filterY++)

{

for (int filterX = -filterOffset; filterX <= filterOffset; filterX++, neighbour++)

{

calcOffset = byteOffset + (filterX * pixelByteCount) + (filterY * stride); blueNeighbours = pixelBuffer; greenNeighbours = pixelBuffer; redNeighbours = pixelBuffer;

}

}

meanBlue = blueNeighbours.Average(); meanGreen = greenNeighbours.Average(); meanRed = redNeighbours.Average(); for (int n = 0; n < neighbourCount; n++)

{

varianceBlue = varianceBlue + SquareNumber(blueNeighbours - meanBlue); varianceGreen = varianceGreen + SquareNumber(greenNeighbours - meanGreen); varianceRed = varianceRed + SquareNumber(redNeighbours - meanRed);

}

varianceBlue = varianceBlue /

neighbourCount *

varianceFactor;

varianceGreen = varianceGreen /

neighbourCount *

varianceFactor;

varianceRed = varianceRed /

neighbourCount *

varianceFactor;

if (grayscaleOutput)

{

var pixelValue = ByteVal(ByteVal(Math.Sqrt(varianceBlue)) | ByteVal(Math.Sqrt(varianceGreen)) | ByteVal(Math.Sqrt(varianceRed))); resultBuffer = pixelValue; resultBuffer = pixelValue; resultBuffer = pixelValue; resultBuffer = Byte.MaxValue;

}

else

{

resultBuffer = ByteVal(Math.Sqrt(varianceBlue)); resultBuffer = ByteVal(Math.Sqrt(varianceGreen)); resultBuffer = ByteVal(Math.Sqrt(varianceRed)); resultBuffer = Byte.MaxValue;

}

}

}

return resultBuffer;

}

This method features several _FOR_ loops, resulting in each image pixel being iterated. Notice how the two inner most loops declare negative initializer values. In order to determine a pixel’s neighbourhood, the pixel should be considered as being located at the exact center of the neighbourhood. Negative initializer values enable the code to determine neighbouring pixels located to the left and above of the pixel being iterated. A pixel neighbourhood needs to be determined in terms of each colour channel, _RED_, _GREEN_ and _BLUE_. The pixel neighbourhood of each colour channel must be averaged individually.  Logically it follows that pixel neighbourhood variance should also be calculated per

colour channel.

The method signature indicates the _VARIANCEFACTOR_ parameter should be optional and assigned a default value of 1.0. Should a variance factor not be required, implementing a default factor value of 1.0 will not result in any change to the calculated variance

value.

When grayscale output has been configured the resulting output pixel will express the same value on all three colour channels. The grayscale value will be calculated through the application of a bitwise _OR _operation, applied to the

standard deviation

of each colour channel. The square root of a pixel neighbourhood’s variance provides the

standard deviation

value for that pixel neighbourhood. If grayscale output had not been configured the resulting pixel colour channels will be assigned the standard deviation

of the related

colour channel on the source pixel. private const byte maxByteValue = Byte.MaxValue; private const byte minByteValue = Byte.MinValue; public static byte ByteVal(int val)

{

if (val < minByteValue) { return  minByteValue; } else if (val > maxByteValue) { return  maxByteValue; } else { return (byte)val; }

}

The _STANDARDDEVIATIONEDGEDETECTION _method reflects several references to the _BYTEVAL _method, as illustrated in the code snippet above. Casting _DOUBLE_ and _INT_ values to byte

values could

result in values exceeding the upper and lower bounds allowed by the

byte type. The

_BYTEVAL _method tests whether a value would exceed upper and lower bounds, when determined to do so the resulting value is assigned either the upper inclusive bound or lower inclusive bound value, depending on the bound being exceeded. _BEE FILTER 3×3 FACTOR 5_

SAMPLE IMAGES

This article features several sample images provided as examples. All sample images were created using the sample application. All of the original source images used in generating sample images have been licensed by their respective authors to allow for reproduction here. The following section lists each original source image and related license and copyright details. _Viceroy (Limenitis archippus), Mer Bleue Conservation Area, Ottawa,

Ontario  _©

2008_ _D. Gordon E. Robertson _ _is used here under a

Creative Commons

Attribution-Share Alike 3.0 Unported

license.

------------------------- Old World Swallowtail on Buddleja davidii 2008 Thomas Bresson

is used here

under a Creative Commons

Attribution 2.0

Generic

license.

------------------------- Cethosia cyane butterfly

2006

Airbete _ _is used

here under a Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

------------------------- “Weiße Baumnymphe (Idea leuconoe) fotografiert im Schmetterlingshaus des Maximilianpark Hamm” 2009 Steffen Flor is used here under a  Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

------------------------- "Dark Blue Tiger tirumala septentrionis by kadavoor" 2010 Jeevan Jose, Kerala, India

is used here under

a Creative Commons Attribution-ShareAlike 4.0 International License ------------------------- "Common Lime Butterfly Papilio demoleus by Kadavoor" 2010 Jeevan Jose, Kerala, India

is used here under

a Creative Commons Attribution-ShareAlike 4.0 International License ------------------------- Syrphidae, Knüllwald, Hessen, Deutschland

2007

Fritz Geller-Grimm

is used here under a Creative Commons

Attribution-Share

Alike 3.0 Unported

license

------------------------- RELATED ARTICLES AND FEEDBACK Feedback and questions are always encouraged. If you know of an alternative implementation or have ideas on a more efficient implementation please share in the comments section. _DEWALD ESTERHUIZEN _ I’ve published a number of articles related to imaging and images of which you can find URL links here: * C# How to: Image filtering by directly manipulating Pixel ARGB

values

* C# How to: Image filtering implemented using a ColorMatrix * C# How to: Blending Bitmap images using colour filters * C# How to: Bitmap Colour Substitution implementing thresholds * C# How to: Generating Icons from Images * C# How to: Swapping Bitmap ARGB Colour Channels * C# How to: Bitmap Pixel manipulation using LINQ Queries * C# How to: Linq to Bitmaps – Partial Colour Inversion * C# How to: Bitmap Colour Balance * C# How to: Bi-tonal Bitmaps * C# How to: Bitmap Colour Tint * C# How to: Bitmap Colour Shading * C# How to: Image Solarise * C# How to: Image Contrast * C# How to: Bitwise Bitmap Blending * C# How to: Image Arithmetic * C# How to: Image Convolution * C# How to: Image Edge Detection * C# How to: Difference Of Gaussians * C# How to: Image Median Filter * C# How to: Image Unsharp Mask * C# How to: Image Colour Average * C# How to: Image Erosion and Dilation * C# How to: Morphological Edge Detection * C# How to: Boolean Edge Detection * C# How to: Gradient Based Edge Detection * C# How to: Sharpen Edge Detection * C# How to: Image Cartoon Effect * C# How to: Calculating Gaussian Kernels * C# How to: Image Blur * C# How to: Image Transform Rotate * C# How to: Image Transform Shear * C# How to: Compass Edge Detection * C# How to: Oil Painting and Cartoon Filter * C# How to: Stained Glass Image Filter * C# How to: Image ASCII Art * C# How to: Weighted Difference of Gaussians * C# How to: Image Boundary Extraction * C# How to: Image Abstract Colours Filter * C# How to: Fuzzy Blur Filter

RATE THIS:

i

13 Votes

SHARE THIS:

* Twitter

* Facebook

* Reddit

* LinkedIn

* Tumblr

* Pinterest

* Pocket

* Email

* Print

*

LIKE THIS:

Like Loading...

C# HOW TO: IMAGE DISTORTION BLUR Published August 9, 2013 Augmented Reality

, Blogging

, C#

, Code

Samples ,

Extension Methods

, Graphic Filters

, Graphics , How to

, Image

Filters

,

Image Processing

, Image Transform

, Microsoft , New

Version ,

Non-Photorealistic Rendering

, Opensource ,

Tip , Update

Leave a Comment

Tags: Alpha Red Green Blue

, Augmented

Reality , Binary

Image , Bitmap ARGB

, Bitmap Filters

, Bitmap.LockBits

, BitmapData

, Blur

, C#

, Code Sample

, Color Filters

, Computer vision

, Converting

Images ,

Extension Methods

, Graphic

Filters , How to

, Image

, Image Blur

, Image Distortion

, Image Intensity

, Image

Manipulation ,

Image processing

, Image Transform

, Machine vision

, Median Filter

, Morphologial

Filters ,

Non-Photorealistic Rendering

,

Pixel Filters

ARTICLE PURPOSE

This article explores the process of implementing an _IMAGE DISTORTION BLUR FILTER_. This image filter is classified as a non-photo realistic image filter, primarily implemented in rendering artistic effects. _FLOWER: DISTORTION FACTOR 15_

SAMPLE SOURCE CODE

This article is accompanied by a sample source code Visual Studio project which is available for download here

.

_FLOWER: DISTORTION FACTOR 10_ USING THE SAMPLE APPLICATION The sample source code that accompanies this article includes a

Windows Forms

based sample application. The concepts explored in this article have all been implemented as part of the sample application. From an end user perspective the following configurable options are available: * _LOAD/SAVE IMAGES –_ Clicking the _LOAD IMAGE_ button allows a user to specify a source/input image

.

If desired, output filtered images can be saved to the local file

system

by clicking the _SAVE IMAGE_ button. * _DISTORTION FACTOR –_ The level or intensity of image distortion applied when implementing the filter can be specified when adjusting the _DISTORTION FACTOR_ through the user interface. Lower factor values result in less distortion being evident in resulting

images

.

Specifying higher factor values result in more intense image distortion being applied. The following image is screenshot of the _IMAGE DISTORTION BLUR_

sample application:

_FLOWER: DISTORTION FACTOR 10_ _FLOWER: DISTORTION FACTOR 10_

IMAGE DISTORTION

In this article and the accompanying sample source code images are distorted through slightly adjusting each individual pixel ’s coordinates. The direction and distance by which pixel coordinates are adjusted differ per pixel as a result of being randomly selected. The maximum distance offset applied depends on the user specified _DISTORTION FACTOR_. Once all pixel coordinates have been updated, implementing a Median Filter provides smoothing and an

image blur effect.

Applying an _IMAGE DISTORTION FILTER_ requires implementing the

following steps:

* _ITERATE PIXELS –_ Each pixel forming part of the source/input

image

should be iterated.

* _CALCULATE NEW COORDINATES –_ For every pixel being iterated generate two random values representing _XY-COORDINATE_ offsets to be applied to a pixel ’s current coordinates. Offset values can equate to less than zero in order to represent coordinates above or to the left of the current pixel

.

* _APPLY MEDIAN FILTER –_ The newly offset pixels will appear somewhat speckled in

the resulting image

.

Applying a Median Filter reduces the speckled appearance whilst retaining a distortion effect. _FLOWER: DISTORTION FACTOR 10_ _FLOWER: DISTORTION FACTOR 10_

MEDIAN FILTER

Applying a Median Filter is the final step required when implementing an _IMAGE DISTORTION BLUR FILTER_. Median Filters are often implemented in reducing image noise . The method of image distortion illustrated in this article express similarities when compared to image noise . In order to soften the appearance of image noise we implement a Median

Filter .

A Median Filter can be applied through implementing the following steps: * _ITERATE PIXELS –_ Each pixel forming part of the source/input

image

should be iterated.

* _INSPECT PIXEL NEIGHBOURHOOD –_ Each neighbouring pixel in relation to the pixel currently being iterated should be added to a temporary collection. * _DETERMINE NEIGHBOURHOOD MEDIAN –_ Once all neighbourhood pixels have been added to a temporary collection, sort the collection by value. The element value located at the middle of the collection represents the pixel neighbourhood’s Median

value.

_FLOWER: DISTORTION FACTOR 10_ _FLOWER: DISTORTION FACTOR 15_ IMPLEMENTING IMAGE DISTORTION The sample source code defines the _DISTORTIONBLURFILTER_ method, an

extension method

targeting the Bitmap class. The following code snippet illustrates the implementation: public static Bitmap DistortionBlurFilter( this Bitmap sourceBitmap, int distortFactor)

{

byte pixelBuffer = sourceBitmap.GetByteArray(); byte resultBuffer = sourceBitmap.GetByteArray(); int imageStride = sourceBitmap.Width * 4; int calcOffset = 0, filterY = 0, filterX = 0; int factorMax = (distortFactor + 1) * 2; Random rand = new Random(); for (int k = 0; k + 4 < pixelBuffer.Length; k += 4)

{

filterY = distortFactor - rand.Next(0, factorMax); filterX = distortFactor - rand.Next(0, factorMax); if (filterX * 4 + (k % imageStride) < imageStride && filterX * 4 + (k % imageStride) > 0)

{

calcOffset = k + filterY * imageStride +

4 * filterX;

if (calcOffset >= 0 && calcOffset + 4 < resultBuffer.Length)

{

resultBuffer = pixelBuffer; resultBuffer = pixelBuffer; resultBuffer = pixelBuffer;

}

}

}

return resultBuffer.GetImage(sourceBitmap.Width, sourceBitmap.Height).MedianFilter(3);

}

_FLOWER: DISTORTION FACTOR 15_ IMPLEMENTING A MEDIAN FILTER The _MEDIANFILTER_ extension method

targets the Bitmap

class. The implementation as follows: public static Bitmap MedianFilter(this Bitmap sourceBitmap,

int matrixSize)

{

byte pixelBuffer = sourceBitmap.GetByteArray(); byte resultBuffer = new byte;

byte middlePixel;

int imageStride = sourceBitmap.Width * 4; int filterOffset = (matrixSize - 1) / 2; int calcOffset = 0, filterY = 0, filterX = 0; List neighbourPixels = new List(); for (int k = 0; k + 4 < pixelBuffer.Length; k += 4)

{

filterY = -filterOffset; filterX = -filterOffset; neighbourPixels.Clear(); while (filterY <= filterOffset)

{

calcOffset = k + (filterX * 4) + (filterY * imageStride); if (calcOffset > 0 && calcOffset + 4 < pixelBuffer.Length)

{

neighbourPixels.Add(BitConverter.ToInt32( pixelBuffer, calcOffset));

}

filterX++;

if (filterX > filterOffset) { filterX = -filterOffset; filterY++; }

}

neighbourPixels.Sort(); middlePixel = BitConverter.GetBytes(

neighbourPixels);

resultBuffer = middlePixel; resultBuffer = middlePixel; resultBuffer = middlePixel; resultBuffer = middlePixel;

}

return resultBuffer.GetImage(sourceBitmap.Width, sourceBitmap.Height);

}

_FLOWER: DISTORTION FACTOR 25_

SAMPLE IMAGES

This article features a number of sample images. All featured images have been licensed allowing for reproduction. The following images feature as sample images: * _Lilium chalcedonicum_ in habitat at Hrisomiglia, Greece. * _ATTRIBUTION: _Ernst Gügel. This file is licensed under the

Creative Commons

Attribution-Share Alike 3.0 Unported

license.

* Download from Wikipedia * _Lilium ponticum_ in habitat near Ikizdere, Turkey. * _ATTRIBUTION: _Ernst Gügel. This file is licensed under the

Creative Commons

Attribution-Share Alike 3.0 Unported

license.

* Download from Wikipedia * _Lilium sargentiae_ flora. * _ATTRIBUTION: _Denis Barthel

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

* Download from Wikipedia * A lilium longiflorum

, commonly known as

an Easter Lily.

* _ATTRIBUTION: _Matt H. Wade

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

* Download from Wikipedia * Flora _Lilium bulbiferum_ ssp. _croceum_, ex coll. Monte Adone,

Bologna, Italia.

* _ATTRIBUTION: _Denis Barthel

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

* Download from Wikipedia * Turks Cap Lily the Great Smoky Mountains National Park

in

western North Carolina. * _ATTRIBUTION: _Arx Fortis . This file is licensed under the Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

* Download from Wikipedia * Orange Lily in full bloom showing pollen covered stamens, Ontario,

Canada. June 2002.

* _ATTRIBUTION: _Relic38 . This file is licensed under the Creative Commons

Attribution 3.0

Unported license.

* Download from Wikipedia * _ZANTEDESCHIA AETHIOPICA_ (common names CALLA LILY, ARUM LILY). * _ATTRIBUTION: _Two+two=4

. This file has

been released into the PUBLIC DOMAIN

. This applies

worldwide.

* Download from Wikipedia RELATED ARTICLES AND FEEDBACK Feedback and questions are always encouraged. If you know of an alternative implementation or have ideas on a more efficient implementation please share in the comments section. _DEWALD ESTERHUIZEN _ I’ve published a number of articles related to imaging and images of which you can find URL links here: * C# How to: Image filtering by directly manipulating Pixel ARGB

values

* C# How to: Image filtering implemented using a ColorMatrix * C# How to: Blending Bitmap images using colour filters * C# How to: Bitmap Colour Substitution implementing thresholds * C# How to: Generating Icons from Images * C# How to: Swapping Bitmap ARGB Colour Channels * C# How to: Bitmap Pixel manipulation using LINQ Queries * C# How to: Linq to Bitmaps – Partial Colour Inversion * C# How to: Bitmap Colour Balance * C# How to: Bi-tonal Bitmaps * C# How to: Bitmap Colour Tint * C# How to: Bitmap Colour Shading * C# How to: Image Solarise * C# How to: Image Contrast * C# How to: Bitwise Bitmap Blending * C# How to: Image Arithmetic * C# How to: Image Convolution * C# How to: Image Edge Detection * C# How to: Difference Of Gaussians * C# How to: Image Median Filter * C# How to: Image Unsharp Mask * C# How to: Image Colour Average * C# How to: Image Erosion and Dilation * C# How to: Morphological Edge Detection * C# How to: Boolean Edge Detection * C# How to: Gradient Based Edge Detection * C# How to: Sharpen Edge Detection * C# How to: Image Cartoon Effect * C# How to: Calculating Gaussian Kernels * C# How to: Image Blur * C# How to: Image Transform Rotate * C# How to: Image Transform Shear * C# How to: Compass Edge Detection * C# How to: Oil Painting and Cartoon Filter * C# How to: Stained Glass Image Filter * C# How to: Image ASCII Art * C# How to: Weighted Difference of Gaussians * C# How to: Image Boundary Extraction * C# How to: Image Abstract Colours Filter * C# How to: Fuzzy Blur Filter

RATE THIS:

i

13 Votes

SHARE THIS:

* Twitter

* Facebook

* Reddit

* LinkedIn

* Tumblr

* Pinterest

* Pocket

* Email

* Print

*

LIKE THIS:

Like Loading...

C# HOW TO: FUZZY BLUR FILTER Published August 9, 2013 Augmented Reality

, C#

, Code

Samples , Edge

Detection

, Extension Methods

, Graphic Filters

, Graphics , How to

, Image

Convolution

, Image Filters

,

Image Processing

, Microsoft ,

Morphology Filters

, New Version ,

Non-Photorealistic Rendering

, Opensource ,

Tip , Update

3 Comments

Tags: Alpha Red Green Blue

, Augmented

Reality , Binary

Image , Bitmap ARGB

, Bitmap Filters

, Bitmap.LockBits

, BitmapData

, Blur

, Boolean Edge Detection

, Box Blur

, C#

, Calculate Matrix

, Calculating

Kernels , Code

Sample , Color Filters

, Computer vision

, Converting

Images ,

Convolution filters

, Convolution

Kernel ,

Convolution matrix

, Edge Detect

, Edge Detection

, Edge enhance

, Edge Masks

, Extension Methods

, Feature

extraction ,

Fuzzy Blur , Graphic

Filters , How to

, Image

, Image Blur

, Image Edge Detection

, Image

Intensity , Image

Manipulation ,

Image processing

, Image Transform

, Machine vision

, Morphologial

Filters ,

Non-Photorealistic Rendering

,

Pixel Filters

ARTICLE PURPOSE

This article serves to illustrate the concepts involved in implementing a _FUZZY BLUR FILTER_. This filter results in rendering non-photo realistic images which express a certain artistic effect. _FROG: FILTER SIZE 19×19_

SAMPLE SOURCE CODE

This article is accompanied by a sample source code Visual Studio project which is available for download here

.

USING THE SAMPLE APPLICATION The sample source code accompanying this article includes a Windows

Forms based

test application. The concepts explored throughout this article can be replicated/tested using the sample application. When executing the sample application the user interface exposes a number of configurable options: * _LOADING AND SAVING IMAGES –_ Users are able to load

source/input images

from the local file

system

by clicking the _LOAD IMAGE_ button. Clicking the _SAVE IMAGE_ button allow users to save filter result images

.

* _FILTER SIZE –_ The specified filter size affects the filter intensity. Smaller filter sizes result in less blurry images being rendered, whereas larger filter sizes result in more blurry

images

being rendered.

* _EDGE FACTORS –_ The contrast of fuzzy image noise expressed in resulting

images

depend on the specified edge factor values. Values less than one result in detected image edges

being darkened and

values greater than one result in detected image edges

being lightened.

The following image is a screenshot of the _FUZZY BLUR FILTER_ sample application in action: _FROG: FILTER SIZE 9×9_

FUZZY BLUR OVERVIEW

The _FUZZY BLUR FILTER_ relies on the interference of image noise when performing edge detection in order to create a fuzzy effect. In addition image blurring results from performing a

mean filter .

The steps involved in performing a _FUZZY BLUR FILTER_ can be described as follows: * _EDGE DETECTION AND ENHANCEMENT –_ Using the first edge factor specified enhance image edges by performing _BOOLEAN EDGE DETECTION_. Being sensitive to image noise , a fair amount of detected

image edges will

actually be image noise in addition to actual image edges

.

* _MEAN FILTER BLUR –_ Using the edge enhanced image created in the previous step perform a mean filter blur. The enhanced edges will be blurred since a Mean filter does not have edge preservation properties. The size of the Mean filter implemented depends on a user specified value. * _EDGE DETECTION AND ENHANCEMENT –_  Using the Mean filter

blurred image

created in the previous step once again perform _BOOLEAN EDGE DETECTION_, enhancing detected edges according to the second edge

factor specified.

_FROG: FILTER SIZE 9×9_ MEAN FILTER BLURRING A Mean Filter Blur, also known as a Box Blur , can be performed through image convolution

.

The size of the matrix

/kernel

implemented

when preforming image convolution will be determined through user input.

Every matrix

/kernel

element

should be set to one. The resulting value should be multiplied by a factor value equating to one divided by the matrix

/kernel

size. As an

example, a matrix

/kernel

size of

_3×3_ can be expressed as follows: An alternative expression can also be: _FROG: FILTER SIZE 9×9_ BOOLEAN EDGE DETECTION WITHOUT A LOCAL THRESHOLD When performing _BOOLEAN EDGE DETECTION_ a local threshold should be implemented in order to exclude image noise . In this article we rely on the interference of image noise in order to render a fuzzy

image

effect. By not implementing a local threshold when performing _BOOLEAN EDGE DETECTION_ the sample source code ensures sufficient interference

from image noise .

The steps involved in performing _BOOLEAN EDGE DETECTION_ without a local threshold can be described as follows: * _CALCULATE NEIGHBOURHOOD MEAN –_ Iterate each pixel forming part of the source/input

image

.

Using a _3×3_ matrix

size calculate the

mean value of the neighbourhood surrounding the pixel currently being iterated. * _CREATE MEAN COMPARISON MATRIX –_ Once again using a _3×3_

matrix size

compare each neighbourhood pixel to the newly calculated mean value. Create a temporary _3×3_ size

matrix , each

matrix element’s

value should be the result of mean comparison. Should the value expressed by a neighbourhood pixel exceed the mean value the corresponding temporary matrix

element should be

set to one. When the calculated mean value exceeds the value of a neighbourhood pixel the corresponding temporary  matrix

element should be

set to zero.

* _COMPARE EDGE MASKS –_ Using sixteen predefined edge masks compare the temporary matrix

created in the

previous step to each edge mask. If the temporary matrix

matches one of the

predefined edge masks multiply the specified factor to the pixel currently being iterated. _NOTE: _A detailed article on _BOOLEAN EDGE DETECTION_ implementing a local threshold can be found here: C# How to: Boolean Edge Detection _FROG: FILTER SIZE 9×9_ The sixteen predefined edge masks each represent an image edge

in a different

direction. The predefined edge masks can be expressed as: _FROG: FILTER SIZE 13×13_ IMPLEMENTING A MEAN FILTER The sample source code defines the _MEANFILTER_ method, an extension

method

targeting the Bitmap class. The definition listed as follows: private static Bitmap MeanFilter(this Bitmap sourceBitmap,

int meanSize)

{

byte pixelBuffer = sourceBitmap.GetByteArray(); byte resultBuffer = new byte; double blue = 0.0, green = 0.0, red = 0.0; double factor = 1.0 / (meanSize * meanSize); int imageStride = sourceBitmap.Width * 4; int filterOffset = meanSize / 2; int calcOffset = 0, filterY = 0, filterX = 0; for (int k = 0; k + 4 < pixelBuffer.Length; k += 4)

{

blue = 0; green = 0; red = 0; filterY = -filterOffset; filterX = -filterOffset; while (filterY <= filterOffset)

{

calcOffset = k + (filterX * 4) + (filterY * imageStride); calcOffset = (calcOffset < 0 ? 0 : (calcOffset >= pixelBuffer.Length - 2 ? pixelBuffer.Length - 3 : calcOffset)); blue += pixelBuffer; green += pixelBuffer; red += pixelBuffer;

filterX++;

if (filterX > filterOffset)

{

filterX = -filterOffset;

filterY++;

}

}

resultBuffer = ClipByte(factor * blue); resultBuffer = ClipByte(factor * green); resultBuffer = ClipByte(factor * red); resultBuffer = 255;

}

return resultBuffer.GetImage(sourceBitmap.Width, sourceBitmap.Height);

}

_FROG: FILTER SIZE 19×19_ IMPLEMENTING BOOLEAN EDGE DETECTION _BOOLEAN EDGE DETECTION_ is performed in the sample source code through the implementation of the _BOOLEANEDGEDETECTIONFILTER_ method. This method has been defined as an extension method targeting the Bitmap

class.

The following code snippet provides the definition of the _BOOLEANEDGEDETECTIONFILTER_ extension method

:

public static Bitmap BooleanEdgeDetectionFilter( this Bitmap sourceBitmap, float edgeFactor)

{

byte pixelBuffer = sourceBitmap.GetByteArray(); byte resultBuffer = new byte; Buffer.BlockCopy(pixelBuffer, 0, resultBuffer, 0, pixelBuffer.Length); List edgeMasks = GetBooleanEdgeMasks(); int imageStride = sourceBitmap.Width * 4; int matrixMean = 0, pixelTotal = 0; int filterY = 0, filterX = 0, calcOffset = 0; string matrixPatern = String.Empty; for (int k = 0; k + 4 < pixelBuffer.Length; k += 4)

{

matrixPatern = String.Empty; matrixMean = 0; pixelTotal = 0; filterY = -1; filterX = -1; while (filterY < 2)

{

calcOffset = k + (filterX * 4) + (filterY * imageStride); calcOffset = (calcOffset < 0 ? 0 : (calcOffset >= pixelBuffer.Length - 2 ? pixelBuffer.Length - 3 : calcOffset)); matrixMean += pixelBuffer; matrixMean += pixelBuffer; matrixMean += pixelBuffer;

filterX += 1;

if (filterX > 1)

{ filterX = -1; filterY += 1; }

}

matrixMean = matrixMean / 9; filterY = -1; filterX = -1; while (filterY < 2)

{

calcOffset = k + (filterX * 4) + (filterY * imageStride); calcOffset = (calcOffset < 0 ? 0 : (calcOffset >= pixelBuffer.Length - 2 ? pixelBuffer.Length - 3 : calcOffset)); pixelTotal = pixelBuffer; pixelTotal += pixelBuffer; pixelTotal += pixelBuffer; matrixPatern += (pixelTotal > matrixMean

? "1" : "0");

filterX += 1;

if (filterX > 1)

{ filterX = -1; filterY += 1; }

}

if (edgeMasks.Contains(matrixPatern))

{

resultBuffer =

ClipByte(resultBuffer * edgeFactor);

resultBuffer =

ClipByte(resultBuffer * edgeFactor);

resultBuffer =

ClipByte(resultBuffer * edgeFactor);

}

}

return resultBuffer.GetImage(sourceBitmap.Width, sourceBitmap.Height);

}

_FROG: FILTER SIZE 13×13_ The predefined edge masks implemented in mean comparison have been wrapped by the _GETBOOLEANEDGEMASKS_ method. The definition as

follows:

public static List GetBooleanEdgeMasks()

{

List edgeMasks = new List(); edgeMasks.Add("011011011"); edgeMasks.Add("000111111"); edgeMasks.Add("110110110"); edgeMasks.Add("111111000"); edgeMasks.Add("011011001"); edgeMasks.Add("100110110"); edgeMasks.Add("111011000"); edgeMasks.Add("111110000"); edgeMasks.Add("111011001"); edgeMasks.Add("100110111"); edgeMasks.Add("001011111"); edgeMasks.Add("111110100"); edgeMasks.Add("000011111"); edgeMasks.Add("000110111"); edgeMasks.Add("001011011"); edgeMasks.Add("110110100");

return edgeMasks;

}

_FROG: FILTER SIZE 19×19_ IMPLEMENTING A FUZZY BLUR FILTER The _FUZZYEDGEBLURFILTER_ method serves as the implementation of a _FUZZY BLUR FILTER_. As discussed earlier a _FUZZY BLUR FILTER_ involves enhancing image edges through _BOOLEAN EDGE DETECTION_, performing a Mean Filter blur and then once again performing _BOOLEAN EDGE DETECTION_. This method has been defined as an extension method targeting the Bitmap

class.

The following code snippet provides the definition of the _FUZZYEDGEBLURFILTER_ method: public static Bitmap FuzzyEdgeBlurFilter(this Bitmap sourceBitmap,

int filterSize,

float edgeFactor1,

float edgeFactor2)

{

return

sourceBitmap.BooleanEdgeDetectionFilter(edgeFactor1). MeanFilter(filterSize).BooleanEdgeDetectionFilter(edgeFactor2);

}

_FROG: FILTER SIZE 3×3_

SAMPLE IMAGES

This article features a number of sample images. All featured images have been licensed allowing for reproduction. The following images feature as sample images: * _TYLER’S TREE FROG_ * _ATTRIBUTION:_ LiquidGhoul . This file has been released into the public domain

by its author,

LiquidGhoul . This

applies worldwide.

* Download from Wikipedia

.

* _PHYLLOBATES TERRIBILIS_ * _ATTRIBUTION:_ Wilfried Berns

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 2.0 Germany

license.

* Download from Wikipedia

.

* _DENDROPSOPHUS MICROCEPHALUS_ * _ATTRIBUTION:_ Brian Gratwicke . This file is licensed under the Creative Commons

Attribution 2.0

Generic license.

* Download from Wikipedia * _PANAMANIAN GOLDEN FROG_ * _ATTRIBUTION:_ Brian Gratwicke . This file is licensed under the Creative Commons

Attribution 2.0

Generic license.

* Download from Wikipedia

.

RELATED ARTICLES AND FEEDBACK Feedback and questions are always encouraged. If you know of an alternative implementation or have ideas on a more efficient implementation please share in the comments section. _DEWALD ESTERHUIZEN _ I’ve published a number of articles related to imaging and images of which you can find URL links here: * C# How to: Image filtering by directly manipulating Pixel ARGB

values

* C# How to: Image filtering implemented using a ColorMatrix * C# How to: Blending Bitmap images using colour filters * C# How to: Bitmap Colour Substitution implementing thresholds * C# How to: Generating Icons from Images * C# How to: Swapping Bitmap ARGB Colour Channels * C# How to: Bitmap Pixel manipulation using LINQ Queries * C# How to: Linq to Bitmaps – Partial Colour Inversion * C# How to: Bitmap Colour Balance * C# How to: Bi-tonal Bitmaps * C# How to: Bitmap Colour Tint * C# How to: Bitmap Colour Shading * C# How to: Image Solarise * C# How to: Image Contrast * C# How to: Bitwise Bitmap Blending * C# How to: Image Arithmetic * C# How to: Image Convolution * C# How to: Image Edge Detection * C# How to: Difference Of Gaussians * C# How to: Image Median Filter * C# How to: Image Unsharp Mask * C# How to: Image Colour Average * C# How to: Image Erosion and Dilation * C# How to: Morphological Edge Detection * C# How to: Boolean Edge Detection * C# How to: Gradient Based Edge Detection * C# How to: Sharpen Edge Detection * C# How to: Image Cartoon Effect * C# How to: Calculating Gaussian Kernels * C# How to: Image Blur * C# How to: Image Transform Rotate * C# How to: Image Transform Shear * C# How to: Compass Edge Detection * C# How to: Oil Painting and Cartoon Filter * C# How to: Stained Glass Image Filter * C# How to: Image ASCII Art * C# How to: Weighted Difference of Gaussians * C# How to: Image Boundary Extraction * C# How to: Image Abstract Colours Filter

RATE THIS:

i

11 Votes

SHARE THIS:

* Twitter

* Facebook

* Reddit

* LinkedIn

* Tumblr

* Pinterest

* Pocket

* Email

* Print

*

LIKE THIS:

Like Loading...

C# HOW TO: IMAGE ABSTRACT COLOURS FILTER Published July 28, 2013 Augmented Reality

, Blogging

, C#

, Code

Samples , Edge

Detection

, Extension Methods

, Graphic Filters

, How to

, Image Arithmetic

, Image Filtering

, Image

Filters

,

Image Processing

, Image Transform

, Learn Everyday

, Microsoft

, New Version

,

Non-Photorealistic Rendering

, Opensource ,

Tip , Update

4 Comments

Tags: Augmented Reality

, Binary Image

, Bitmap ARGB

, Bitmap Filters

, Bitmap.LockBits

, BitmapData

, C#

, Code Sample

, Color Averaging

, Color Filters

, Computer vision

, Converting

Images , Edge

Detect , Edge

Detection , Feature

extraction ,

Graphic Filters ,

Image , Image Intensity

, Image processing

, Image Transform

, Machine vision

,

Non-Photorealistic Rendering

,

Pixel Filters

ARTICLE PURPOSE

This article explores _ABSTRACT COLOUR IMAGE FILTERS_ as a process of _NON-PHOTO REALISTIC IMAGE RENDERING_. The output images produced reflects a variety of artistic effects.

COLOUR VALUES

Red, Blue

FILTER SIZE

9

EDGE TRACING

Black

EDGE THRESHOLD

55

SAMPLE SOURCE CODE

This article is accompanied by a sample source code Visual Studio project which is available for download here

.

COLOUR VALUES

Blue

FILTER SIZE

9

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

USING THE SAMPLE APPLICATION The sample source code that accompanies this article includes a

Windows Forms

based sample application. The concepts discussed in this article have been illustrated through the implementation of the sample application. When executing the sample application, through the user interface several options are made available to the user, described as follows: * _LOAD/SAVE __IMAGES_

_

–_ Source/input images may be loaded from the local file

system

through clicking the _LOAD IMAGE_ button. If desired by the user, resulting output images can be saved to the local file system through clicking the _SAVE

IMAGE_ button.

* _COLOUR CHANNELS –_ The colour values _RED_, _GREEN_ and _BLUE_ can be updated or remain unchanged when applying a filter, indicated through the associated Checkboxes

.

* _FILTER SIZE –_ The level of filter intensity depends on the size of the filter. Larger filter sizes result in more intense filtering being applied. Smaller filter size result in less intense filtering being applied. * _COLOUR SHIFT TYPE –_ Colour intensity values can be swapped around through selecting the _COLOUR SHIFT TYPE:_ _SHIFT LEFT_ and

_SHIFT RIGHT_.

* _EDGE TRACING TYPE –_ When applying a filter the edges forming part of the original source/input image will be expressed as part of the output image

.

The method in which image edges

are

indicated/highlighted will be determined through the type of _EDGE TRACING_ specified when applying the filter. Supported types of _EDGE TRACING_ include: _BLACK, WHITE, HALF INTENSITY, DOUBLE INTENSITY AND

INVERTED_.

* _EDGE THRESHOLD –_ Edges forming part of the source/input image are determines through means of image edge detection implementing a threshold value. Lower threshold values result in more emphasized edges expressed within resulting images

.

Higher threshold values reduce edge emphasis in resulting images

.

COLOUR VALUES

Green

FILTER SIZE

9

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

COLOUR VALUES

Red, Blue

FILTER SIZE

9

EDGE TRACING

Double Intensity

EDGE THRESHOLD

55

The following image is a screenshot of the _IMAGE ABSTRACT COLOUR FILTER_ sample application in action: ABSTRACTING IMAGE COLOURS The _ABSTRACT COLOUR FILTER_ explored in this article can be considered a _NON-PHOTO REALISTIC FILTER_. As the title implies, _NON-PHOTO REALISTIC FILTERS_ transforms an input image

,

usually a photograph, producing a result image which visibly lacks the aspects of realism expressed in the input

image

.

In most scenarios the objective of _NON-PHOTO REALISTIC FILTERS_ can be described as using photographic images

in

rendering images

having an animated appearance.

COLOUR VALUES

Blue

FILTER SIZE

11

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

COLOUR VALUES

Red

FILTER SIZE

11

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

The _ABSTRACT COLOUR FILTER_ can be broken down into two main components: _COLOUR AVERAGING_ and Image Edge detection . Through implementing a variety of colour averaging algorithms resulting images express abstract yet uniform colours. Abstract colours result in

output images

no

longer appearing photo realistic, instead output images appear unconventionally augmented/artistic.

Output images

express a lesser degree of image definition and detail, when compared to input images

.

In some scenarios output images might not be easily recognisable. In order to retain some image detail, edge/boundary detail detected from input images will be emphasised in result images

.

COLOUR VALUES

Green

FILTER SIZE

11

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

COLOUR VALUES

Green, Blue

FILTER SIZE

11

EDGE TRACING

Double Intensity

EDGE THRESHOLD

75

The steps required when applying an _ABSTRACT COLOUR FILTER_ can be described as follows: * _PERFORM __EDGE DETECTION_

– Using the

source/input image

perform edge detection , producing a binary image expressing image edges in the foreground/as _WHITE_. * _CALCULATE __PIXEL_ _ NEIGHBOURHOOD COLOUR AVERAGES_ – Iterate each pixel forming part of the input image

,

inspecting the pixel ’s neighbouring pixels . Calculate the sum total and average of each colour channel, _RED_, _GREEN_ and _BLUE_. The value of the pixel currently being iterated should be set depending to neighbourhood

average.

* _TRACE EDGES WITHIN COLOUR AVERAGES_ – Simultaneously iterate the colour average image and the edge detected image

.

If the pixel being iterated forms part of an edge, update the corresponding pixel in the average colour image

,

depending on the specified method of _EDGE TRACING_.

COLOUR VALUES

Red, Green

FILTER SIZE

11

EDGE TRACING

Double Intensity

EDGE THRESHOLD

75

COLOUR VALUES

Red

FILTER SIZE

11

EDGE TRACING

Black

EDGE THRESHOLD

60

IMPLEMENTING PIXEL NEIGHBOURHOOD COLOUR AVERAGING In the sample source code neighbourhood colour averaging has been implemented through the definition of the _AVERAGECOLOURSFILTER_

extension method

. This

method creates a new image using the source image

as

input. The following code snippet provides the definition: public static Bitmap AverageColoursFilter(this Bitmap sourceBitmap,

int matrixSize,

bool applyBlue = true, bool applyGreen = true, bool applyRed = true, ColorShiftType shiftType = ColorShiftType.None)

{

byte pixelBuffer = sourceBitmap.GetByteArray(); byte resultBuffer = new byte; int calcOffset = 0; int byteOffset = 0; int blue = 0; int green = 0; int red = 0; int filterOffset = (matrixSize - 1) / 2; for (int offsetY = filterOffset; offsetY < sourceBitmap.Height - filterOffset; offsetY++)

{

for (int offsetX = filterOffset; offsetX < sourceBitmap.Width - filterOffset; offsetX++)

{

byteOffset = offsetY * sourceBitmap.Width*4 +

offsetX * 4;

blue = 0; green = 0; red = 0; for (int filterY = -filterOffset; filterY <= filterOffset; filterY++)

{

for (int filterX = -filterOffset; filterX <= filterOffset; filterX++)

{

calcOffset = byteOffset +

(filterX * 4) +

(filterY * sourceBitmap.Width * 4); blue += pixelBuffer; green += pixelBuffer; red += pixelBuffer;

}

}

blue = blue / matrixSize; green = green / matrixSize; red = red / matrixSize; if (applyBlue == false ) { blue = pixelBuffer; } if (applyGreen == false ) { green = pixelBuffer; } if (applyRed == false ) { red = pixelBuffer; } if (shiftType == ColorShiftType.None)

{

resultBuffer = (byte)blue; resultBuffer = (byte)green; resultBuffer = (byte)red; resultBuffer = 255;

}

else if (shiftType == ColorShiftType.ShiftLeft)

{

resultBuffer = (byte)green; resultBuffer = (byte)red; resultBuffer = (byte)blue; resultBuffer = 255;

}

else if (shiftType == ColorShiftType.ShiftRight)

{

resultBuffer = (byte)red; resultBuffer = (byte)blue; resultBuffer = (byte)green; resultBuffer = 255;

}

}

}

Bitmap resultBitmap = new Bitmap(sourceBitmap.Width, sourceBitmap.Height); BitmapData resultData = resultBitmap.LockBits(new Rectangle (0, 0, resultBitmap.Width, resultBitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); Marshal.Copy(resultBuffer, 0, resultData.Scan0, resultBuffer.Length); resultBitmap.UnlockBits(resultData); return resultBitmap;

}

COLOUR VALUES

Green, Blue

FILTER SIZE

17

EDGE TRACING

Black

EDGE THRESHOLD

85

IMPLEMENTING GRADIENT BASED EDGE DETECTION When applying an _ABSTRACT COLOURS FILTER_, one of the required steps

involve image

edge detection . The sample source code implements Gradient based

edge detection

through the definition of the _GRADIENTBASEDEDGEDETECTIONFILTER_ method. This method has been defined as an extension method targeting the bitmap class. The definition

as follows:

public static Bitmap GradientBasedEdgeDetectionFilter( this Bitmap sourceBitmap, byte threshold = 0)

{

BitmapData sourceData = sourceBitmap.LockBits(new Rectangle (0, 0, sourceBitmap.Width, sourceBitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); byte pixelBuffer = new byte; byte resultBuffer = new byte; Marshal.Copy(sourceData.Scan0, pixelBuffer, 0, pixelBuffer.Length); sourceBitmap.UnlockBits(sourceData); int sourceOffset = 0, gradientValue = 0; bool exceedsThreshold = false; for (int offsetY = 1; offsetY < sourceBitmap.Height - 1; offsetY++)

{

for (int offsetX = 1; offsetX < sourceBitmap.Width - 1; offsetX++)

{

sourceOffset = offsetY * sourceData.Stride +

offsetX * 4;

gradientValue = 0; exceedsThreshold = true; // Horizontal Gradient CheckThreshold(pixelBuffer,

sourceOffset - 4,

sourceOffset + 4,

ref gradientValue, threshold, 2); // Vertical Gradient

exceedsThreshold =

CheckThreshold(pixelBuffer, sourceOffset - sourceData.Stride, sourceOffset + sourceData.Stride, ref gradientValue, threshold, 2); if (exceedsThreshold == false)

{

gradientValue = 0; // Horizontal Gradient

exceedsThreshold =

CheckThreshold(pixelBuffer,

sourceOffset - 4,

sourceOffset + 4,

ref gradientValue, threshold); if (exceedsThreshold == false)

{

gradientValue = 0; // Vertical Gradient

exceedsThreshold =

CheckThreshold(pixelBuffer, sourceOffset - sourceData.Stride, sourceOffset + sourceData.Stride, ref gradientValue, threshold); if (exceedsThreshold == false)

{

gradientValue = 0; // Diagonal Gradient : NW-SE CheckThreshold(pixelBuffer, sourceOffset - 4 - sourceData.Stride, sourceOffset + 4 + sourceData.Stride, ref gradientValue, threshold, 2); // Diagonal Gradient : NE-SW

exceedsThreshold =

CheckThreshold(pixelBuffer, sourceOffset - sourceData.Stride + 4, sourceOffset - 4 + sourceData.Stride, ref gradientValue, threshold, 2); if (exceedsThreshold == false)

{

gradientValue = 0; // Diagonal Gradient : NW-SE

exceedsThreshold =

CheckThreshold(pixelBuffer, sourceOffset - 4 - sourceData.Stride, sourceOffset + 4 + sourceData.Stride, ref gradientValue, threshold); if (exceedsThreshold == false)

{

gradientValue = 0; // Diagonal Gradient : NE-SW

exceedsThreshold =

CheckThreshold(pixelBuffer, sourceOffset - sourceData.Stride + 4, sourceOffset + sourceData.Stride - 4, ref gradientValue, threshold);

}

}

}

}

}

resultBuffer = (byte)(exceedsThreshold ? 255 : 0); resultBuffer = resultBuffer; resultBuffer = resultBuffer; resultBuffer = 255;

}

}

Bitmap resultBitmap = new Bitmap(sourceBitmap.Width, sourceBitmap.Height); BitmapData resultData = resultBitmap.LockBits(new Rectangle (0, 0, resultBitmap.Width, resultBitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); Marshal.Copy(resultBuffer, 0, resultData.Scan0, resultBuffer.Length); resultBitmap.UnlockBits(resultData); return resultBitmap;

}

COLOUR VALUES

Red, Green

FILTER SIZE

5

EDGE TRACING

Black

EDGE THRESHOLD

85

IMPLEMENTING AN ABSTRACT COLOUR FILTER The _ABSTRACTCOLORSFILTER_ method serves as means of combining an average colour image and an edge detected image

.

This extension method

targets the Bitmap

class. The following code snippet details the definition: public static Bitmap AbstractColorsFilter(this Bitmap sourceBitmap,

int matrixSize,

byte edgeThreshold, bool applyBlue = true, bool applyGreen = true, bool applyRed = true, EdgeTracingType edgeType = EdgeTracingType.Black, ColorShiftType shiftType = ColorShiftType.None)

{

Bitmap edgeBitmap = sourceBitmap.GradientBasedEdgeDetectionFilter(edgeThreshold); Bitmap colorBitmap = sourceBitmap.AverageColoursFilter(matrixSize, applyBlue, applyGreen, applyRed, shiftType); byte edgeBuffer = edgeBitmap.GetByteArray(); byte colorBuffer = colorBitmap.GetByteArray(); byte resultBuffer = colorBitmap.GetByteArray(); for (int k = 0; k + 4 < edgeBuffer.Length; k += 4)

{

if (edgeBuffer == 255)

{

switch (edgeType)

{

case EdgeTracingType.Black:

resultBuffer = 0;

resultBuffer = 0;

resultBuffer = 0;

break;

case EdgeTracingType.White: resultBuffer = 255; resultBuffer = 255; resultBuffer = 255;

break;

case EdgeTracingType.HalfIntensity: resultBuffer = ClipByte(resultBuffer * 0.5); resultBuffer = ClipByte(resultBuffer * 0.5); resultBuffer = ClipByte(resultBuffer * 0.5);

break;

case EdgeTracingType.DoubleIntensity: resultBuffer = ClipByte(resultBuffer * 2); resultBuffer = ClipByte(resultBuffer * 2); resultBuffer = ClipByte(resultBuffer * 2);

break;

case EdgeTracingType.ColorInversion: resultBuffer = ClipByte(255 - resultBuffer); resultBuffer = ClipByte(255 - resultBuffer); resultBuffer = ClipByte(255 - resultBuffer);

break;

}

}

}

Bitmap resultBitmap = new Bitmap (sourceBitmap.Width, sourceBitmap.Height); BitmapData resultData = resultBitmap.LockBits(new Rectangle (0, 0, resultBitmap.Width, resultBitmap.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); Marshal.Copy(resultBuffer, 0, resultData.Scan0, resultBuffer.Length); resultBitmap.UnlockBits(resultData); return resultBitmap;

}

COLOUR VALUES

Red, Green

FILTER SIZE

17

EDGE TRACING

Double Intensity

EDGE THRESHOLD

85

SAMPLE IMAGES

This article features a number of sample images. All featured images have been licensed allowing for reproduction. The following images feature as sample images: * Fruit bodies of the agaric fungus _Mycena atkinsoniana_ A.H. Sm. Specimens photographed in Strouds Run State Park, Athens, Ohio, USA * ATTRIBUTED TO: Dan Molter

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

* Download from Wikipedia * The "indigo Lactarius", species _Lactarius indigo_ (Schwein.) Fr. Specimen photographed in Strouds Run State Park, Athens, Ohio, USA. * ATTRIBUTED TO: Dan Molter

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 3.0 Unported

license.

* Download from Wikipedia * Amanita muscaria (fly agaric), Norway * ATTRIBUTED TO: User-MichaelMaggs

. This file is

licensed under the Creative Commons

Attribution-Share

Alike 2.5 Generic

license.

* Download from Wikipedia

.

*

Lung Oyster

(_Pleurotus pulmonarius

_), Småland,

Sweden.

*

ATTRIBUTED TO: Jörg Hempel . This file is licensed under the Creative Commons

Attribution-Share

Alike 3.0 Germany

license.

*

Download from WikiMedia.org ADDITIONAL FILTER RESULT IMAGES The following series of images represent additional filter results.

COLOUR VALUES

Red

FILTER SIZE

9

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

COLOUR VALUES

Green, Blue

FILTER SIZE

9

EDGE TRACING

Double Intensity

EDGE THRESHOLD

60

COLOUR VALUES

Green, Blue

FILTER SIZE

9

EDGE TRACING

Black

EDGE THRESHOLD

60

COLOUR VALUES

Red, Green, Blue

FILTER SIZE

9

EDGE TRACING

Double Intensity

EDGE THRESHOLD

55

COLOUR VALUES

Red, Green, Blue

FILTER SIZE

11

EDGE TRACING

Black

EDGE THRESHOLD

75

COLOUR VALUES

Red, Blue

FILTER SIZE

11

EDGE TRACING

Double Intensity

EDGE THRESHOLD

75

COLOUR VALUES

Green

FILTER SIZE

17

EDGE TRACING

Black

EDGE THRESHOLD

85

COLOUR VALUES

Red

FILTER SIZE

17

EDGE TRACING

Black

EDGE THRESHOLD

85

COLOUR VALUES

Red, Green, Blue

FILTER SIZE

5

EDGE TRACING

Half Edge

EDGE THRESHOLD

85

COLOUR VALUES

Blue

FILTER SIZE

5

EDGE TRACING

Double Intensity

EDGE THRESHOLD

75

COLOUR VALUES

Green

FILTER SIZE

5

EDGE TRACING

Double Intensity

EDGE THRESHOLD

75

COLOUR VALUES

Red

FILTER SIZE

5

EDGE TRACING

Double Intensity

EDGE THRESHOLD

75

COLOUR VALUES

Red, Green, Blue

FILTER SIZE

5

EDGE TRACING

Black

EDGE THRESHOLD

75

COLOUR VALUES

Red, Green, Blue

FILTER SIZE

9

EDGE TRACING

Black

EDGE THRESHOLD

55

COLOUR VALUES

Red, Green, Blue

FILTER SIZE

3

EDGE TRACING

Black

EDGE THRESHOLD

75

RELATED ARTICLES AND FEEDBACK Feedback and questions are always encouraged. If you know of an alternative implementation or have ideas on a more efficient implementation please share in the comments section. _DEWALD ESTERHUIZEN _ I’ve published a number of articles related to imaging and images of which you can find URL links here: * C# How to: Image filtering by directly manipulating Pixel ARGB

values

* C# How to: Image filtering implemented using a ColorMatrix * C# How to: Blending Bitmap images using colour filters * C# How to: Bitmap Colour Substitution implementing thresholds * C# How to: Generating Icons from Images * C# How to: Swapping Bitmap ARGB Colour Channels * C# How to: Bitmap Pixel manipulation using LINQ Queries * C# How to: Linq to Bitmaps – Partial Colour Inversion * C# How to: Bitmap Colour Balance * C# How to: Bi-tonal Bitmaps * C# How to: Bitmap Colour Tint * C# How to: Bitmap Colour Shading * C# How to: Image Solarise * C# How to: Image Contrast * C# How to: Bitwise Bitmap Blending * C# How to: Image Arithmetic * C# How to: Image Convolution * C# How to: Image Edge Detection * C# How to: Difference Of Gaussians * C# How to: Image Median Filter * C# How to: Image Unsharp Mask * C# How to: Image Colour Average * C# How to: Image Erosion and Dilation * C# How to: Morphological Edge Detection * C# How to: Boolean Edge Detection * C# How to: Gradient Based Edge Detection * C# How to: Sharpen Edge Detection * C# How to: Image Cartoon Effect * C# How to: Calculating Gaussian Kernels * C# How to: Image Blur * C# How to: Image Transform Rotate * C# How to: Image Transform Shear * C# How to: Compass Edge Detection * C# How to: Oil Painting and Cartoon Filter * C# How to: Stained Glass Image Filter * C# How to: Image ASCII Art * C# How to: Weighted Difference of Gaussians * C# How to: Image Boundary Extraction

RATE THIS:

i

13 Votes

SHARE THIS:

* Twitter

* Facebook

* Reddit

* LinkedIn

* Tumblr

* Pinterest

* Pocket

* Email

* Print

*

LIKE THIS:

Like Loading...

Older posts

Next Page »

-------------------------

DEWALD ESTERHUIZEN

RSS FEED

RECENT POSTS

* C# How to: Min/Max Edge Detection * C# How to: Standard Deviation Edge Detection * C# How to: Image Distortion Blur * C# How to: Fuzzy Blur Filter * C# How to: Image Abstract Colours Filter * C# How to: Image Boundary Extraction * C# How to: Weighted Difference of Gaussians * C# How to: Image ASCII Art * C# How to: Stained Glass Image Filter * C# How to: Oil Painting and Cartoon Filter

BLOG STATS

* 694,631 hits

FOLLOW SOFTWAREBYDEFAULT VIA EMAIL Enter your email address to follow and receive notifications of new

posts by email.

Join 221 other followers

Follow

CATEGORIES

Augmented Reality

Blogging

C#

Code Samples

Edge Detection

Extension Methods

Generics

Graphic Filters

Graphics How to

Image

Arithmetic

Image Convolution

Image Filtering

Image

Filters

Image Processing

Image Transform

Learn Everyday

Microsoft

Morphology Filters

New Version

Opensource Social

Media Tip

Uncategorized

Update

Widgets

Wikipedia

Wordpress

XML

XML Serialization

TOP POSTS & PAGES

* C# How to: Image Edge Detection * C# How to: Decoding/Converting Base64 strings to Bitmap images * C# How to: Image Convolution * C# How to: Calculating Gaussian Kernels * C# How to: Encoding Bitmaps to Base64 strings * C# How to: Check if a Tcp Port is in use * C# How to: Generate a Web Service from WSDL * C# How to: Compass Edge Detection * C# How to: Image Contrast * C# How to: Image Median Filter

ARCHIVES

Archives Select Month August 2015 August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012

C# HOW TO ARTICLES

* C# How to: Bitmap Colour Substitution implementing thresholds * C# How to: Blending Bitmap images using colour filters * C# How to: Boolean Edge Detection * C# How to: Calculating Gaussian Kernels * C# How to: Changing a File’s read only attribute * C# How to: Check if a Tcp Port is in use * C# How to: Compass Edge Detection * C# How to: Decoding/Converting Base64 strings to Bitmap images * C# How to: Deep copy objects using Binary Serialization * C# How to: Determine free space on a drive * C# How to: Drawing in GDI with Opacity/Alpha components * C# How to: Encoding Base64 Thumbnails * C# How to: Encoding Bitmaps to Base64 strings * C# How to: Generate a Web Service from WSDL * C# How to: Generating Icons from Images * C# How to: Gradient Based Edge Detection * C# How to: Image Blur * C# How to: Image Cartoon Effect * C# How to: Image filtering by directly manipulating Pixel ARGB

values

* C# How to: Image filtering implemented using a ColorMatrix * C# How to: Image Transform Rotate * C# How to: Image Transform Shear * C# How to: Implementing Generic Xml Deserialization by extending

the string class

* C# How to: Implementing Xml Serialization through a generic

extension method

* C# How to: Oil Painting and Cartoon Filter * C# How to: Stained Glass Image Filter * C# How to: Swapping Bitmap ARGB Colour Channels * C# How to: Using Microsoft Kinect with Windows Forms * Extending ConfigurationManager – Get values by type * Morphological Edge Detection SOFTWAREBYDEFAULT ONLINE REFERENCES * @DefaultSoftware Twitter Profile * Bat2Exe on Codeplex.com * Bat2Exe on SourceForge.net * Bloggers.com Profile

* Channel 9 Profile

* Featured on CoolThingOfTheDay

* flickr Profile

* Google+

* Microsoft TouchDevelop Profile

* MSDN Profile

* NonStandardForms on Codeplex.com

* O'Reilly Profile

* SoftwareByDefault on Codeplex.com * SoftwareByDefault on SourceForge.net

TWITTER FEED

* @mimijafta @CityPowerJhb Same for Randpark Ridge :(

2 months ago

* Sense of purpose aids sleep, US scientists find theguardian.com/science/2017/j…

2 years ago

* mailchi.mp/growingagile/j…

2 years ago

* RT @RachelAppel : Best strategy for dealing with tech recruiters... :D https://t.co/nC9npXjQJI

2 years ago

* RT @jsnover : LIKES and RETWEETS are the new opium of the people 2 years ago SOFTWAREBYDEFAULT ON MSDN * Received a 5 star rating on the How to determine if a Tcp/IP Port is in use contribution on the Samples Gallery.

October 10, 2018

* Received a 5 star rating on the How to determine if a Tcp/IP Port is in use contribution on the Samples Gallery.

October 10, 2018

* Received a 5 star rating on the How to determine if a Tcp/IP Port is in use contribution on the Samples Gallery.

October 10, 2018

* Received a 5 star rating on the Generating a Web Service from WSDL contribution on the Samples Gallery.

March 16, 2018

* Received a 5 star rating on the Generating a Web Service from WSDL contribution on the Samples Gallery.

March 16, 2018

* Received a 5 star rating on the Generating a Web Service from WSDL contribution on the Samples Gallery.

March 16, 2018

* Received a 5 star rating on the Generating a Web Service from WSDL contribution on the Samples Gallery.

July 26, 2016

* Received a 4 star rating on the Generating a Web Service from WSDL contribution on the Samples Gallery.

July 21, 2016

* The Generic Xml Deserialization by extending the string class contribution has been downloaded 1,000 times from the Samples Gallery. That's quite the achievement!

June 18, 2016

* Received a 5 star rating on the How to determine if a Tcp/IP Port is in use contribution on the Samples Gallery.

June 9, 2016

MSDN ARTICLES

* ARGB Image Filters * Bitmap Color Substitution * Blending Bitmap Images * ColorMatrix Image Filters * Converting Base64 strings to Bitmap images * Deep Copy: Binary Serialization, Generics and Extension Methods * Deep Copy: NetDataContractSerializer, Generics and Extension

Methods

* Encoding Base64 Thumbnails * Encoding Bitmaps to Base64 Strings * Generating a Web Service from WSDL * Generic Xml Deserialization by extending the string class * How to determine if a Tcp/IP Port is in use * Image to Icon Generator * Implementing Xml Serialization through a generic extension method

CATEGORIES

Augmented Reality

Blogging

C#

Code Samples

Edge Detection

Extension Methods

Generics

Graphic Filters

Graphics How to

Image

Arithmetic

Image Convolution

Image Filtering

Image

Filters

Image Processing

Image Transform

Learn Everyday

Microsoft

Morphology Filters

New Version

Opensource Social

Media Tip

Uncategorized

Update

Widgets

Wikipedia

Wordpress

XML

XML Serialization

TAGS

32Bit Argb Alpha Red

Green Blue

ARGB Augmented Reality

Base64 Images

Base64 strings

Binary Image

Bitmap

Bitmap.LockBits

Bitmap ARGB

Bitmap ARGB Array

Bitmap Blending

BitmapData

BitmapData.Stride

Bitmap Filters

Blur

Boolean Edge Detection

C#

C# Convolution

C# GDI

Calculating Kernels

Change

detection Code

Sample Color Filters

Computer vision

Converting

Bitmaps

Converting Images

Convolution

filters

Convolution Kernel

Convolution

matrix Edge

Detect Edge Detection

Edge enhance

Edge Masks

Extension Methods

Feature

extraction

Gaussian Gaussian Blur

GDI

Generics

Gradient Edge Detection

Graphic

Filters How to

Image

Image Algorithms

Image Blending

Image Blur

Image Edge Detection

Image

Filters Image

Gradient Image

Intensity Image

Manipulation

Image Morphology

Image Noise Image

processing Image

Sharpen Image

Sharpness Image

Transform Line

Detection Machine

vision Matrix

Median Filter

Open source

Opensource

Pixel Filters

Pixel Manipulation

Sample Images

Swapping ARGB

System.Drawing

System.Drawing.Bitmap

Windows

Forms Wordpress

Xml

Xml Deserialization

Xml

Serialization

------------------------- Create a free website or blog at WordPress.com. RSS Entries and RSS Comments

Post to

Cancel

* Follow

*

* Software by Default

* Customize

* Follow

* Sign up

* Log in

* Report this content * Manage subscriptions

* Collapse this bar

%d bloggers like this: Send to Email Address Your Name Your Email Address

Cancel

Post was not sent - check your email addresses! Email check failed, please try again Sorry, your blog cannot share posts by email.

Details

3

Copyright © 2023 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0