by manikantan (12 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 25th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Explains the Image Sharpening Filter
Manikantan
3rd Agenda,
Web Development,
India.
Website:www.3rdagenda.com
Email:[email protected]
Image Sharp Filter
Various Filters can be applied to an image one of Such kind is the sharpen filter.
The Sharpen Filter is more common and more useful than any filters.Every image published
must be sharpened before going to a DTP work.The sharpen filter works on the
diffference between two adjancent pixels.The Sharpen Filter increases the Difference
between the pixel value of the adjacent Pixels so the image appeears Sharper.Main
logic is to increase the Difference beetween the pixel value.
new_value=org_value + 0.5 x difference
in the program i am using
red_val_new = Abs(CInt(red_val) + 0.5 * (CInt(red_val_new) - CInt(red_val)))
green_val_new = Abs(CInt(green_val) + 0.5 * (CInt(gr_val_new) - CInt(green_val)))
blue_val_new = Abs(CInt(blue_val) + 0.5 * (CInt(blue_val_new) - CInt(blue_val)))
the same as above but for all the basic colors are split using the HEX function
For i = 1 To Picturebox.ScaleHeight - 2
For j = 1 To Picturebox.ScaleWidth - 2
pixval = Picturebox.Point(j, i)
pixval_new= Picturebox.Point(j + 1, i + 1)
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)
red_val_new = "&h" & Mid$(CStr(Hex(pixval_new)), 5, 2)
greeen_val_new = "&h" & Mid$(CStr(Hex(pixval_new)), 3, 2)
blue_val_new = "&h" & Mid$(CStr(Hex(pixval_new)), 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"
If red_val_new = "&h" Then red_val_new = "&h0"
If green_val_new = "&h" Then green_val_new = "&h0"
If blue_val_new = "&h" Then blue_val_new = "&h0"
red_val_new = Abs(CInt(red_val) + 0.5 * (CInt(red_val_new) - CInt(red_val)))
green_val_new = Abs(CInt(green_val) + 0.5 * (CInt(gr_val_new) - CInt(green_val)))
blue_val_new = Abs(CInt(blue_val) + 0.5 * (CInt(blue_val_new) - CInt(blue_val)))
Picturebox.PSet (j, i), RGB(red_val_new, green_val_new, blue_val_new)
Next
Next
Article By
Manikantan
email:[email protected]