1. Get pixels
Public Sub DibGet(ByVal IdSource is Long, XBegin is Long, ByVal YBegin is Long, ByVal XEnd is Long, ByVal YEnd is Long).
Dim iBitmap As Long
Dim iDC to long
Dim I As LongDim
Dim W As Long
Dim H As Long
Go to the wrong line when an error occurs.
Done = False
TimeGet = timeGetTime
InPutWid = XEnd - XBegin
InPutHei = YEnd - YBegin
W = InPutWid + 1
H = input i+1
I = (bit \ 8)-1
ReDim ColVal(I,InPutWid,InPutHei)
Use bi24BitInfo.bmiHeader
. BiBitCount = bit
. Double compression = 0 &
. Biplane = 1
. biSize = Len(bi 24 bitinfo . BMI header)
. Double width = W
. biHeight = H
End with ...
ibit map = GetCurrentObject(id source,7 & amp)
IBitmap, 0&,h, colval (0,0,0), bi24BitInfo, 0 & deletes the object iBitmap.
Complete = true
time get = time gettime-time getexit Sub
Error line:
MsgBox "Error number:"&; Uh ... Quantity and quantity. ":"&er. describe
End joint
2。 Processing pixels with filtering algorithm
Shadow filter algorithm seems to be rare. You can search it or write one yourself. It shouldn't be difficult, but I don't have time to help you write it.
Give you an idea: count the color values of all pixels, take the average value, use this average value as the threshold, and convert pixels into binary values.
3。 Output image
Public subdibput (byval id destination as long)
Dim W As Long
Dim H As Long
Go to the wrong line when an error occurs.
Done = False
TimePut = timeGetTime
W = OutPutWid + 1
H = OutPutHei + 1
Use bi24BitInfo.bmiHeader
. Double width = W
. biHeight = H
line bytes =((W * Bits+3 1)And & amp; HFFFFFFE0) \ 8
. biSizeImage = LineBytes * H
End with ...
SetDIBitsToDevice IdDestination,0,0,W,H,0,0,0,H,ColOut(0,0,0),bi24BitInfo.bmiHeader,0
Complete = true
TimePut = timeGetTime - TimePut
outlet connection
Error line:
MsgBox error. describe
End joint