dcsimg
May 28, 2018
Hot Topics:

Diffuse Filtering Images

  • November 19, 2002
  • By Developer.com Staff
  • Send Email »
  • More Articles »

Various Filters can be applied to an image one of Such kind is the Diffuse filter. The diffuse filter uses the rnd function to introduce some randomness to the image and give it a painterly look.

For i = 1 To Picturebox.ScaleHeight - 3
	For j = 1 To Picturebox.ScaleWidth - 3
		pixval = Picturebox.Point(j + CInt(Rnd * 10), _
                         i + CInt(Rnd * 10))
		red_val = "&h" & Mid$(CStr(Hex(pixval)), 5, 2)
		green_val = "&h" & Mid$(CStr(Hex(pixval)), 3, 2)
		blue_val = "&h" & Mid$(CStr(Hex(pixval)), 1, 2)
		If red_val = "&h" Then red_val = "&h0"
		If green_val = "&h" Then green_val = "&h0"
		If blue_val = "&h" Then blue_val = "&h0"
		Picturebox.PSet (j, i), RGB(red_val, green_val, _
                                            blue_val)
	Next
Next

This Code above Traverses the images as a two dimensional array picks all the pixels and randomly rearranges the pixels to some fixed diameter. Since this happens to all the pixels a kind of diffused effeect can be seen on the images.






Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date